[Spice-devel] [RFC] server: Add make-it-quick Makefile and support files

Christophe de Dinechin christophe at dinechin.org
Thu Sep 27 15:33:37 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.

Reminder: You need the corresponding RFC in spice-common

Github review link: https://github.com/c3d/spice-server/commits/c3d-build

Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
---
 Makefile                                         |  15 +++
 docs/Makefile                                    |  19 +++
 docs/manual/Makefile                             |  22 ++++
 server/Makefile                                  | 160 +++++++++++++++++++++++
 server/config/check_lz4_compress_fast_continue.c |  16 +++
 subprojects/spice-common                         |   2 +-
 6 files changed, 233 insertions(+), 1 deletion(-)
 create mode 100644 Makefile
 create mode 100644 docs/Makefile
 create mode 100644 docs/manual/Makefile
 create mode 100644 server/Makefile
 create mode 100644 server/config/check_lz4_compress_fast_continue.c

diff --git a/Makefile b/Makefile
new file mode 100644
index 00000000..bde2edc0
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,15 @@
+PACKAGE_NAME=spice-server
+PACKAGE_VERSION=0.13
+PACKAGE_DESCRIPTION=SPICE server library
+PACKAGE_REQUIRES=spice-protocol >= 0.12.14
+PACKAGE_URL=http://spice-space.org
+
+MIQ=make-it-quick/
+
+SUBDIRS=	server docs
+
+# Set srcdir which is used by GNUmakefile in this directory
+srcdir=.
+include $(MIQ)rules.mk
+$(MIQ)rules.mk:
+	git clone http://github.com/c3d/make-it-quick
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 00000000..7fed8c6f
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,19 @@
+TOP=../
+MIQ=$(TOP)make-it-quick/
+
+ASCIIDOC=asciidoc
+ASCIIDOC_FLAGS=-a icons -a toc
+
+HTML_FILES=spice_style.html spice_threading_model.html
+TO_CLEAN+=$(HTML_FILES)
+
+SUBDIRS=manual
+
+include $(MIQ)rules.mk
+$(MIQ)rules.mk:
+	cd $(TOP) && make $(TARGET)
+
+build: $(HTML_FILES)
+
+%.html: %.txt
+	$(PRINT_GENERATE) $(ASCIIDOC) -n $(ASCIIDOC_FLAGS) -o $@ $<
diff --git a/docs/manual/Makefile b/docs/manual/Makefile
new file mode 100644
index 00000000..96cd6422
--- /dev/null
+++ b/docs/manual/Makefile
@@ -0,0 +1,22 @@
+TOP=../
+MIQ=$(MIQ)rules.mk
+
+ASCIIDOC=asciidoc
+A2X=a2x
+ASCIIDOC_FLAGS=-a icons -a toc
+
+DOC_FILES=manual.html manual.chunked
+DOC_DIR=$(OBJDIR)manual-chunked/
+TO_CLEAN+=$(DOC_FILES)
+
+include $(MIQ)rules.mk
+$(MIQ)rules.mk:
+	cd $(TOP) && make $(TARGET)
+
+%.html: %.txt
+	$(PRINT_GENERATE) $(ASCIIDOC) $(ASCIIDOC_FLAGS) -o $@ $<
+
+manual.chunked: manual.txt $(DOC_DIR).mkdir-only
+	$(PRINT_GENERATE) $(A2X) -f chunked -D $(DOC_DIR) $(ASCIIDOC_FLAGS) $<
+
+build: $(DOC_FILES)
diff --git a/server/Makefile b/server/Makefile
new file mode 100644
index 00000000..8e00a5ad
--- /dev/null
+++ b/server/Makefile
@@ -0,0 +1,160 @@
+TOP=../
+MIQ=$(TOP)make-it-quick/
+
+PRODUCTS=	spice-server.dll
+PRODUCTS_VERSION=1.12.5
+
+SPICE_SERVER_VERSION=\"$(shell ../build-aux/git-version-gen ../.tarball-version)\"
+
+PACKAGE_NAME=spice-server
+PACKAGE_VERSION=0.13
+PACKAGE_DESCRIPTION=SPICE server library
+PACKAGE_URL=https://spice-space.org
+PACKAGE_REQUIRES=spice-protocol >= 0.12.14
+PACKAGE_BUGS=spice-devel at lists.freedesktop.org
+PACKAGE_DIR= # Goes directly in $(PREFIX)/lib/
+
+PREFIX_DLL=$(PREFIX_LIB)
+
+PKGCONFIGS=	pixman-1				\
+		openssl					\
+		liblz4?					\
+		gobject-2.0				\
+		glib-2.0				\
+		gio-2.0					\
+		zlib					\
+		opus					\
+		libjpeg?				\
+		gstreamer-1.0				\
+		gstreamer-base-1.0			\
+		gstreamer-app-1.0			\
+		gstreamer-video-1.0			\
+		gstreamer-audio-1.0			\
+		gstreamer-plugins-base-1.0		\
+		orc-0.4
+
+LDFLAGS_SPICE=	--version-script=./spice-server.syms
+LDFLAGS_BUILDENV_linux=$(LDFLAGS_SPICE:%=-Wl,%)
+
+SPICE_COMMON?=$(TOP)subprojects/spice-common/
+
+ifndef SPICE_PROTOCOL
+PKGCONFIGS+=	spice-protocol
+endif
+
+CONFIG=		<lz4.h>					\
+		libjpeg					\
+		lz4_compress_fast_continue
+
+GENERATED=	spice-server-enums.h			\
+		spice-server-enums.c			\
+		spice-version.h
+
+SOURCES=	$(filter %.c, $(GENERATED))		\
+		agent-msg-filter.c			\
+		char-device.c				\
+		common-graphics-channel.c		\
+		cursor-channel.c			\
+		cursor-channel-client.c			\
+		dcc.c					\
+		dcc-send.c				\
+		dispatcher.c				\
+		display-channel.c			\
+		event-loop.c				\
+		glz-encoder.c				\
+		glz-encoder-dict.c			\
+		image-cache.c				\
+		image-encoders.c			\
+		inputs-channel.c			\
+		inputs-channel-client.c			\
+		jpeg-encoder.c				\
+		main-channel.c				\
+		main-channel-client.c			\
+		main-dispatcher.c			\
+		memslot.c				\
+		mjpeg-encoder.c				\
+		net-utils.c				\
+		pixmap-cache.c				\
+		red-channel.c				\
+		red-channel-capabilities.c		\
+		red-channel-client.c			\
+		red-client.c				\
+		red-parse-qxl.c				\
+		red-pipe-item.c				\
+		red-qxl.c				\
+		red-record-qxl.c			\
+		red-replay-qxl.c			\
+		reds.c					\
+		red-stream.c				\
+		red-worker.c				\
+		sound.c					\
+		spice-bitmap-utils.c			\
+		spicevmc.c				\
+		stat-file.c				\
+		video-stream.c				\
+		stream-channel.c			\
+		red-stream-device.c			\
+		sw-canvas.c				\
+		tree.c					\
+		utils.c					\
+		zlib-encoder.c				\
+		$(HAVE_LZ4_H:%=				\
+			lz4-encoder.c)			\
+		$(HAVE_SMARTCARD:%=			\
+			smartcard.c			\
+			smartcard-channel-client.c)	\
+		$(HAVE_GSTREAMER_1_0:%=			\
+			gstreamer-encoder.c)		\
+
+DEFINES=	HAVE_CONFIG_H				\
+		SPICE_SERVER_INTERNAL			\
+		$(DEFINES_$(OS_NAME))			\
+		$(EXTRA_CHECKS_$(TARGET))		\
+		VERSION=$(SPICE_SERVER_VERSION)
+
+DEFINES_macosx=	MSG_NOSIGNAL=0
+
+EXTRA_CHECKS_debug=	ENABLE_EXTRA_CHECKS=1
+EXTRA_CHECKS_opt=	ENABLE_EXTRA_CHECKS=0
+EXTRA_CHECKS_release=	ENABLE_EXTRA_CHECKS=0
+
+INCLUDES=	.					\
+		$(SPICE_PROTOCOL)			\
+		$(SPICE_COMMON)
+
+LIBRARIES=	$(SPICE_COMMON)spice-common-server.dll
+
+PREFIX_HDR=	$(PREFIX)include/spice-server/
+HEADERS=	spice-audio.h				\
+		spice-char.h				\
+		spice-core.h				\
+		spice-experimental.h			\
+		spice-input.h				\
+		spice-migration.h			\
+		spice-qxl.h				\
+		spice-server.h				\
+		spice-version.h				\
+		spice-replay.h				\
+		spice.h
+
+TO_CLEAN=	$(GENERATED)
+
+include $(MIQ)rules.mk
+$(MIQ)rules.mk:
+	cd $(TOP) && make $(TARGET)
+
+.prebuild: $(GENERATED)
+
+spice-server-enums.c: spice-server.h spice-server-enums.c.tmpl
+	$(PRINT_GENERATE) glib-mkenums --template spice-server-enums.c.tmpl $< > $@
+
+spice-server-enums.h: spice-server.h spice-server-enums.h.tmpl
+	$(PRINT_GENERATE) glib-mkenums --template spice-server-enums.h.tmpl $< > $@
+
+spice-version.h: spice-version.h.in
+	$(PRINT_GENERATE) $(GEN_$@)
+GEN_spice-version.h=							\
+	sed < $< > $@ 							\
+	-e 's|@SPICE_SERVER_VERSION@|$(SPICE_SERVER_VERSION)|g'
+
+$(GENERATED): $(MIQ_MAKEDEPS)
diff --git a/server/config/check_lz4_compress_fast_continue.c b/server/config/check_lz4_compress_fast_continue.c
new file mode 100644
index 00000000..91937729
--- /dev/null
+++ b/server/config/check_lz4_compress_fast_continue.c
@@ -0,1 +1,16 @@
+#include <lz4.h>
+
+int main()
+{
+    if (0) {
+        LZ4_stream_t *stream = NULL;
+        const char *in_buf = NULL;
+        char *compressed_buf = NULL;
+        int in_size = 0;
+        int bound_size = 0;
+        LZ4_compress_fast_continue(stream,
+                                   in_buf, compressed_buf,
+                                   in_size, bound_size, 1);
+    }
+    return 0;
+}
--
2.13.5 (Apple Git-94)


More information about the Spice-devel mailing list