[Spice-devel] [RFC spice-gtk 2/2] Add make-it-quick Makefile and support files

Christophe de Dinechin christophe at dinechin.org
Thu Sep 27 15:30:59 UTC 2018


From: Christophe de Dinechin <dinechin at redhat.com>

Make-it-Quick is a make-only build system that uses makefiles
for autoconfiguration. For SPICE, it provides a faster, easier to
maintain and more flexible build system.

A key feature made possible by this build system is top-level builds.
Top-level builds are made from a 'spice' directory that has protocol,
common, server and client as its sub-directories. This makes it easy
to make changes in protocol or common and rebuild all impacted server
and client code, with proper header dependency tracking.

The make-it-quick system is still evolving rapidly. In its current
incarnation, it does not yet offer all the usual targets expected from
a makefile generated by automake.

Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
---
 Makefile       |   5 +
 src/Makefile   | 351 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/Makefile |  60 ++++++++++
 3 files changed, 416 insertions(+)
 create mode 100644 Makefile
 create mode 100644 src/Makefile
 create mode 100644 tools/Makefile

diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..80e9fb5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,5 @@
+MIQ=make-it-quick/
+SUBDIRS=src tools
+include $(MIQ)rules.mk
+$(MIQ)rules.mk:
+	git clone http://github.com/c3d/make-it-quick
diff --git a/src/Makefile b/src/Makefile
new file mode 100644
index 0000000..4bc5c11
--- /dev/null
+++ b/src/Makefile
@@ -0,0 +1,351 @@
+TOP=../
+MIQ=$(TOP)make-it-quick/
+
+PACKAGE_NAME=spice-client-gtk-3.0
+PACKAGE_DESCRIPTION=SPICE client for the GTK 3.0 library
+PACKAGE_URL=http://spice-space.org
+PACKAGE_VERSION:=$(shell git describe 2> /dev/null || echo "unkown-version")
+PACKAGE_DIR=
+PACKAGE_REQUIRES=$(PACKAGE_REQUIRES_$(VARIANT))
+PACKAGE_REQUIRES_gtk=gtk+-3.0 >= 3.12 spice-client-glib-2.0
+
+VARIANTS=	config glib gtk
+
+PRODUCTS=	$(PRODUCTS_$(VARIANT))
+PRODUCTS_glib=	spice-client-glib-2.0.dll
+PRODUCTS_gtk=	spice-client-gtk-3.0.dll
+PRODUCTS_VERSION=$(VERSION_$(VARIANT))
+VERSION_glib=	8.6.0
+VERSION_gtk=	5.0.0
+
+BUILTIN_MJPEG=	HAVE_BUILTIN_MJPEG
+ACL_HELPER_PATH=$(PREFIX_BIN)
+
+PKGCONFIGS=	x11?							\
+		pixman-1						\
+		openssl							\
+		gstreamer-1.0						\
+		gstreamer-app-1.0					\
+		gstreamer-video-1.0					\
+		gstreamer-audio-1.0					\
+		gstreamer-plugins-base-1.0				\
+		gstreamer-plugins-bad-1.0?				\
+		gio-2.0							\
+		gio-unix-2.0						\
+		glib-2.0						\
+		atk							\
+		zlib							\
+		libjpeg?						\
+		gtk+-3.0						\
+		polkit-gobject-1?
+
+SPICE_COMMON?=	$(TOP)subprojects/spice-common/
+ifndef SPICE_PROTOCOL
+PKGCONFIGS+=	spice-protocol
+endif
+
+CONFIG=		<sys/socket.h>						\
+		<sys/types.h>						\
+		<netinet/in.h>						\
+		<arpa/inet.h>						\
+		<termios.h>						\
+		<epoxy/egl.h>						\
+		<ucontext.h>						\
+		<polkit/polkit.h>					\
+		<acl/libacl.h>						\
+		<pulse/glib-mainloop.h>					\
+		<X11/XKBlib.h>						\
+		<pygobject.h>						\
+		strtok_r						\
+		clearenv						\
+		libacl							\
+		libjpeg							\
+		gstvideo						\
+		gstaudio						\
+		pulse							\
+		egl							\
+		gdk_event_get_scancode					\
+		polkit_authority_get_sync				\
+		polkit_authorization_result_get_dismissed
+
+INCLUDES=	.							\
+		$(SPICE_PROTOCOL)					\
+		$(SPICE_COMMON)
+
+
+DEFINES=	SPICE_COMPILATION					\
+		PACKAGE_STRING=\"GSpice\"				\
+		G_LOG_DOMAIN=\"GSpice\"					\
+		VERSION=\"$(PACKAGE_VERSION)\"				\
+		GETTEXT_PACKAGE=\"spice-gtk\"				\
+		LOCALE_DIR=\"$(PREFIX_SHARE)locale\"			\
+		SPICE_GTK_LOCALEDIR=\"$(PREFIX_SHARE)locale\"		\
+		PNP_IDS='${pnpdatadir}/pnp.ids'				\
+		USB_IDS=\"\"						\
+		WITH_UCONTEXT=HAVE_UCONTEXT_H				\
+		ACL_HELPER_PATH=\"$(ACL_HELPER_PATH)\"			\
+		GLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_46		\
+		GLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_46		\
+		$(BUILTIN_MJPEG)					\
+		$(DEFINES_$(OS_NAME))
+DEFINES_macosx=	_XOPEN_SOURCE
+
+SOURCES=	$(SOURCES_$(VARIANT))					\
+		$(SOURCES_$(OS_NAME))
+SOURCES_glib=	$(SOURCES_coroutine)					\
+		bio-gio.c						\
+		channel-base.c						\
+		channel-cursor.c					\
+		$(HAVE_GSTVIDEO:%=	channel-display-gst.c)		\
+		channel-display-mjpeg.c					\
+		channel-display.c					\
+		channel-inputs.c					\
+		channel-main.c						\
+		channel-playback.c					\
+		channel-port.c						\
+		channel-record.c					\
+		channel-smartcard.c					\
+		channel-usbredir.c					\
+		channel-webdav.c					\
+		client_sw_canvas.c					\
+		continuation.c						\
+		decode-glz.c						\
+		decode-jpeg.c						\
+		decode-zlib.c						\
+		gio-coroutine.c						\
+		giopipe.c                               		\
+		smartcard-manager.c					\
+		spice-audio.c						\
+		spice-channel.c						\
+		spice-client.c						\
+		$(HAVE_PYOBJECT_H:%=	 spice-client-gtk-module.c)	\
+		spice-file-transfer-task.c				\
+		spice-glib-enums.c					\
+		spice-glib-main.c					\
+		$(HAVE_GSTAUDIO:%=		spice-gstaudio.c)	\
+		spice-marshal.c						\
+		spice-option.c						\
+		$(HAVE_PULSE_GLIB_MAINLOOP_H:%=	spice-pulse.c)		\
+		spice-session.c						\
+		spice-uri.c						\
+		spice-util.c						\
+		$(HAVE_ACL_LIBACL_H:%=		usb-acl-helper.c	\
+		$(HAVE_POLKIT_POLKIT_H:%=				\
+			          spice-client-glib-usb-acl-helper.c))	\
+		usb-device-manager.c					\
+		usbutil.c						\
+		vmcstream.c
+
+SOURCES_gtk=	desktop-integration.c					\
+		spice-grabsequence.c					\
+		spice-gtk-session.c					\
+		spice-marshal.c						\
+		spice-util.c						\
+		spice-widget-cairo.c					\
+		$(HAVE_EGL:%=			spice-widget-egl.c)	\
+		spice-widget-enums.c					\
+		spice-widget.c						\
+		usb-device-widget.c					\
+		vncdisplaykeymap.c
+
+SOURCES_windows=win-usb-dev.c						\
+		usbdk_api.c
+
+CFLAGS_vncdisplaykeymap=	$(CFLAGS_ObjC_$(OS_NAME))
+CFLAGS_ObjC_macosx=-ObjC
+
+LIBRARIES=	$(SPICE_COMMON)spice-common-client.dll			\
+		$(LIBRARIES_$(VARIANT))
+LIBRARIES_gtk=	$(PRODUCTS_glib)
+
+# Headers to install
+PREFIX_HDR=	$(PREFIX)include/$(PREFIX_HDR_$(VARIANT))
+HDR_INSTALL=	$(HEADERS_$(VARIANT))
+
+PREFIX_HDR_gtk=spice-client-gtk-3.0/
+HEADERS_gtk=				\
+	spice-client-gtk.h		\
+	spice-gtk-session.h		\
+	spice-widget.h			\
+	spice-grabsequence.h		\
+	usb-device-widget.h		\
+
+PREFIX_HDR_glib=spice-client-glib-2.0/
+HEADERS_glib=				\
+	spice-audio.h			\
+	spice-client.h			\
+	spice-uri.h			\
+	spice-types.h			\
+	spice-session.h			\
+	spice-channel.h			\
+	spice-util.h			\
+	spice-option.h			\
+	spice-version.h			\
+	channel-cursor.h		\
+	channel-display.h		\
+	channel-inputs.h		\
+	channel-main.h			\
+	channel-playback.h		\
+	channel-port.h			\
+	channel-record.h		\
+	channel-smartcard.h		\
+	channel-usbredir.h		\
+	channel-webdav.h		\
+	usb-device-manager.h		\
+	smartcard-manager.h		\
+	spice-file-transfer-task.h	\
+
+include $(MIQ)rules.mk
+
+$(MIQ)rules.mk:
+	cd $(TOP) && make $(TARGET)
+
+# Coroutine configuration: first Windows, then ucontext, then ghtread
+COROUTINE=	$(firstword						\
+			$(COROUTINE_$(OS_NAME))				\
+			$(HAVE_UCONTEXT_H:%=ucontext)			\
+			gthread)
+COROUTINE_windows=winfibers
+
+SOURCES_coroutine=							\
+		coroutine_$(COROUTINE).c
+
+SPICE_GTK_MAJOR_VERSION=$(shell echo $(PACKAGE_VERSION) | cut -d. -f1)
+SPICE_GTK_MINOR_VERSION=$(shell echo $(PACKAGE_VERSION) | cut -d. -f2)
+SPICE_GTK_MICRO_VERSION=$(shell echo $(PACKAGE_VERSION) | cut -d. -f3 | cut -d- -f1)
+
+GENERATED_FILES =spice-glib-enums.c					\
+		spice-glib-enums.h					\
+		spice-marshal.c						\
+		spice-marshal.h						\
+		spice-widget-enums.c					\
+		spice-widget-enums.h					\
+		spice-version.h						\
+		$(KEYMAPS)
+
+TO_CLEAN=$(GENERATED_FILES)
+
+.prebuild: $(GENERATED_FILES)
+
+# Generated files
+
+spice-version.h: spice-version.h.in $(MAKEFILE_DEPS)
+	$(PRINT_GENERATE) $(GEN_$@)
+GEN_spice-version.h=							\
+	sed < $< > $@ 							\
+	-e 's|@SPICE_GTK_MAJOR_VERSION@|$(SPICE_GTK_MAJOR_VERSION)|g'	\
+	-e 's|@SPICE_GTK_MINOR_VERSION@|$(SPICE_GTK_MINOR_VERSION)|g' 	\
+	-e 's|@SPICE_GTK_MICRO_VERSION@|$(SPICE_GTK_MICRO_VERSION)|g'
+
+spice-marshal.c: spice-marshal.h
+spice-marshal.c spice-marshal.h: spice-marshal.txt
+	$(PRINT_GENERATE) $(GEN_$@)
+GEN_spice-marshal.c=							\
+	echo "\#include \"config.h\"" > $@ && 				\
+	echo "\#include \"spice-marshal.h\"" > $@ && 			\
+	glib-genmarshal --body $< >> $@ || (rm -f $@ && exit 1)
+GEN_spice-marshal.h=							\
+	glib-genmarshal --header $< > $@ || (rm -f $@ && exit 1)
+spice-glib-enums.c: spice-glib-enums.h
+spice-glib-enums.c: spice-channel.h channel-inputs.h spice-session.h
+	$(PRINT_GENERATE) $(GEN_$@)
+GEN_spice-glib-enums.c=							\
+	glib-mkenums							\
+	--fhead "\#include \"config.h\"\n\n" 				\
+	--fhead "\#include <glib-object.h>\n" 				\
+	--fhead "\#include \"spice-glib-enums.h\"\n\n" 			\
+	--fprod "\n\#include \"spice-session.h\"\n" 			\
+	--fprod "\n\#include \"spice-channel.h\"\n" 			\
+	--fprod "\n\#include \"channel-inputs.h\"\n" 			\
+	--vhead "static const G at Type@Value _ at enum_name@_values[] = {"	\
+	--vprod "  { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" },"	\
+	--vtail "  { 0, NULL, NULL }\n};\n\n"				\
+	--vtail "GType\n at enum_name@_get_type (void)\n{\n"		\
+	--vtail "  static GType type = 0;\n"				\
+	--vtail "  static volatile gsize type_volatile = 0;\n\n"	\
+	--vtail "  if (g_once_init_enter(&type_volatile)) {\n"		\
+	--vtail "    type = g_ at type@_register_static (\"@EnumName@\", _ at enum_name@_values);\n" \
+	--vtail "    g_once_init_leave(&type_volatile, type);\n"	\
+	--vtail "  }\n\n"						\
+	--vtail "  return type;\n}\n\n"					\
+	$^ > $@
+
+spice-glib-enums.h: spice-channel.h channel-inputs.h spice-session.h
+	$(PRINT_GENERATE) $(GEN_$@)
+GEN_spice-glib-enums.h=							\
+	glib-mkenums							\
+	--fhead "\#ifndef SPICE_GLIB_ENUMS_H\n"				\
+	--fhead "\#define SPICE_GLIB_ENUMS_H\n\n"			\
+	--fhead "G_BEGIN_DECLS\n\n"					\
+	--ftail "G_END_DECLS\n\n" 					\
+	--ftail "\#endif /* SPICE_CHANNEL_ENUMS_H */\n" 			\
+	--eprod "\#define SPICE_TYPE_ at ENUMSHORT@ @enum_name at _get_type()\n" \
+	--eprod "GType @enum_name at _get_type (void);\n"			\
+	$^ >  $@
+
+spice-widget-enums.c: spice-widget.h
+	$(PRINT_GENERATE) $(GEN_$@)
+GEN_spice-widget-enums.c=						\
+	glib-mkenums --fhead "\#include \"config.h\"\n\n"		\
+	--fhead "\#include <glib-object.h>\n"				\
+	--fhead "\#include \"spice-widget-enums.h\"\n\n"		\
+	--fprod "\n\#include \"spice-widget.h\"\n"			\
+	--vhead "static const G at Type@Value _ at enum_name@_values[] = {"	\
+	--vprod "  { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" },"	\
+	--vtail "  { 0, NULL, NULL }\n};\n\n"				\
+	--vtail "GType\n at enum_name@_get_type (void)\n{\n"		\
+	--vtail "  static GType type = 0;\n"				\
+	--vtail "  static volatile gsize type_volatile = 0;\n\n"	\
+	--vtail "  if (g_once_init_enter(&type_volatile)) {\n"		\
+	--vtail "    type = g_ at type@_register_static (\"@EnumName@\", _ at enum_name@_values);\n" \
+	--vtail "    g_once_init_leave(&type_volatile, type);\n"	\
+	--vtail "  }\n\n"						\
+	--vtail "  return type;\n}\n\n"					\
+	$< > $@
+
+spice-widget-enums.h: spice-widget.h
+	$(PRINT_GENERATE) $(GEN_$@)
+GEN_spice-widget-enums.h=						\
+	glib-mkenums							\
+	--fhead "\#ifndef SPICE_WIDGET_ENUMS_H\n"			\
+	--fhead "\#define SPICE_WIDGET_ENUMS_H\n\n"			\
+	--fhead "G_BEGIN_DECLS\n\n"					\
+	--ftail "G_END_DECLS\n\n"					\
+	--ftail "\#endif /* SPICE_WIDGET_ENUMS_H */\n"			\
+	--eprod "\#define SPICE_TYPE_ at ENUMSHORT@ @enum_name at _get_type()\n" \
+	--eprod "GType @enum_name at _get_type (void);\n"			\
+	$< >  $@
+
+# Keymaps
+KEYMAP_GEN= keycodemapdb/tools/keymap-gen
+KEYMAP_CSV= keycodemapdb/data/keymaps.csv
+KEYMAPS=								\
+	vncdisplaykeymap_xorgevdev2xtkbd.h				\
+	vncdisplaykeymap_xorgkbd2xtkbd.h				\
+	vncdisplaykeymap_xorgxquartz2xtkbd.h				\
+	vncdisplaykeymap_xorgxwin2xtkbd.h				\
+	vncdisplaykeymap_osx2xtkbd.h					\
+	vncdisplaykeymap_win322xtkbd.h					\
+	vncdisplaykeymap_x112xtkbd.h
+
+vncdisplaykeymap.c: $(KEYMAPS)
+$(KEYMAPS): $(KEYMAP_GEN) $(KEYMAP_CSV)
+	$(PRINT_GENERATE) $(GENKEYMAP)
+GENKEYMAP=	$(GENKM1) $(GENKM1_$@) $(GENKM2) $(GENKM2_$@) $(GENKM3)
+GENKM1=		$(PYTHON) $(KEYMAP_GEN) --lang glib2 --varname
+GENKM2=		code-map $(KEYMAP_CSV)
+GENKM3=		xtkbd > $@ || rm $@
+GENKM1_vncdisplaykeymap_xorgevdev2xtkbd.h=	keymap_xorgevdev2xtkbd
+GENKM2_vncdisplaykeymap_xorgevdev2xtkbd.h=	xorgevdev
+GENKM1_vncdisplaykeymap_xorgkbd2xtkbd.h=	keymap_xorgkbd2xtkbd
+GENKM2_vncdisplaykeymap_xorgkbd2xtkbd.h=	xorgkbd
+GENKM1_vncdisplaykeymap_xorgxquartz2xtkbd.h=	keymap_xorgxquartz2xtkbd
+GENKM2_vncdisplaykeymap_xorgxquartz2xtkbd.h=	xorgxquartz
+GENKM1_vncdisplaykeymap_xorgxwin2xtkbd.h=	keymap_xorgxwin2xtkbd
+GENKM2_vncdisplaykeymap_xorgxwin2xtkbd.h=	xorgxwin
+GENKM1_vncdisplaykeymap_osx2xtkbd.h=		keymap_osx2xtkbd
+GENKM2_vncdisplaykeymap_osx2xtkbd.h=		osx
+GENKM1_vncdisplaykeymap_win322xtkbd.h=		keymap_win322xtkbd
+GENKM2_vncdisplaykeymap_win322xtkbd.h=		win32
+GENKM1_vncdisplaykeymap_x112xtkbd.h=		keymap_x112xtkbd
+GENKM2_vncdisplaykeymap_x112xtkbd.h=		x11
diff --git a/tools/Makefile b/tools/Makefile
new file mode 100644
index 0000000..a1538e8
--- /dev/null
+++ b/tools/Makefile
@@ -0,0 +1,60 @@
+TOP=../
+MIQ=$(TOP)make-it-quick/
+
+PACKAGE_NAME=	spice-gtk
+PACKAGE_VERSION=0.3.2
+PACKAGE_BUGS=	spice-devel at lists.freedesktop.org
+PACKAGE_DESCRIPTION=SPICE GTK 3.0 client
+VARIANTS=	viewer stats snap
+
+PRODUCTS=	$(PRODUCTS_$(VARIANT))
+PRODUCTS_viewer=spicy.exe
+PRODUCTS_stats= spicy-stats.exe
+PRODUCTS_snap=	spicy-screenshot.exe
+
+SOURCES=	spice-cmdline.c						\
+		$(SOURCES_$(VARIANT))
+SOURCES_viewer= spicy-connect.c						\
+		spicy.c
+
+SOURCES_stats=	spicy-stats.c
+SOURCES_snap=	spicy-screenshot.c
+
+PKGCONFIGS=	gstreamer-1.0						\
+		gstreamer-app-1.0					\
+		gstreamer-video-1.0					\
+		gstreamer-audio-1.0					\
+		glib-2.0						\
+		gtk+-3.0						\
+		celt051?						\
+		libpulse?						\
+		libpulse-mainloop-glib?
+
+SPICE_COMMON?=	$(TOP)subprojects/spice-common/
+ifndef SPICE_PROTOCOL
+PKGCONFIGS+=	spice-protocol
+endif
+
+CONFIG=		<termios.h>						\
+		gstaudio						\
+		gstvideo						\
+		libacl
+
+DEFINES=	GETTEXT_PACKAGE=\"spice-gtk\"				\
+		SPICE_COMPILATION					\
+		PACKAGE_BUGREPORT='"$(PACKAGE_BUGS)"'			\
+		PACKAGE_VERSION='"$(PACKAGE_VERSION)"'
+
+INCLUDES=	.							\
+		../src							\
+		$(SPICE_PROTOCOL)					\
+		$(SPICE_COMMON)
+
+LIBRARIES=	../src/spice-client-glib-2.0.dll			\
+		../src/spice-client-gtk-3.0.dll				\
+		$(SPICE_COMMON)spice-common-client.dll
+
+include $(MIQ)rules.mk
+
+$(MIQ)rules.mk:
+	cd $(TOP) && make $(MIQ)rules.mk
--
2.13.5 (Apple Git-94)


More information about the Spice-devel mailing list