[pacman-dev] [PATCH] build: link vercmp staticly with libalpm

Dave Reisner dreisner at archlinux.org
Mon Feb 11 13:12:51 UTC 2019


This makes the meson-built vercmp equivalent to the autotools build.

Employ an intermediate archive of libalpm which our generic library rule
can slurp in. Other alpm-only binaries (specifically we care about
vercmp) can then link this in for alpm functionality without caring
exactly where the function is defined. meson passes the right flags to
ensure that unused data is stripped out of the executable.

ref: FS#61719
---
 meson.build | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 0a710653..5c1efd73 100644
--- a/meson.build
+++ b/meson.build
@@ -354,12 +354,21 @@ libcommon = static_library(
   include_directories : includes,
   install : false)
 
+libalpm_a = static_library(
+  'alpm_a',
+  libalpm_sources,
+  version : libalpm_version,
+  include_directories : includes,
+  dependencies : [crypto_provider, libarchive, libcurl] + gpgme_libs,
+  link_with : [libcommon],
+  install : true)
+
 libalpm = library(
   'alpm',
-  libalpm_sources,
   version : libalpm_version,
   include_directories : includes,
   dependencies : [crypto_provider, libarchive, libcurl] + gpgme_libs,
+  link_whole : [libalpm_a],
   link_with : [libcommon],
   install : true)
 
@@ -413,7 +422,7 @@ executable(
   'vercmp',
   vercmp_sources,
   include_directories : includes,
-  link_with : [libalpm],
+  link_with : [libalpm_a],
   install : true,
 )
 
-- 
2.20.1


More information about the pacman-dev mailing list