diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2022-01-27 19:24:54 -0500 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2022-02-02 07:10:55 -0800 |
commit | 96df0fc69ea0f0a20519fa784db90aaf890a5f30 (patch) | |
tree | cd3696b2653bbfc9c5f0fba1465c57f435646ab0 | |
parent | 0268c25791a5b47a46699f7a0db538e227aa73b6 (diff) | |
download | meson-96df0fc69ea0f0a20519fa784db90aaf890a5f30.zip meson-96df0fc69ea0f0a20519fa784db90aaf890a5f30.tar.gz meson-96df0fc69ea0f0a20519fa784db90aaf890a5f30.tar.bz2 |
openssl dependency: add cmake support
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.
-rw-r--r-- | mesonbuild/dependencies/factory.py | 6 | ||||
-rw-r--r-- | mesonbuild/dependencies/misc.py | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/mesonbuild/dependencies/factory.py b/mesonbuild/dependencies/factory.py index 9346abe..2844cf4 100644 --- a/mesonbuild/dependencies/factory.py +++ b/mesonbuild/dependencies/factory.py @@ -49,6 +49,10 @@ if T.TYPE_CHECKING: T.List[DependencyGenerator] ] + # This should be str, Environment, T.Dict[str, T.Any], T.Optional[str] + # But if you try that, you get error: Cannot infer type of lambda + CmakeDependencyFunc = T.Callable[..., CMakeDependency] + class DependencyFactory: """Factory to get dependencies from multiple sources. @@ -77,7 +81,7 @@ class DependencyFactory: pkgconfig_name: T.Optional[str] = None, pkgconfig_class: 'T.Type[PkgConfigDependency]' = PkgConfigDependency, cmake_name: T.Optional[str] = None, - cmake_class: 'T.Type[CMakeDependency]' = CMakeDependency, + cmake_class: 'T.Union[T.Type[CMakeDependency], CmakeDependencyFunc]' = CMakeDependency, configtool_class: 'T.Optional[T.Type[ConfigToolDependency]]' = None, framework_name: T.Optional[str] = None, framework_class: 'T.Type[ExtraFrameworkDependency]' = ExtraFrameworkDependency, diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 5441b34..c769077 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -693,18 +693,21 @@ intl_factory = DependencyFactory( openssl_factory = DependencyFactory( 'openssl', - [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM], + [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM, DependencyMethods.CMAKE], system_class=OpensslSystemDependency, + cmake_class=lambda name, env, kwargs: CMakeDependency('OpenSSL', env, dict(kwargs, modules=['OpenSSL::Crypto', 'OpenSSL::SSL'])), ) libcrypto_factory = DependencyFactory( 'libcrypto', - [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM], + [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM, DependencyMethods.CMAKE], system_class=OpensslSystemDependency, + cmake_class=lambda name, env, kwargs: CMakeDependency('OpenSSL', env, dict(kwargs, modules=['OpenSSL::Crypto'])), ) libssl_factory = DependencyFactory( 'libssl', - [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM], + [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM, DependencyMethods.CMAKE], system_class=OpensslSystemDependency, + cmake_class=lambda name, env, kwargs: CMakeDependency('OpenSSL', env, dict(kwargs, modules=['OpenSSL::SSL'])), ) |