From 477a66cd0e7a1b8f5fb7d3b79d977da2771ee09a Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 11 Feb 2019 11:19:26 -0500 Subject: build: link vercmp with a static copy of libalpm This has historically been the case in autotools since we want vercmp to not break mid-transaction in an install script. For convenience, we create libalpm.a and use this to optionally generate libalpm.so (when not configured with -Dbuildstatic=true) as well as to link any binary which explicitly wishes to be built statically "with libalpm", but does not care where a function is defined. meson then treats this correctly: it builds the object file only once for both libraries, and the compiler strips out unused functionality from the final static binary. Currently the only binary which requires this is vercmp. Fixes FS#61719 Signed-off-by: Eli Schwartz Signed-off-by: Allan McRae --- meson.build | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/meson.build b/meson.build index 02a3a3d3..8e9dbd71 100644 --- a/meson.build +++ b/meson.build @@ -355,15 +355,24 @@ libcommon = static_library( include_directories : includes, install : false) -libalpm = library( +libalpm_a = static_library( 'alpm', libalpm_sources, - version : libalpm_version, include_directories : includes, dependencies : [crypto_provider, libarchive, libcurl] + gpgme_libs, link_with : [libcommon], install : true) +if not get_option('buildstatic') + libalpm = shared_library( + 'alpm', + version : libalpm_version, + link_whole: [libalpm_a], + install : true) +else + libalpm = libalpm_a +endif + install_headers( 'lib/libalpm/alpm.h', 'lib/libalpm/alpm_list.h') @@ -414,7 +423,7 @@ executable( 'vercmp', vercmp_sources, include_directories : includes, - link_with : [libalpm], + link_with : [libalpm_a], install : true, ) -- cgit v1.2.3-54-g00ecf