meson: fix libcommon being publicly exposed as a static link dependency

libcommon isn't even installed, so that means libalpm.a (if installed)
is fatally broken as it misses objects. The problem is that meson
doesn't handle this case correctly:

https://github.com/mesonbuild/meson/issues/3934
https://github.com/mesonbuild/meson/issues/3937
https://github.com/mesonbuild/meson/pull/3939

Work around this by manually extracting libcommon's .o files into the
list of objects used to create libalpm.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Eli Schwartz 2019-09-18 23:44:57 -04:00 committed by Allan McRae
parent de6249ce22
commit c0da1ba13a

View file

@ -317,9 +317,10 @@ libcommon = static_library(
libalpm_a = static_library( libalpm_a = static_library(
'alpm', 'alpm',
libalpm_sources, libalpm_sources,
# https://github.com/mesonbuild/meson/issues/3937
objects : libcommon.extract_all_objects(),
include_directories : includes, include_directories : includes,
dependencies : [crypto_provider, libarchive, libcurl, gpgme], dependencies : [crypto_provider, libarchive, libcurl, gpgme],
link_with : [libcommon],
install : true) install : true)
if get_option('default_library') != 'static' if get_option('default_library') != 'static'
@ -336,7 +337,6 @@ install_headers(
'lib/libalpm/alpm.h', 'lib/libalpm/alpm.h',
'lib/libalpm/alpm_list.h') 'lib/libalpm/alpm_list.h')
# TODO: libs.private seem quite wrong here
pkgconfig = import('pkgconfig') pkgconfig = import('pkgconfig')
pkgconfig.generate( pkgconfig.generate(
libalpm, libalpm,