diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2017-11-08 13:02:11 -0800 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2017-11-23 19:54:48 -0800 |
commit | df3c0064564760315eb69e78b7c298bf26ad1b59 (patch) | |
tree | c225e5ad6332e9a3c1b59331fc26de5c51925f67 | |
parent | 11fbc982d3fcb95b6774e0af6cc7d506fe876dc0 (diff) | |
download | meson-df3c0064564760315eb69e78b7c298bf26ad1b59.zip meson-df3c0064564760315eb69e78b7c298bf26ad1b59.tar.gz meson-df3c0064564760315eb69e78b7c298bf26ad1b59.tar.bz2 |
Use ConfigToolDependency for libwmf
-rw-r--r-- | mesonbuild/dependencies/base.py | 5 | ||||
-rw-r--r-- | mesonbuild/dependencies/misc.py | 34 | ||||
-rw-r--r-- | test cases/frameworks/21 libwmf/meson.build | 5 |
3 files changed, 24 insertions, 20 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 3dcb41a..84b20e7 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -46,8 +46,6 @@ class DependencyMethods(Enum): QMAKE = 'qmake' # Just specify the standard link arguments, assuming the operating system provides the library. SYSTEM = 'system' - # Detect using libwmf-config - LIBWMFCONFIG = 'libwmf-config' # This is only supported on OSX - search the frameworks directory by name. EXTRAFRAMEWORK = 'extraframework' # Detect using the sysconfig module. @@ -58,6 +56,7 @@ class DependencyMethods(Enum): SDLCONFIG = 'sdlconfig' CUPSCONFIG = 'cups-config' PCAPCONFIG = 'pcap-config' + LIBWMFCONFIG = 'libwmf-config' class Dependency: @@ -78,7 +77,7 @@ class Dependency: # This sets per-too config methods which are deprecated to to the new # generic CONFIG_TOOL value. if method in [DependencyMethods.SDLCONFIG, DependencyMethods.CUPSCONFIG, - DependencyMethods.PCAPCONFIG]: + DependencyMethods.PCAPCONFIG, DependencyMethods.LIBWMFCONFIG]: mlog.warning(textwrap.dedent("""\ Configuration method {} has been deprecated in favor of 'config-tool'. This will be removed in a future version of diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index f627e01..e966597 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -778,7 +778,6 @@ class CupsDependency(ExternalDependency): return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL] - class LibWmfDependency(ExternalDependency): def __init__(self, environment, kwargs): super().__init__('libwmf', environment, None, kwargs) @@ -795,26 +794,27 @@ class LibWmfDependency(ExternalDependency): return except Exception as e: mlog.debug('LibWmf not found via pkgconfig. Trying next, error was:', str(e)) - if DependencyMethods.LIBWMFCONFIG in self.methods: - libwmfconf = shutil.which('libwmf-config') - if libwmfconf: - stdo = Popen_safe(['libwmf-config', '--cflags'])[1] - self.compile_args = stdo.strip().split() - stdo = Popen_safe(['libwmf-config', '--libs'])[1] - self.link_args = stdo.strip().split() - stdo = Popen_safe(['libwmf-config', '--version'])[1] - self.version = stdo.strip() - self.is_found = True - mlog.log('Dependency', mlog.bold('libwmf'), 'found:', - mlog.green('YES'), '(%s)' % libwmfconf) - return - mlog.debug('Could not find libwmf-config binary, trying next.') + if DependencyMethods.CONFIG_TOOL in self.methods: + try: + ctdep = ConfigToolDependency.factory( + 'libwmf', environment, None, kwargs, ['libwmf-config'], 'libwmf-config') + if ctdep.found(): + self.config = ctdep.config + self.type_name = 'config-too' + self.version = ctdep.version + self.compile_args = ctdep.get_config_value(['--cflags'], 'compile_args') + self.link_args = ctdep.get_config_value(['--libs'], 'link_args') + self.is_found = True + return + except Exception as e: + mlog.debug('cups not found via libwmf-config. Trying next, error was:', str(e)) def get_methods(self): if mesonlib.is_osx(): - return [DependencyMethods.PKGCONFIG, DependencyMethods.LIBWMFCONFIG, DependencyMethods.EXTRAFRAMEWORK] + return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK] else: - return [DependencyMethods.PKGCONFIG, DependencyMethods.LIBWMFCONFIG] + return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL] + # Generated with boost_names.py BOOST_LIBS = [ diff --git a/test cases/frameworks/21 libwmf/meson.build b/test cases/frameworks/21 libwmf/meson.build index e845969..b39d8f4 100644 --- a/test cases/frameworks/21 libwmf/meson.build +++ b/test cases/frameworks/21 libwmf/meson.build @@ -7,3 +7,8 @@ message('libwmf version is "@0@"'.format(libwmf_ver)) e = executable('libwmf_prog', 'libwmf_prog.c', dependencies : libwmf_dep) test('libwmftest', e) + +# Test using the method keyword: + +dependency('libwmf', method : 'config-tool') +dependency('libwmf', method : 'libwmf-config') |