feat(3p/nix): meson: Don't look for libraries in lib dir

1. First of all, this doesn't work in nixpkgs. Per [1], gcc ignores `-L`
   for purposes of `--print-file-dirs`, which breaks horribly on linux. But
   if we don't pass extra dirs, meosn first just tries `-l...`, which does
   work.

2. Even if it did work, `libdir` means where we are installing libs, not
   where libs are expected to be found. Those are not necessarily the
   same (again, nixpkgs), and even when they are and non-standard, it is
   better to use DESTDIR or have a modified toolchain.

[1]: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87758

(cherry picked from commit a142164e746644e20f66908c156ca913bef4664f)
This commit is contained in:
John Ericson 2019-10-25 10:39:33 -04:00 committed by Vincent Ambo
parent d64f60c733
commit 4b50bd28a0

View file

@ -348,8 +348,8 @@ tar = find_program('tar', required : true)
bzip2 = find_program('bzip2', required : true)
gzip = find_program('gzip', required : true)
xz = find_program('xz', required : true)
dot = find_program('dot', required : true)
lsof = find_program('lsof', required : true)
dot = find_program('dot', required : false)
lsof = find_program('lsof', required : false)
tr = find_program('tr', required : true)
coreutils = run_command('dirname', cat.path()).stdout().strip()
@ -379,9 +379,9 @@ description : 'Whether link() works on symlinks')
#--------------------------------------------------
boost_dep = declare_dependency(
dependencies : [
cpp.find_library('libboost_system', dirs : libdir),
cpp.find_library('libboost_context', dirs : libdir),
cpp.find_library('libboost_thread', dirs : libdir)],
cpp.find_library('boost_system'),
cpp.find_library('boost_context'),
cpp.find_library('boost_thread')],
link_args : get_option('boost_link_args'))
if (boost_dep.found())
@ -408,7 +408,7 @@ libbrotli_dep = declare_dependency(
# Look for OpenSSL, a required dependency.
#--------------------------------------------------
openssl_dep = declare_dependency(
dependencies: cpp.find_library('libssl', dirs : libdir),
dependencies: cpp.find_library('ssl'),
link_args : get_option('openssl_link_args'))
@ -436,14 +436,14 @@ pthread_dep = declare_dependency(
# Look for libdl, a required dependency.
#--------------------------------------------------
libdl_dep = declare_dependency(
dependencies : cpp.find_library('dl', dirs : libdir),
dependencies : cpp.find_library('dl'),
link_args : get_option('dl_link_args'))
# Look for libbz2, a required dependency.
#--------------------------------------------------
libbz2_dep = declare_dependency(
dependencies : cpp.find_library('bz2', dirs : libdir),
dependencies : cpp.find_library('bz2'),
link_args : get_option('bz2_link_args'))
@ -455,7 +455,7 @@ libbz2_dep = declare_dependency(
# editline.h when the pkg-config approach fails.
editline_dep = declare_dependency(
dependencies : cpp.find_library('libeditline'),
dependencies : cpp.find_library('editline'),
link_args : get_option('editline_link_args'))
if not (
@ -478,7 +478,7 @@ endif
#--------------------------------------------------
if (get_option('with_libsodium'))
libsodium_dep = declare_dependency(
dependencies : cpp.find_library('libsodium', dirs : libdir),
dependencies : cpp.find_library('sodium'),
link_args : get_option('sodium_link_args'))
config_h.set('HAVE_SODIUM', 1, description : 'Whether to use libsodium for cryptography.')
else