Browse Source

spice: convert to meson

Faster compilation.

Removed autotools patches.

Backported meson patch to fix compilation and pkgconfig file.

Before:

time make package/spice/compile -j 12
Executed in   62.85 secs   fish           external
   usr time   56.45 secs  276.00 micros   56.45 secs
   sys time    8.06 secs   46.00 micros    8.06 secs

Before + PKG_BUILD_PARALLEL:

Executed in   45.40 secs   fish           external
   usr time   63.08 secs  253.00 micros   63.08 secs
   sys time    8.57 secs   44.00 micros    8.57 secs

After:

time make package/spice/compile -j 12
Executed in   16.54 secs   fish           external
   usr time   41.29 secs  266.00 micros   41.29 secs
   sys time    4.76 secs   45.00 micros    4.76 secs

Signed-off-by: Rosen Penev <rosenp@gmail.com>
lilik-openwrt-22.03
Rosen Penev 4 years ago
parent
commit
dcc79a8d2f
No known key found for this signature in database GPG Key ID: 36D31CFA845F0E3B
8 changed files with 295 additions and 64 deletions
  1. +28
    -14
      libs/spice/Makefile
  2. +0
    -26
      libs/spice/patches/0001-build-skip-tests.patch
  3. +0
    -24
      libs/spice/patches/0002-build-tools-fix-build-failure.patch
  4. +28
    -0
      libs/spice/patches/010-librt-libm.patch
  5. +155
    -0
      libs/spice/patches/020-no-code-generation.patch
  6. +36
    -0
      libs/spice/patches/030-include-generated-code.patch
  7. +19
    -0
      libs/spice/patches/040-only-server.patch
  8. +29
    -0
      libs/spice/patches/050-no-mkenums.patch

+ 28
- 14
libs/spice/Makefile View File

@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=spice
PKG_VERSION:=0.14.3
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=https://www.spice-space.org/download/releases/spice-server
PKG_HASH:=551d4be4a07667cf0543f3c895beb6da8a93ef5a9829f2ae47817be5e616a114
@ -18,11 +18,11 @@ PKG_LICENSE_FILES:=COPYING
PKG_INSTALL:=1
PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
PKG_FIXUP:=autoreconf
PKG_BUILD_DEPENDS+=spice-protocol
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
include ../../devel/meson/meson.mk
define Package/libspice-server
SECTION:=libs
@ -45,17 +45,31 @@ define Build/InstallDev
endef
# audio codec
CONFIGURE_ARGS += \
--disable-opus \
--disable-celt051 \
CONFIGURE_ARGS += \
--disable-lz4 \
--disable-manual \
--disable-gstreamer \
--disable-smartcard \
--disable-statistics \
--without-sasl \
--disable-silent-rules \
MESON_ARGS += \
-Dcelt051=disabled \
-Dopus=disabled \
MESON_ARGS += \
-Dgstreamer=no \
-Dlz4=false \
-Dsasl=false \
-Dsmartcard=disabled \
-Dalignment-checks=false \
-Dextra-checks=false \
-Dstatistics=false \
-Dmanual=false \
-Dinstrumentation=no \
MESON_ARGS += \
-Dspice-common:alignment-checks=false \
-Dspice-common:extra-checks=false \
-Dspice-common:celt051=disabled \
-Dspice-common:opus=disabled \
-Dspice-common:instrumentation=no \
-Dspice-common:smartcard=disabled \
-Dspice-common:python-checks=false \
-Dspice-common:manual=false \
-Dspice-common:generate-code=none \
-Dspice-common:tests=false \
$(eval $(call BuildPackage,libspice-server))

+ 0
- 26
libs/spice/patches/0001-build-skip-tests.patch View File

@ -1,26 +0,0 @@
From 9380ff5a8849ea5a772958b5dcfc5462182f1597 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 20 Mar 2020 17:06:31 +0800
Subject: [PATCH] build: skip tests
Tests build can fail for arc700 for the following causes
- Missing -stack-protector-all argument when building test progs
- Missing linker flag -lgmodule-2.0 -lffi
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
server/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/Makefile.am b/server/Makefile.am
index 2d148c14..5b927a1b 100644
--- a/server/Makefile.am
+++ b/server/Makefile.am
@@ -1,5 +1,5 @@
NULL =
-SUBDIRS = . tests
+SUBDIRS = .
check-valgrind:
$(MAKE) -C tests check-valgrind

+ 0
- 24
libs/spice/patches/0002-build-tools-fix-build-failure.patch View File

@ -1,24 +0,0 @@
From d37fe6af97a45f0567c47932fd5c66d451fcb128 Mon Sep 17 00:00:00 2001
From: Yousong Zhou <yszhou4tech@gmail.com>
Date: Fri, 20 Mar 2020 17:07:03 +0800
Subject: [PATCH] build: tools: fix build failure
Tools build can fail because -stack-protector-all is missing
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
tools/Makefile.am | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 702fcdd1..7dc70c4e 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -8,6 +8,7 @@ AM_CPPFLAGS = \
AM_LDFLAGS = \
$(LIBRT) \
+ $(WARN_LDFLAGS) \
$(NULL)
if !OS_WIN32

+ 28
- 0
libs/spice/patches/010-librt-libm.patch View File

@ -0,0 +1,28 @@
From 26bbb85c150f882c05399e4c574208b8b1242082 Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Tue, 7 Apr 2020 19:32:15 +0100
Subject: [PATCH] build: Fix librt and libm dependencies in Meson
They need to be requested without the lib prefix, otherwise a
generated pkg-config file ends up with absolute paths instead of -l
flags.
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
---
meson.build | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/meson.build b/meson.build
index 1685c077..f9090a82 100644
--- a/meson.build
+++ b/meson.build
@@ -102,7 +102,7 @@ foreach dep : ['libjpeg', 'zlib']
endforeach
if host_machine.system() != 'windows'
- foreach dep : ['librt', 'libm']
+ foreach dep : ['rt', 'm']
spice_server_deps += compiler.find_library(dep)
endforeach
else

+ 155
- 0
libs/spice/patches/020-no-code-generation.patch View File

@ -0,0 +1,155 @@
From 713a3e09fbd5948823ac0c396249537329b878e4 Mon Sep 17 00:00:00 2001
From: Frediano Ziglio <fziglio@redhat.com>
Date: Thu, 12 Mar 2020 03:45:54 +0000
Subject: [PATCH] build: Allow to build disabling code generation
Reduce dependencies if used by agents which do not need
marshallers/demarshallers code.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
common/meson.build | 28 +++++++++++++++-------------
meson.build | 24 +++++++++++++-----------
meson_options.txt | 2 +-
tests/meson.build | 34 ++++++++++++++++++----------------
4 files changed, 47 insertions(+), 41 deletions(-)
diff --git a/common/meson.build b/common/meson.build
index 7356cc0..14bf242 100644
--- a/subprojects/spice-common/common/meson.build
+++ b/subprojects/spice-common/common/meson.build
@@ -67,19 +67,21 @@ spice_common_dep = declare_dependency(link_with : spice_common_lib,
# client_demarshallers
-codegen_cmd = [python, spice_codegen]
-codegen_args = ['--generate-demarshallers',
- '--client',
- '--include', 'common/messages.h',
- '--generated-declaration-file', '@OUTPUT1@',
- '@INPUT@', '@OUTPUT0@']
-
-client_demarshallers = custom_target('client_demarshallers',
- input : [spice_proto],
- output : ['generated_client_demarshallers.c', 'generated_messages.h'],
- install : false,
- command : [codegen_cmd, codegen_args],
- depend_files : [spice_codegen_files, 'messages.h'])
+if spice_common_generate_client_code or spice_common_generate_server_code
+ codegen_cmd = [python, spice_codegen]
+ codegen_args = ['--generate-demarshallers',
+ '--client',
+ '--include', 'common/messages.h',
+ '--generated-declaration-file', '@OUTPUT1@',
+ '@INPUT@', '@OUTPUT0@']
+
+ client_demarshallers = custom_target('client_demarshallers',
+ input : [spice_proto],
+ output : ['generated_client_demarshallers.c', 'generated_messages.h'],
+ install : false,
+ command : [codegen_cmd, codegen_args],
+ depend_files : [spice_codegen_files, 'messages.h'])
+endif
#
# libspice-common-client
diff --git a/meson.build b/meson.build
index 41a9419..b60a9fe 100644
--- a/subprojects/spice-common/meson.build
+++ b/subprojects/spice-common/meson.build
@@ -119,17 +119,19 @@ foreach dep, version : optional_deps
endforeach
# Python
-py_module = import('python')
-python = py_module.find_installation()
-
-if get_option('python-checks')
- foreach module : ['six', 'pyparsing']
- message('Checking for python module @0@'.format(module))
- cmd = run_command(python, '-m', module)
- if cmd.returncode() != 0
- error('Python module @0@ not found'.format(module))
- endif
- endforeach
+if spice_common_generate_client_code or spice_common_generate_server_code
+ py_module = import('python')
+ python = py_module.find_installation()
+
+ if get_option('python-checks')
+ foreach module : ['six', 'pyparsing']
+ message('Checking for python module @0@'.format(module))
+ cmd = run_command(python, '-m', module)
+ if cmd.returncode() != 0
+ error('Python module @0@ not found'.format(module))
+ endif
+ endforeach
+ endif
endif
# smartcard check
diff --git a/meson_options.txt b/meson_options.txt
index d30858f..d93d74b 100644
--- a/subprojects/spice-common/meson_options.txt
+++ b/subprojects/spice-common/meson_options.txt
@@ -39,7 +39,7 @@ option('manual',
option('generate-code',
type : 'combo',
- choices : ['all', 'server', 'client'],
+ choices : ['all', 'server', 'client', 'none'],
description : 'Which code should be built')
option('tests',
diff --git a/tests/meson.build b/tests/meson.build
index d315056..1ad5bc5 100644
--- a/subprojects/spice-common/tests/meson.build
+++ b/subprojects/spice-common/tests/meson.build
@@ -20,26 +20,28 @@ endforeach
#
# test_marshallers
#
-test_proto = files('test-marshallers.proto')
+if spice_common_generate_client_code or spice_common_generate_server_code
+ test_proto = files('test-marshallers.proto')
-test_marshallers_sources = ['test-marshallers.c', 'test-marshallers.h']
+ test_marshallers_sources = ['test-marshallers.c', 'test-marshallers.h']
-targets = [
- ['test_marshallers', test_proto, 'generated_test_marshallers.c', ['--generate-marshallers', '--server', '--include', 'test-marshallers.h', '@INPUT@', '@OUTPUT@']],
- ['test_marshallers_h', test_proto, 'generated_test_marshallers.h', ['--generate-marshallers', '--server', '--include', 'test-marshallers.h', '-H', '@INPUT@', '@OUTPUT@']],
- ['test_demarshallers', test_proto, 'generated_test_demarshallers.c', ['--generate-demarshallers', '--client', '--include', 'test-marshallers.h', '@INPUT@', '@OUTPUT@']],
- ['test_enums_h', test_proto, 'generated_test_enums.h', ['-e', '@INPUT@', '@OUTPUT@']],
-]
+ targets = [
+ ['test_marshallers', test_proto, 'generated_test_marshallers.c', ['--generate-marshallers', '--server', '--include', 'test-marshallers.h', '@INPUT@', '@OUTPUT@']],
+ ['test_marshallers_h', test_proto, 'generated_test_marshallers.h', ['--generate-marshallers', '--server', '--include', 'test-marshallers.h', '-H', '@INPUT@', '@OUTPUT@']],
+ ['test_demarshallers', test_proto, 'generated_test_demarshallers.c', ['--generate-demarshallers', '--client', '--include', 'test-marshallers.h', '@INPUT@', '@OUTPUT@']],
+ ['test_enums_h', test_proto, 'generated_test_enums.h', ['-e', '@INPUT@', '@OUTPUT@']],
+ ]
-foreach t : targets
- cmd = [python, spice_codegen] + t[3]
- test_marshallers_sources += custom_target(t[0], input: t[1], output : t[2], command: cmd, depend_files : spice_codegen_files)
-endforeach
+ foreach t : targets
+ cmd = [python, spice_codegen] + t[3]
+ test_marshallers_sources += custom_target(t[0], input: t[1], output : t[2], command: cmd, depend_files : spice_codegen_files)
+ endforeach
-test('test_marshallers',
- executable('test_marshallers', test_marshallers_sources,
- dependencies : spice_common_dep,
- install : false))
+ test('test_marshallers',
+ executable('test_marshallers', test_marshallers_sources,
+ dependencies : spice_common_dep,
+ install : false))
+endif
#
# test_quic
--
GitLab

+ 36
- 0
libs/spice/patches/030-include-generated-code.patch View File

@ -0,0 +1,36 @@
From 0ce9cecd0912f78b75600f3f428bdd943bf9622b Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Fri, 9 Oct 2020 04:19:01 -0700
Subject: [PATCH] don't regenerate [de]marshallers
The release tarballs already include these files.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
subprojects/spice-common/common/meson.build | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/subprojects/spice-common/common/meson.build b/subprojects/spice-common/common/meson.build
index 7356cc0..5796989 100644
--- a/subprojects/spice-common/common/meson.build
+++ b/subprojects/spice-common/common/meson.build
@@ -180,6 +180,19 @@ if spice_common_generate_server_code
endif
endforeach
+ spice_common_server_lib = static_library('spice-common-server', spice_common_server_sources,
+ install : false,
+ dependencies : spice_common_dep)
+
+ spice_common_server_dep = declare_dependency(sources : spice_common_server_dep_sources,
+ link_with : spice_common_server_lib,
+ dependencies : spice_common_dep)
+else
+ spice_common_server_sources = ['generated_server_marshallers.c', 'generated_server_marshallers.h']
+ spice_common_server_sources += ['generated_server_demarshallers.c']
+ spice_common_server_dep_sources = ['generated_server_marshallers.c', 'generated_server_marshallers.h']
+ spice_common_server_dep_sources += ['generated_server_demarshallers.c']
+
spice_common_server_lib = static_library('spice-common-server', spice_common_server_sources,
install : false,
dependencies : spice_common_dep)

+ 19
- 0
libs/spice/patches/040-only-server.patch View File

@ -0,0 +1,19 @@
--- a/meson.build
+++ b/meson.build
@@ -192,8 +192,6 @@ add_project_arguments(compiler.get_supported_arguments(spice_server_global_cflag
# Subdirectories
#
subdir('server')
-subdir('tools')
-subdir('docs')
#
# write config.h
--- a/server/meson.build
+++ b/server/meson.build
@@ -186,5 +186,3 @@ spice_server_libs = both_libraries('spice-server', spice_server_sources,
spice_server_shared_lib = spice_server_libs.get_shared_lib()
spice_server_static_lib = spice_server_libs.get_static_lib()
-
-subdir('tests')

+ 29
- 0
libs/spice/patches/050-no-mkenums.patch View File

@ -0,0 +1,29 @@
From 60f49745eb80eb84ff293cfadf8092b66b6a088c Mon Sep 17 00:00:00 2001
From: Rosen Penev <rosenp@gmail.com>
Date: Fri, 9 Oct 2020 04:22:31 -0700
Subject: [PATCH] don't regenerate enums files
The release tarballs already include these files.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
server/meson.build | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/server/meson.build b/server/meson.build
index b2eb410..b79b8d9 100644
--- a/server/meson.build
+++ b/server/meson.build
@@ -36,11 +36,7 @@ spice_server_headers = [
install_headers(spice_server_headers, subdir : 'spice-server')
-# generate enums
-gnome = import('gnome')
-spice_server_enums = gnome.mkenums_simple('spice-server-enums',
- sources : 'spice-server.h',
- symbol_prefix : 'SPICE')
+spice_server_enums = ['spice-server-enums.c', 'spice-server-enums.h']
spice_server_sources = [
spice_server_headers,

Loading…
Cancel
Save