aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/misc.py
AgeCommit message (Collapse)AuthorFilesLines
2023-02-22dependencies: refactor python3 into its own fileEli Schwartz1-116/+0
2023-02-01treewide: add future annotations importEli Schwartz1-0/+1
2023-01-18dependencies: fix pcap-config which now errors on --versionEli Schwartz1-1/+7
The latest release of libpcap added argument validation to pcap-config, but still doesn't support --version. The next version of libpcap will support --version. Add support for config-tool dependencies which expect to break on --version, to fallback to an option that does not error out or print version info, for sanity checking.
2022-11-30pylint: enable the set_membership pluginDylan Baker1-1/+1
Which adds the `use-set-for-membership` check. It's generally faster in python to use a set with the `in` keyword, because it's a hash check instead of a linear walk, this is especially true with strings, where it's actually O(n^2), one loop over the container, and an inner loop of the strings (as string comparison works by checking that `a[n] == b[n]`, in a loop). Also, I'm tired of complaining about this in reviews, let the tools do it for me :)
2022-11-29Fix crash when toolchain is missingSmallWood-D1-1/+1
Add a MissingCompiler class returned by compiler detecting methods intead of None - accessing such an object raises a DependencyException Fixes #10586 Co-authored-by: duckflyer <duckflyer@gmail.com>
2022-09-12dependencies: simplify log_tried into a staticmethodEli Schwartz1-1/+2
It doesn't really need class instantiation to just know what type it is, and this way we can get the information early if a dependency fails to init.
2022-09-12dependencies: simplify logging methodsEli Schwartz1-3/+0
A bunch of SystemDependency subclasses overrode log_tried() even though they used the same function anyway. Delete them -- they still print the same thing either way.
2022-05-03add prefer_static built-in optionDudemanguy1-1/+1
By default, meson will try to look for shared libraries first before static ones. In the meson.build itself, one can use the static keyword to control if a static library will be tried first but there's no simple way for an end user performing a build to switch back and forth at will. Let's cover this usecase by adding an option that allows a user to specify if they want dependency lookups to try static or shared libraries first. The writer of the meson.build can manually specify the static keyword where appropriate which will override the value of this option.
2022-05-03dependencies: cleanup kwargs.get('static') usageDudemanguy1-1/+0
In a couple of spots, kwargs.get('static', False) was being unneccesarily used. In these spots, we can just use self.static instead which is already inherited from the ExternalDependency. In additional, the python system dependency oddly has a kwargs.get('static', False) line which overrides the self.static in that dependency for no real reason. Delete this line too.
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 Schwartz1-0/+6
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-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-02openssl dependency: add cmake supportEli Schwartz1-3/+6
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 Schwartz1-0/+67
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 Krasavin1-0/+26
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-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-10-27fix various flake8 whitespace errorsEli Schwartz1-1/+1
2021-10-10Fix typos discovered by codespellChristian Clauss1-2/+2
2021-09-12new custom dependency lookup for iconvEli Schwartz1-1/+29
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-07-28intl dep: support static kwargEli Schwartz1-1/+4
Since intl links internally to iconv, try to pull in iconv too, but only if we specifically ask for static libs. If PREFER_SHARED, we have no way to tell which type we got, so do not try handling that...
2021-07-28intl: fix incorrect detection of headerEli Schwartz1-1/+1
Although find_library returns the library as a list of args, has_header returns a tuple(is_found, is_cached) which is non-empty and thus always true. Which is confusing... Check whether it actually got found.
2021-07-13dependencies: drop Dependency.methods and Dependency.get_methods()Dylan Baker1-44/+0
Both of these are artifacts of the time before Dependency Factories, when a dependency that could be discovered multiple ways did ugly stuff like finding a specific dependency, then replacing it's own attributes with that dependency's attributes. We don't have cases of that left in the tree, so let's get rid of this code too
2021-07-05more f-strings too complex to be caught by pyupgradeEli Schwartz1-4/+3
2021-06-17intl custom dependencyEli Schwartz1-1/+27
Checking how to aquire the *gettext family of symbols portably is annoyingly complex, and may come from the libc, or standalone. builtin dependency: This detects if libintl is unneeded, because the *gettext family of symbols is available in the libc. system dependency: This detects if libintl is installed as separate software, linkable via -lintl; unfortunately, GNU gettext does not ship pkg-config files for it. Fixes #3929
2021-06-17move base class for system dependencies into base.pyEli Schwartz1-1/+1
In accordance with review comments; it's small enough this seems fitting.
2021-06-14dependencies: Use the SystemDependencyDylan Baker1-10/+10
This fixes these dependencies, which currently return the name of the dependency as the type. Fixes #8877
2021-06-09compilers: Fix missing functions in Compiler base classDaniel Mensinger1-2/+0
2021-06-09typing: Rename some variablesDaniel Mensinger1-10/+16
2021-06-09typing: Fully annotate dependenciesDaniel Mensinger1-24/+25
2021-06-06typing: Fully annotate dependencies.{detect,factory} + some other fixesDaniel Mensinger1-4/+5
2021-06-03deps: Split dependencies.baseDaniel Mensinger1-5/+5
Split the Factory and dependency classes out of the base.py script to improve maintainability.
2021-04-20dependencies/OpenMP: If the version returned is not supported fail gracefullyDylan Baker1-1/+7
Currently if the version returned is not a supported version, then you get a lovely stack trace. This is not nice. This can be triggered easily by adding gcc's `-fdirectives-only` flag, which stops the preprocessor from doing certain macro expansions, including those used to detect OpenMP. Fixes #8652
2021-03-04mass rewrite of string formatting to use f-strings everywhereEli Schwartz1-10/+10
performed by running "pyupgrade --py36-plus" and committing the results
2021-01-13Fix misspellsAntonin Décimo1-1/+1
Signed-off-by: Antonin Décimo <antonin.decimo@gmail.com>
2020-11-20use real pathlib moduleDylan Baker1-1/+1
We added the _pathlib module to work around defeciencies in python 3.5's implementation, since we now rely on 3.6 lets drop this
2020-10-04pathlib: Fix resolve() by overriding it in Python 3.5Daniel Mensinger1-1/+1
2020-09-29dependencies/curses: don't try ncurses-config or system dependency on windowsDylan Baker1-5/+9
with msys ncurses-config returns a unix style path (currently, though it's been fixed upstream), which the compilers don't understand, so we can't do that. Additionally, while the system search does work, there's missing include directories that need to be added.
2020-09-29dependencies/curses: Add support for pdcursesYonggang Luo1-1/+6
On win32 there is pdcurses, so we detect it first, because python depends on ncursesw, so if we don't want to use ncursesw, we should make sure pdcurses detect before ncursesw
2020-09-29dependencies/curses: Add a system dependencyDylan Baker1-1/+58
That calls find_library and has_header in conjunction to look for curses implementations that are baked into the system without any other find method.
2020-09-29dependencies/curses: Add support for using the ncurses config toolsDylan Baker1-1/+20
These are mostly duplicated with pkg-config, but maybe someone has one but not another, and they're easy to turn on with the ConfigToolDependency.
2020-09-29dependency/misc: change lookup order for curses pkg-configDylan Baker1-1/+1
look for (in order): ncursesw, ncurses, curses.
2020-09-29dependencies/misc: Fix typing of curses_factoryDylan Baker1-3/+3
2020-06-10dependencies: Remove finish_init methodDylan Baker1-20/+31
This is a holdover from before we had the DependencyFactory. It should have already been refactored into the initializer, but wasn't for some reason.
2020-06-06msvc: Avoid spurious openmp link warningsPeter Harris1-1/+2
The linker that comes with MSVC does not understand the /openmp flag. This results in a string of LINK : warning LNK4044: unrecognized option '/openmp'; ignored warnings, one for each static_library linked with an executable. Avoid this by only setting the linker openmp flag when the compiler is not MSVC.
2020-01-31dependencies: netcdf always look for netcdf-fortran for fortranDylan Baker1-4/+4
Otherwise it tries to link with the C bindings and fails. This is why the test is broken on archlinux
2020-01-29dependencies: Use a factory for cursesDylan Baker1-23/+11
2020-01-29dependencies: Use a DependencyFactory for threadsDylan Baker1-27/+18
This lets us make a number of uses of threads safer, because we can use the threads_factory instead of the ThreadDependency