Same for cups

pull/2926/head
Jon Turney 7 years ago
parent 638095125d
commit cdf241420c
  1. 43
      mesonbuild/dependencies/misc.py
  2. 10
      test cases/common/174 dependency factory/meson.build

@ -852,45 +852,36 @@ class PcapDependency(ExternalDependency):
class CupsDependency(ExternalDependency):
def __init__(self, environment, kwargs):
super().__init__('cups', environment, None, kwargs)
kwargs['required'] = False
if DependencyMethods.PKGCONFIG in self.methods:
@classmethod
def _factory(cls, environment, kwargs):
methods = cls._process_method_kw(kwargs)
if DependencyMethods.PKGCONFIG in methods:
try:
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()
self.pcdep = pcdep
return
return pcdep
except Exception as e:
mlog.debug('cups not found via pkgconfig. Trying next, error was:', str(e))
if DependencyMethods.CONFIG_TOOL in self.methods:
if DependencyMethods.CONFIG_TOOL in methods:
try:
ctdep = ConfigToolDependency.factory(
'cups', environment, None, kwargs, ['cups-config'], 'cups-config')
if ctdep.found():
self.config = ctdep.config
self.type_name = 'config-tool'
self.version = ctdep.version
self.compile_args = ctdep.get_config_value(['--cflags'], 'compile_args')
self.link_args = ctdep.get_config_value(['--ldflags', '--libs'], 'link_args')
self.is_found = True
return
ctdep.compile_args = ctdep.get_config_value(['--cflags'], 'compile_args')
ctdep.link_args = ctdep.get_config_value(['--ldflags', '--libs'], 'link_args')
return ctdep
except Exception as e:
mlog.debug('cups not found via cups-config. Trying next, error was:', str(e))
if DependencyMethods.EXTRAFRAMEWORK in self.methods:
if DependencyMethods.EXTRAFRAMEWORK in methods:
if mesonlib.is_osx():
fwdep = ExtraFrameworkDependency('cups', False, None, self.env,
self.language, kwargs)
fwdep = ExtraFrameworkDependency('cups', False, None, environment,
kwargs.get('language', None), 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'))
return fwdep
mlog.log('Dependency', mlog.bold('cups'), 'found:', mlog.red('NO'))
return CupsDependency(environment, kwargs)
@staticmethod
def get_methods():

@ -29,3 +29,13 @@ dep = dependency('pcap', method: 'config-tool', required: false)
if dep.found() and dep.type_name() == 'configtool'
dep.get_configtool_variable('prefix')
endif
dep = dependency('cups', method: 'pkg-config', required: false)
if dep.found() and dep.type_name() == 'pkgconfig'
dep.get_pkgconfig_variable('prefix')
endif
dep = dependency('cups', method: 'config-tool', required: false)
if dep.found() and dep.type_name() == 'configtool'
dep.get_configtool_variable('prefix')
endif

Loading…
Cancel
Save