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

Christophe de Dinechin christophe.de.dinechin at gmail.com
Fri Sep 28 16:23:48 UTC 2018



> On 28 Sep 2018, at 16:46, Marc-André Lureau <marcandre.lureau at gmail.com> wrote:
> 
> Hi
> 
> On Fri, Sep 28, 2018 at 6:14 PM Christophe de Dinechin
> <christophe.de.dinechin at gmail.com> wrote:
>> 
>> Just curious, how does Meson address / plan to address the top-level build issue?
> 
> What do you mean? Building form the source tree? This is a design
> choice from meson to not allow building from source tree.

No, I mean the fact that if changes in spice-common or spice-protocol have no kind of automatic dependency tracking whatsoever. So if you churn a lot on these files (which I did notably for smart streaming), the current build system is a pain, whether Meson or automake.

With the proposed build system, you go to the top level, type make, no need to make install this or submodule update that. Dependencies are tracked at the file level, and spice-common is built only once for both server and client. Also, you can mostly test in place, no need to install anything. Overall a giant time saver, and a serious drop in manual mistakes I made.

> 
>> Thanks
>> Christophe
>> 
>>> On 28 Sep 2018, at 13:15, Marc-André Lureau <marcandre.lureau at gmail.com> wrote:
>>> 
>>> Hi
>>> 
>>> On Fri, Sep 28, 2018 at 2:19 PM Christophe Fergeau <cfergeau at redhat.com> wrote:
>>>> 
>>>> Hey,
>>>> 
>>>> We just added meson support to spice/spice-gtk, I'd rather we don't add
>>>> a 3rd way to build spice, 2 is already error-prone enough :)

I raised the top-level build issue back in Brno in Oct 2017 or so. AFAICT, this is what prompted the investigation into Meson. I  had something working back in Nov 2017 (https://github.com/c3d/spice/commit/1c13fb21a51d5d2c1a5a477dd4fd6d9c2219ad02), so maybe one month after the meeting.

So I’m happy we tried Meson. Why not. It’s just that it does not solve my problem at all, requires learning a whole new way of doing things, requires extra tools, and last time I checked, it was not even faster than my make-only approach. (which is really standard make + about as many lines in reusable makefile includes as we have m4 code in spice-gtk).


>>>> 
>>> 
>>> I agree, I would rather focus on making meson the only build-sys, by
>>> fixing the remaining issues (dist'ing for ex).



>>> 
>>>> Christophe
>>>> 
>>>> 
>>>> On Thu, Sep 27, 2018 at 05:33:37PM +0200, Christophe de Dinechin wrote:
>>>>> 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)
>>>>> _______________________________________________
>>>>> Spice-devel mailing list
>>>>> Spice-devel at lists.freedesktop.org
>>>>> https://lists.freedesktop.org/mailman/listinfo/spice-devel
>>>> _______________________________________________
>>>> Spice-devel mailing list
>>>> Spice-devel at lists.freedesktop.org
>>>> https://lists.freedesktop.org/mailman/listinfo/spice-devel
>>> 
>>> 
>>> 
>>> --
>>> Marc-André Lureau
>> 
> 
> 
> -- 
> Marc-André Lureau



More information about the Spice-devel mailing list