aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2018-05-10 00:39:36 +0200
committerGitHub <noreply@github.com>2018-05-10 00:39:36 +0200
commitf5ce2e764fdab02e3d28eb653253686cffd71920 (patch)
treec0d1bdc2d22400c1306ba8963d1f78093af783e0 /meson.build
parentMerge pull request #8939 from yuwata/fix-comment (diff)
parentmeson: recompile all sources for install_libudev_static and install_libsystem... (diff)
downloadsystemd-f5ce2e764fdab02e3d28eb653253686cffd71920.tar.gz
systemd-f5ce2e764fdab02e3d28eb653253686cffd71920.tar.bz2
systemd-f5ce2e764fdab02e3d28eb653253686cffd71920.zip
Merge pull request #8689 from davide125/static
meson: add support for building static libsystemd and libudev
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build62
1 files changed, 56 insertions, 6 deletions
diff --git a/meson.build b/meson.build
index eca424b78..dbe841ba1 100644
--- a/meson.build
+++ b/meson.build
@@ -1323,6 +1323,31 @@ libsystemd = shared_library(
install : true,
install_dir : rootlibdir)
+static_libsystemd = get_option('static-libsystemd')
+static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic'
+
+install_libsystemd_static = static_library(
+ 'systemd',
+ libsystemd_sources,
+ journal_client_sources,
+ basic_sources,
+ basic_gcrypt_sources,
+ include_directories : includes,
+ build_by_default : static_libsystemd != 'false',
+ install : static_libsystemd != 'false',
+ install_dir : rootlibdir,
+ pic : static_libsystemd == 'true' or static_libsystemd == 'pic',
+ dependencies : [threads,
+ librt,
+ libxz,
+ liblz4,
+ libcap,
+ libblkid,
+ libmount,
+ libselinux,
+ libgcrypt],
+ c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC']))
+
############################################################
# binaries that have --help and are intended for use by humans,
@@ -2522,17 +2547,30 @@ foreach tuple : tests
endif
endforeach
-test_libsystemd_sym = executable(
+exe = executable(
'test-libsystemd-sym',
test_libsystemd_sym_c,
include_directories : includes,
link_with : [libsystemd],
install : install_tests,
install_dir : testsdir)
-test('test-libsystemd-sym',
- test_libsystemd_sym)
+test('test-libsystemd-sym', exe)
+
+exe = executable(
+ 'test-libsystemd-static-sym',
+ test_libsystemd_sym_c,
+ include_directories : includes,
+ link_with : [install_libsystemd_static],
+ dependencies : [threads], # threads is already included in dependencies on the library,
+ # but does not seem to get propagated. Add here as a work-around.
+ build_by_default : static_libsystemd_pic,
+ install : install_tests and static_libsystemd_pic,
+ install_dir : testsdir)
+if static_libsystemd_pic
+ test('test-libsystemd-static-sym', exe)
+endif
-test_libudev_sym = executable(
+exe = executable(
'test-libudev-sym',
test_libudev_sym_c,
include_directories : includes,
@@ -2540,8 +2578,20 @@ test_libudev_sym = executable(
link_with : [libudev],
install : install_tests,
install_dir : testsdir)
-test('test-libudev-sym',
- test_libudev_sym)
+test('test-libudev-sym', exe)
+
+exe = executable(
+ 'test-libudev-static-sym',
+ test_libudev_sym_c,
+ include_directories : includes,
+ c_args : ['-Wno-deprecated-declarations'],
+ link_with : [install_libudev_static],
+ build_by_default : static_libudev_pic,
+ install : install_tests and static_libudev_pic,
+ install_dir : testsdir)
+if static_libudev_pic
+ test('test-libudev-static-sym', exe)
+endif
############################################################