diff options
author | Iñigo MartÃnez <inigomartinez@gmail.com> | 2017-08-31 20:38:15 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-08-31 21:38:15 +0300 |
commit | 35ef236c43cb196b706d6b3e62022c1b94b016f0 (patch) | |
tree | 388b5986df76b133b3372f870c53a6f24c8798bf /mesonbuild/dependencies/misc.py | |
parent | 5f0a91baa51a0403eb6db51d51e96430aaa1b716 (diff) | |
download | meson-35ef236c43cb196b706d6b3e62022c1b94b016f0.zip meson-35ef236c43cb196b706d6b3e62022c1b94b016f0.tar.gz meson-35ef236c43cb196b706d6b3e62022c1b94b016f0.tar.bz2 |
add support for cups dependencies (#2255)
* add support for cups dependencies
libcups has its own cups-config tool rather than using pkg-config.
This adds support for cups-config, based on pcap-config and
sdl2-config implementations.
This change also includes the unit test case and documentation for
cups dependency object implementation, and libcups2 dep to CI image.
Diffstat (limited to 'mesonbuild/dependencies/misc.py')
-rw-r--r-- | mesonbuild/dependencies/misc.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index 0112fd3..12e0239 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -623,3 +623,51 @@ class PcapDependency(ExternalDependency): return [DependencyMethods.PKGCONFIG, DependencyMethods.PCAPCONFIG, DependencyMethods.EXTRAFRAMEWORK] else: return [DependencyMethods.PKGCONFIG, DependencyMethods.PCAPCONFIG] + +class CupsDependency(ExternalDependency): + def __init__(self, environment, kwargs): + super().__init__('cups', environment, None, kwargs) + if DependencyMethods.PKGCONFIG in self.methods: + try: + kwargs['required'] = False + pcdep = PkgConfigDependency('cups', environment, kwargs) + if pcdep.found(): + self.type_name = 'pkgconfig' + self.is_found = True + self.compile_args = pcdep.get_compile_args() + self.link_args = pcdep.get_link_args() + self.version = pcdep.get_version() + return + except Exception as e: + mlog.debug('cups not found via pkgconfig. Trying next, error was:', str(e)) + if DependencyMethods.CUPSCONFIG in self.methods: + cupsconf = shutil.which('cups-config') + if cupsconf: + stdo = Popen_safe(['cups-config', '--cflags'])[1] + self.compile_args = stdo.strip().split() + stdo = Popen_safe(['cups-config', '--libs'])[1] + self.link_args = stdo.strip().split() + stdo = Popen_safe(['cups-config', '--version'])[1] + self.version = stdo.strip().split() + self.is_found = True + mlog.log('Dependency', mlog.bold('cups'), 'found:', + mlog.green('YES'), '(%s)' % cupsconf) + return + mlog.debug('Could not find cups-config binary, trying next.') + if DependencyMethods.EXTRAFRAMEWORK in self.methods: + if mesonlib.is_osx(): + fwdep = ExtraFrameworkDependency('cups', False, None, self.env, + self.language, kwargs) + if fwdep.found(): + self.is_found = True + self.compile_args = fwdep.get_compile_args() + self.link_args = fwdep.get_link_args() + self.version = fwdep.get_version() + return + mlog.log('Dependency', mlog.bold('cups'), 'found:', mlog.red('NO')) + + def get_methods(self): + if mesonlib.is_osx(): + return [DependencyMethods.PKGCONFIG, DependencyMethods.CUPSCONFIG, DependencyMethods.EXTRAFRAMEWORK] + else: + return [DependencyMethods.PKGCONFIG, DependencyMethods.CUPSCONFIG] |