aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies
AgeCommit message (Collapse)AuthorFilesLines
2022-03-03add D features to InternalDependencyRemi Thebault1-2/+9
2022-03-02Rename JDK system dep to JNITristan Partin2-4/+20
JNI is a more apt name because it currently only supports the JNI. I also believe that CMake uses the terminology JNI here as well. JNI is currently the only way to interact with the JVM through native code, but there is a project called "Project Panama" which aims to be another way for native code to interact with the JVM.
2022-03-01cheat and evade the detection of "open()" in custom_lintEli Schwartz1-6/+6
It's a dumb check which doesn't know the difference between python functions and string data. Work around this by changing the message output to not include an opening parenthesis, and changing other similar strings the same way for consistency.
2022-03-01mark a bunch of dependencies with the version they were introducedEli Schwartz2-0/+7
All these dependencies are impossible to find on versions of Meson older than the ones they got custom lookups in, because they don't provide pkg-config files. So they should not / cannot be reasonably used on older versions, and it is easy to say "yep, these should emit a FeatureNew for the versions they got added in".
2022-03-01allow dependency checks to bubble up feature warnings to the interpreterEli Schwartz1-0/+3
It would be too difficult and probably a layering violation to give an interpreter handle to the inner guts of every dependency. What we can do instead is let every dependency track: - the Feature checks it can produce, - the version attribute for when it was implemented while leaving the interpreter in charge of actually emitting them.
2022-02-17intl dependency: include header when checking for libc builtinEli Schwartz1-1/+2
This header is required anyway. And the compile test for linking to libc with the gettext symbol, can succeed when we try to use the literal symbol name without includes, but fail later during project build, because actually including libintl.h might redefine the function to match a forked symbol. This happens when GNU libintl is installed as a standalone library on systems that have a less fully-featured gettext implementation. So, by including the header in has_function, we can ensure that we test against the default resolved header. In the event that the symbol which is #define'd by the header is 'libintl_gettext', linking will fail against libc even when a builtin gettext does exist, and we will fall back to the intl dependency that provides -lintl (and which is needed to properly use the default header). Of course, even that probably won't work. has_function(prefix: '...') is useless to check the difference between builtins and external library functions. It has code to detect "builtins" that misfires in some cases (previously seen with iconv_open). Instead compile an open-coded test file that this intl dependency implementation fully controls, that doesn't get up to imaginative edge cases like trying to find `__builtin_gettext`. It's the only way to be sure. Fixes compiling against the intl dependency on e.g. Alpine Linux when the libintl package is installed.
2022-02-16flake8: fix wrong numbers of blank line separatorsEli Schwartz1-1/+0
2022-02-16flake8: fix typoed whitespace surrounding tokensEli Schwartz1-1/+1
2022-02-14comment out broken Feature checks that fail mypyEli Schwartz1-3/+10
We currently cannot make this work because inside dependency() we don't know the current subproject. We would also like the optional but extremely useful location node, but we don't have that either... Convert the broken code to a FIXME for visibility.
2022-02-14Add wx-config-3.1 provided by mingw-w64-x86_64-wxmsw3.1apoorv5691-1/+1
On Windows using MSYS2 MinGW installing the package `mingw-w64-x86_64-wxmsw3.1` provides `wx-config-3.1`. I have tried building my software by making this exact change and it build correctly.
2022-02-02openssl dependency: add cmake supportEli Schwartz2-4/+11
This is gross and looks terrible, but I'm not entirely sure how else to do this. And cmake is an inferior methodology, TBH, since it is effectively the same as our own builtins. However, cmake also handles some bizarre Windows library names whose provenance I'm not entirely sure of, in addition to implementing the usual excessive pattern of hardcoded search directories. So, this may be useful, at least on Windows, as a fallback. (I am not really interested in offering feature compatibility with cmake for a bunch of bizarre naming schemes that ***aren't the official cmake library names***, so if cmake allows that and people really feel they need it, all the more power to them.) Nevertheless, I believe if it got found via our system dependency class, it will always provide results which are just as functional as cmake. cmake can only find openssl installations that would otherwise be missed. This also avoids the case where users did ``` dependency('OpenSSL', modules: [...], method: 'cmake') ``` and expected it to work, since our builtin dependency supersedes the divergent case and didn't previously allow the cmake method. I don't know why they would do such a thing, but who knows... it is always possible.
2022-02-02dependencies: add a system dependency for OpenSSLEli Schwartz2-1/+71
On some platforms, this is provided by the base system, which nevertheless refrains from providing the .pc files that go along with it. As a result, it's impossible to sensibly find these dependencies. I'm looking at you, FreeBSD... Upstream tracking bug: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=257659 This is also a problem on macOS, but that's unfixable (and I believe they provide some truly ancient and out-of-support version anyway) and you probably want to use the homebrew OpenSSL. Still, meson can now detect these old versions and even set their version number.
2022-02-01new custom dependency lookup for libdlAndrew Krasavin2-0/+28
2022-02-01Fix dep.get_variable() with empty string default_valueXavier Claessens1-1/+1
2022-01-27flake8: fix indentation styleEli Schwartz2-2/+2
2022-01-27fix some flake8 violations for unused importsEli Schwartz1-1/+1
And one undefined T.cast name in a file that isn't yet mypy-ready anyway.
2022-01-18dependencies: fix libraries and whole_libraries typesDylan Baker1-4/+5
gnome points out that CustomTargets can be linked with, so we should allow that.
2022-01-18dependencies: don't pass kwargs from get_pkgconfig_variableDylan Baker4-28/+23
This is a layering violation, we're relying on the way the interpreter handles keyword arguments. Instead, pass them as free variables, destructuring in the interpreter
2022-01-10port from embedded data to importlib.resourcesEli Schwartz2-2/+2
2022-01-10pyupgrade --py37-plusEli Schwartz1-1/+1
2021-12-17Fix mypy errorsDaniel Mensinger1-2/+2
2021-12-12intl dep: forward static to iconv if neededChristoph Reiter1-1/+1
In 1fb6c939473ca7cdab2 the intl dep gained support for static linking which also forwarded this property to the iconv sub dependency. The refactoring in 214d03568f75 lost this change, which results in iconv getting linked dynamically again. Forward static again to fix this.
2021-12-01cmake: Fix old style dependency lookup with imported targetsDaniel Mensinger1-91/+17
This also includes some refactoring, since the alternaticve would have been to duplicate the huge traceparser target code block again. fixes #9581
2021-11-28iconv dependency: try even harder to find working iconvEli Schwartz1-1/+2
has_function(prefix: '...') is useless to check the difference between builtins and external library functions. It has code to detect "builtins" that misfires and reports that iconv_open is defined as a builtin on mingw, but only if you include the header. Instead compile an open-coded test file that this iconv dependency implementation fully controls, that doesn't get up to imaginative edge cases like trying to find `__builtin_iconv_open`. Fixes commit db1fa702f3943c6e4fec142b2bf5468c89173993, which merely moved the brokenness over one step to the right (by breaking mingw instead of freebsd) Fixes https://github.com/mesonbuild/meson/pull/9632#issuecomment-979581509
2021-11-25iconv dependency: include header when checking for libc builtinEli Schwartz1-1/+1
This header is required anyway. And the compile test for linking to libc with the iconv_open symbol, can succeed when we try to use the literal symbol name without includes, but fail later during project build, because actually including iconv.h might redefine the function to match a forked symbol. This happens when GNU iconv is installed as a standalone library on systems that have a less fully-featured iconv implementation. So, by including the header in has_function, we ensure that we test against the default resolved header. In the event that the symbol which is #define'd by the header is 'libiconv_open', linking will fail against libc even when a builtin iconv does exist, and we will fall back to the iconv dependency that provides -liconv (and which is needed to properly use the default header). Fixes compiling against the iconv dependency on e.g. FreeBSD when the libiconv port is installed.
2021-11-20dependencies/zlib: Allow for generic OS checksDudemanguy1-4/+1
Contrary to most system method checks, zlib currently functions as a whitelist of OSes. This isn't really needed however. The first special case for OSes that provide zlib as part of the base OS is worth keeping. However, the elif for windows is more than generic enough to allow any other potential OSes to try. Just make it a simplie if/else instead.
2021-11-20cmake: Use find_library() on bare library names in cmake dependenciesJon Turney1-6/+4
Convert bare library names to a dependency linker argument using find_library(), rather than hardcoding the MSVC transformation.
2021-11-17hdf5 dependency: check for alternative config-tool namesEli Schwartz1-3/+3
Depending on whether hdf5 is compiled with parallel support, the same config-tool program may be installed with a mysterious "p" in the name. In this case, dependency lookup will totally fail, unless of course you use the superior pkg-config interface in which case you get a predictable name. Work around this insanity by checking for both types of config-tool name. Fixes #9555
2021-11-15dependencies/zlib: Add system zlib method for androidDudemanguy1-2/+2
The same method that the BSDs use should also work for android. Also update the tests and docs where appropriate.
2021-11-01various manual conversion of percent-formatted strings to f-stringsEli Schwartz3-18/+14
2021-10-27fix various flake8 whitespace errorsEli Schwartz2-2/+2
2021-10-26dep.name(): return dependency name even if dependency is not foundThomas Heijligen2-3/+3
The dep.name() function schould always return the name of the dependency as documented. No matter if it was found or not. https://mesonbuild.com/Reference-manual_returned_dep.html#depfound
2021-10-24cmake: Add support for the Linux CMake registry (fixes #9418)Daniel Mensinger1-0/+6
2021-10-10pkg-config: do not ever successfully detect Strawberry Perl.Eli Schwartz1-0/+4
This is broken and terrible and thus completely unusable. Don't torture users by finding pkg-config on Windows, thus permitting the pkg-config lookup of several dependencies that do not actually work -- which then fails at build time. This also breaks CI for the wrapdb, because Strawberry Perl is provided as part of the base image for the OS (yes, even though it is terribly broken!!!) and anything that depends on e.g. zlib will "find" zlib because of this broken disaster, even though it should use the wrapdb subproject of zlib. It is assumed no one actually wants to mix Strawberry Perl and meson. In fact, some projects, such as gst-build, already unconditionally error out if Strawberry Perl is detected in PATH: error('You have Strawberry Perl in PATH which is known to cause build issues with gst-build. Please remove it from PATH or uninstall it.') Other projects (postgresql) actually do want to build perl extensions, and link to the perl dlls, but absolutely under no circumstances ever want to use its pkg-config implementation. ;) Let's solve this problem by just considering this to not be a valid pkg-config, let the user find another or not have one at all. This change "solves" https://github.com/StrawberryPerl/Perl-Dist-Strawberry/issues/11
2021-10-10simplify some log formatting by splitting out a commonly used format stringEli Schwartz1-5/+4
There are a bunch of cases in a single function where we would want to log the detected path of pkg-config. Formatting this is awkward. Define it once, then use f-strings everywhere. :D
2021-10-10Fix typos discovered by codespellChristian Clauss6-11/+11
2021-10-06cmake: Implement support for interpreting link "keywords"Daniel Mensinger1-10/+32
CMakes `target_link_libraries()` supports certain keywords to only enable specific libraries for specific CMake configurations. We now try our best to replicate this for Meson dependencies. Fixes #9197
2021-10-06cmake: Warn if we could use IMPORTED CMake targetsDaniel Mensinger1-1/+32
2021-10-04dependencies: Dependency.sources can have CustomTargetsDylan Baker1-5/+6
2021-10-04work around flake8 F811 for T.overload redefined functionsEli Schwartz1-2/+2
Since typing != T as far as flake8 is aware, give the linter an extra hint.
2021-10-04remove f from f-string that has no formattingEli Schwartz1-1/+1
2021-10-04coding style: don't format an empty string with another stringEli Schwartz1-1/+1
'{}'.format('foo') for any given value of 'foo' (in this case, a function returning a string), can always just be 'foo' directly, which is a lot more readable.
2021-10-04various python neatness cleanupsEli Schwartz1-2/+2
All changes were created by running "pyupgrade --py3-only" and committing the results. Although this has been performed in the past, newer versions of pyupgrade can automatically catch more opportunities, notably list comprehensions can use generators instead, in the following cases: - unpacking into function arguments as function(*generator) - unpacking into assignments of the form x, y = generator - as the argument to some builtin functions such as min/max/sorted Also catch a few creeping cases of new code added using older styles.
2021-09-25dependencies: Add JDK system dependency for SolarisAlan Coopersmith1-0/+2
Handle is_sunos() machines in __machine_info_to_platform_include_dir
2021-09-14apply flake8 fixes for unused imports and missing importsEli Schwartz2-2/+1
2021-09-12new custom dependency lookup for iconvEli Schwartz2-2/+31
Also internally needed by intl, so add that as a proxied dependency instead of coding it manually.
2021-09-10nagfor OpenMP recognition.Mat Cross1-0/+6
2021-09-07summary: fix dependenciesPaolo Bonzini1-1/+1
Dependencies are currently printed as [<mesonbuild.mlog.AnsiDecorator object at 0x7faa85aeac70>, ' ', <mesonbuild.mlog.AnsiDecorator object at 0x7faa85aeab50>] This was introduced in commit adb1b2f3f6ad54b346348ec6e5b8d96f2f7ba0a6, due to an incorrect type annotation on the AnsiText constructor. Fix both the annotation and the usage. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2021-08-31pylint: turn on superflous-parensDylan Baker2-2/+2
We have a lot of these. Some of them are harmless, if unidiomatic, such as `if (condition)`, others are potentially dangerous `assert(...)`, as `assert(condtion)` works as expected, but `assert(condition, message)` will result in an assertion that never triggers, as what you're actually asserting is `bool(tuple[2])`, which will always be true.
2021-08-15editorconfig: add setting to trim trailing whitespaceEli Schwartz1-2/+2
and clean up all outstanding issues Skip 'test cases/common/141 special characters/meson.build' since it intentionally uses trailing newlines.