build: add libintl dependency to meson and the .pc file

In order to use gettext on systems where it is not part of libc, the
correct linker flags are needed in libalpm.pc (for static compilation).
This has never been the case.

The new meson build system currently only checks for ngettext in libc,
but does not fall back to searching for the existence of -lintl; add it
to the libalpm dependencies.

Signed-off-by: Eli Schwartz <eschwartz@archlinux.org>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Eli Schwartz 2020-05-18 15:18:12 -04:00 committed by Allan McRae
parent e348ba3881
commit 3bd88821bb
2 changed files with 7 additions and 3 deletions

View file

@ -10,4 +10,4 @@ Version: @LIB_VERSION@
Requires.private: libarchive @pc_crypto@ @pc_libcurl@ @pc_gpgme@ Requires.private: libarchive @pc_crypto@ @pc_libcurl@ @pc_gpgme@
Cflags: -I${includedir} @LFS_CFLAGS@ Cflags: -I${includedir} @LFS_CFLAGS@
Libs: -L${libdir} -lalpm Libs: -L${libdir} -lalpm
Libs.private: @LIBS@ @pc_gpgme_libs@ Libs.private: @LIBS@ @pc_gpgme_libs@ @LIBINTL@

View file

@ -77,9 +77,13 @@ conf.set_quoted('CACHEDIR', join_paths(LOCALSTATEDIR, 'cache/pacman/pkg/'))
conf.set_quoted('HOOKDIR', join_paths(SYSCONFDIR, 'pacman.d/hooks/')) conf.set_quoted('HOOKDIR', join_paths(SYSCONFDIR, 'pacman.d/hooks/'))
conf.set_quoted('ROOTDIR', ROOTDIR) conf.set_quoted('ROOTDIR', ROOTDIR)
libintl = dependency('', required: false)
if get_option('i18n') if get_option('i18n')
if not cc.has_function('ngettext') if not cc.has_function('ngettext')
error('ngettext not found but NLS support requested') libintl = cc.find_library('intl', required : false, static: get_option('buildstatic'))
if not libintl.found()
error('ngettext not found but NLS support requested')
endif
endif endif
conf.set('ENABLE_NLS', 1) conf.set('ENABLE_NLS', 1)
endif endif
@ -301,7 +305,7 @@ libcommon = static_library(
include_directories : includes, include_directories : includes,
install : false) install : false)
alpm_deps = [crypto_provider, libarchive, libcurl, gpgme] alpm_deps = [crypto_provider, libarchive, libcurl, libintl, gpgme]
libalpm_a = static_library( libalpm_a = static_library(
'alpm_objlib', 'alpm_objlib',