Some dependencies can be detected multiple ways, such as a config tool
and pkg-config. For pkg-config a new PkgConfigDependency is created and
used to check for the dependency, config tool dependencies are handled
ad-hoc. This allows the ConfigToolDependency to be used in the same way
that PkgConfigDependency is.
This class is meant abstract away some of the tedium of writing a config
tool wrapper dependency, and allow these instances to share some basic
code that they all need.
This basically boils down to using map() and expecting a list, but map
returns an iterator. The better solution is to use a list comprehension
anyway, so do that.
Just detect lrelease as done with other Qt tools.
Uses -version instead of -v to probe version since lrelease don't
support it.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
BOOST_LIBS could become outdated in future versions, which would result
in dependency('boost', modules : [ 'foo' ], required : false) to fail,
although required was set to false. Therefore turn the exception into
log_fail(). If required was set to true, this will still be caught since
is_found remains False.
This also improves logging by printing all invalid module names instead
of only the first one.
f.ex when you don't have the llvm-static package installed, the error
message when generating libs is cryptic and uninformative since we
discard stderr.
Sometimes pkg-config can decide that the libdir is a system library dir
and must not be included in the output because that would mess up the
library search order for pkg-config libraries that must be sourced from
a non-system prefix.
However, when we're doing manual searching, we always want to see the
library directory even if it's the system path, otherwise we can't do
manual searching at all.
Escaping spaces with '\ ' is the only way that works with both
pkg-config and pkgconf, so quote that way and unquote inside Meson.
This should work on all platforms.
Also fix the unit test to do the same.
https://github.com/pkgconf/pkgconf/issues/153
When `static: true` is passed to dependency(), we parse the pkg-config
output and manually search for `-lfoo`, etc in the library paths
gathered from `-Lbar` arguments in the output.
If there are no `-L` arguments in the output, the behaviour is the
same as before. If there are `-L` arguments and we can't find a static
library, we will error out.
We can now specify the library type we want to search for, and whether
we want to prefer static libraries over shared ones or the other way
around. This functionality is not exposed to build files yet.
LLVM >= 3.9 provides an llvm-config that has a sane mechanism for
selecting static vs dynamic linking. LLVM < 3.9 (but >= 3.5) not so
much. For those older LLVM versions, llvm-config will always provide
arguments for statically linking LLVM, even if there is a library for
dynamic linking.
Fixes#2442
PkgConfig automatically removes -L paths from libdirs if the -L points
to a system path. It knows what these paths are by taking this as a
configure option at build time, which the distro maintainers set
appropriately and everything works. This allows one to have two
versions of a package installed, a system and non system, and then
override PKG_CONFIG_PATH to use the non system version, and everything
just works. For non-pkgconfig dependencies (such as LLVM) meson needs to
strip these themselves to avoid breaking the above use case.
The new implementation will correctly pick boost from 3 possible
locations on windows and two locations on posix compatible OSs.
The new search algorithm also differentiates between debug and
release builds of Boost and multi or single threading builds.
It was also decided to map "Meson modules" to Boost software libraries
and not Boost modules since it there are a lot of options regarding
linking. Some modules can even be used either as headers-only or with
dynamic linking.
This commit also fixes a bug that prevented header-only use on Windows.
Fixes: #2274#2239#1803#669
This allows the logic in a meson.build file to be simplified (ie, some
dependencies can add the same module requirements) but meson will only
check for them once. Since set is inherently unordered, use sorted to
make the output deterministic.