Debian Codegraph @

mesonbuild/dependencies/misc.py

raw
1 # SPDX-License-Identifier: Apache-2.0
2 # Copyright 2013-2019 The Meson development team
3
4 # This file contains the detection logic for miscellaneous external dependencies.
5 from __future__ import annotations
6
7 import re
8 import typing as T
9
10 from .. import mesonlib
11 from .. import mlog
12 from .base import DependencyCandidate, DependencyException, DependencyMethods
13 from .base import BuiltinDependency, SystemDependency
14 from .cmake import CMakeDependency
15 from .configtool import ConfigToolDependency
16 from .detect import packages
17 from .factory import DependencyFactory, factory_methods
18 from .pkgconfig import PkgConfigDependency
19 from ..options import OptionKey
20
21 if T.TYPE_CHECKING:
22 from ..environment import Environment
23 from .base import DependencyObjectKWs
24 from .factory import DependencyGenerator
25
26
27 @factory_methods({DependencyMethods.PKGCONFIG, DependencyMethods.CMAKE})
28 def netcdf_factory(env: 'Environment',
29 kwargs: DependencyObjectKWs,
30 methods: T.List[DependencyMethods]) -> T.List['DependencyGenerator']:
31 language = kwargs.get('language')
32 if language is None:
33 language = 'c'
34 if language not in ('c', 'cpp', 'fortran'):
35 raise DependencyException(f'Language {language} is not supported with NetCDF.')
36
37 candidates: T.List['DependencyGenerator'] = []
38
39 if DependencyMethods.PKGCONFIG in methods:
40 if language == 'fortran':
41 pkg = 'netcdf-fortran'
42 else:
43 pkg = 'netcdf'
44
45 candidates.append(DependencyCandidate.from_dependency(
46 pkg, PkgConfigDependency, (env, kwargs)))
47
48 if DependencyMethods.CMAKE in methods:
49 candidates.append(DependencyCandidate.from_dependency(
50 'NetCDF', CMakeDependency, (env, kwargs)))
51
52 return candidates
53
54 packages['netcdf'] = netcdf_factory
55
56
57 class AtomicBuiltinDependency(BuiltinDependency):
58 def __init__(self, name: str, env: Environment, kwargs: DependencyObjectKWs):
59 super().__init__(name, env, kwargs)
60 self.feature_since = ('1.7.0', "consider checking for `atomic_flag_clear` with and without `find_library('atomic')`")
61
62 if self.clib_compiler.has_function('atomic_flag_clear', '#include <stdatomic.h>')[0]:
63 self.is_found = True
64 elif self.clib_compiler.get_id() == 'msvc':
65 feature_flag = '/experimental:c11atomics'
66 std_args = self.clib_compiler.get_option_std_args(None, None)
67 # atomic_flag_clear forwards to __c11_atomic_store in msvc,
68 # which behaves like __builtin_* in gcc, and we're unable to detect it with .has_function().
69 if self.clib_compiler.has_function("_Atomic_thread_fence",
70 "#include <stdatomic.h>",
71 extra_args=std_args)[0]:
72 self.is_found = True
73 elif self.clib_compiler.has_function("_Atomic_thread_fence",
74 "#include <stdatomic.h>",
75 extra_args=std_args + [feature_flag])[0]:
76 self.compile_args = [feature_flag]
77 self.is_found = True
78
79
80 class AtomicSystemDependency(SystemDependency):
81 def __init__(self, name: str, env: Environment, kwargs: DependencyObjectKWs):
82 super().__init__(name, env, kwargs)
83 self.feature_since = ('1.7.0', "consider checking for `atomic_flag_clear` with and without `find_library('atomic')`")
84
85 h = self.clib_compiler.has_header('stdatomic.h', '')
86 self.link_args = self.clib_compiler.find_library('atomic', [], self.libtype)
87
88 if h[0] and self.link_args:
89 self.is_found = True
90
91
92 class DlBuiltinDependency(BuiltinDependency):
93 def __init__(self, name: str, env: 'Environment', kwargs: DependencyObjectKWs):
94 super().__init__(name, env, kwargs)
95 self.feature_since = ('0.62.0', "consider checking for `dlopen` with and without `find_library('dl')`")
96
97 if self.clib_compiler.has_function('dlopen', '#include <dlfcn.h>')[0]:
98 self.is_found = True
99
100
101 class DlSystemDependency(SystemDependency):
102 def __init__(self, name: str, env: 'Environment', kwargs: DependencyObjectKWs):
103 super().__init__(name, env, kwargs)
104 self.feature_since = ('0.62.0', "consider checking for `dlopen` with and without `find_library('dl')`")
105
106 h = self.clib_compiler.has_header('dlfcn.h', '')
107 self.link_args = self.clib_compiler.find_library('dl', [], self.libtype)
108
109 if h[0] and self.link_args:
110 self.is_found = True
111
112
113 class OpenMPDependency(SystemDependency):
114 # Map date of specification release (which is the macro value) to a version.
115 VERSIONS = {
116 '202411': '6.0',
117 '202111': '5.2',
118 '202011': '5.1',
119 '201811': '5.0',
120 '201611': '5.0-revision1', # This is supported by ICC 19.x
121 '201511': '4.5',
122 '201307': '4.0',
123 '201107': '3.1',
124 '200805': '3.0',
125 '200505': '2.5',
126 '200203': '2.0',
127 '199810': '1.0',
128 }
129
130 def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObjectKWs) -> None:
131 super().__init__(name, environment, kwargs)
132 self.is_found = False
133 if self.clib_compiler.get_id() == 'nagfor':
134 # No macro defined for OpenMP, but OpenMP 3.1 is supported.
135 self.version = '3.1'
136 self.is_found = True
137 self.compile_args = self.link_args = self.clib_compiler.openmp_flags()
138 return
139 if self.clib_compiler.get_id() == 'pgi':
140 # through at least PGI 19.4, there is no macro defined for OpenMP, but OpenMP 3.1 is supported.
141 self.version = '3.1'
142 self.is_found = True
143 self.compile_args = self.link_args = self.clib_compiler.openmp_flags()
144 return
145
146 # Set these now so they're available for the following compiler checks
147 try:
148 self.compile_args.extend(self.clib_compiler.openmp_flags())
149 self.link_args.extend(self.clib_compiler.openmp_link_flags())
150 except mesonlib.MesonException as e:
151 mlog.warning('OpenMP support not available because:', str(e), fatal=False)
152 return
153
154 try:
155 openmp_date = self.clib_compiler.get_define(
156 '_OPENMP', '', [], [self], disable_cache=True)[0]
157 except mesonlib.EnvironmentException as e:
158 mlog.debug('OpenMP support not available in the compiler')
159 mlog.debug(e)
160 return
161
162 try:
163 self.version = self.VERSIONS[openmp_date]
164 except KeyError:
165 mlog.debug(f'Could not find an OpenMP version matching {openmp_date}')
166 if openmp_date == '_OPENMP':
167 mlog.debug('This can be caused by flags such as gcc\'s `-fdirectives-only`, which affect preprocessor behavior.')
168 return
169
170 # Flang has omp_lib.h
171 header_names = ('omp.h', 'omp_lib.h')
172 for name in header_names:
173 if self.clib_compiler.has_header(name, '', dependencies=[self], disable_cache=True)[0]:
174 self.is_found = True
175 break
176 else:
177 mlog.warning('OpenMP found but omp.h missing.', fatal=False)
178
179 packages['openmp'] = OpenMPDependency
180
181
182 class ThreadDependency(SystemDependency):
183 def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObjectKWs) -> None:
184 super().__init__(name, environment, kwargs)
185 self.is_found = True
186 # Happens if you are using a language with threads
187 # concept without C, such as plain Cuda.
188 if not self.clib_compiler:
189 self.compile_args = []
190 self.link_args = []
191 else:
192 self.compile_args = self.clib_compiler.thread_flags()
193 self.link_args = self.clib_compiler.thread_link_flags()
194
195
196 class BlocksDependency(SystemDependency):
197 def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObjectKWs) -> None:
198 super().__init__(name, environment, kwargs)
199 self.name = 'blocks'
200 self.is_found = False
201
202 if self.env.machines[self.for_machine].is_darwin():
203 self.compile_args = []
204 self.link_args = []
205 else:
206 self.compile_args = ['-fblocks']
207 self.link_args = ['-lBlocksRuntime']
208
209 if not self.clib_compiler.has_header('Block.h', '', disable_cache=True) or \
210 not self.clib_compiler.find_library('BlocksRuntime', []):
211 mlog.log(mlog.red('ERROR:'), 'BlocksRuntime not found.')
212 return
213
214 source = '''
215 int main(int argc, char **argv)
216 {
217 int (^callback)(void) = ^ int (void) { return 0; };
218 return callback();
219 }'''
220
221 with self.clib_compiler.compile(source, extra_args=self.compile_args + self.link_args) as p:
222 if p.returncode != 0:
223 mlog.log(mlog.red('ERROR:'), 'Compiler does not support blocks extension.')
224 return
225
226 self.is_found = True
227
228 packages['blocks'] = BlocksDependency
229
230
231 class PcapDependencyConfigTool(ConfigToolDependency):
232
233 tools = ['pcap-config']
234 tool_name = 'pcap-config'
235
236 # version 1.10.2 added error checking for invalid arguments
237 # version 1.10.3 will hopefully add actual support for --version
238 skip_version = '--help'
239
240 def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObjectKWs):
241 super().__init__(name, environment, kwargs)
242 if not self.is_found:
243 return
244 self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
245 self.link_args = self.get_config_value(['--libs'], 'link_args')
246 if self.version is None:
247 # older pcap-config versions don't support this
248 self.version = self.get_pcap_lib_version()
249
250 def get_pcap_lib_version(self) -> T.Optional[str]:
251 # Since we seem to need to run a program to discover the pcap version,
252 # we can't do that when cross-compiling
253 # FIXME: this should be handled if we have an exe_wrapper
254 if not self.env.machines.matches_build_machine(self.for_machine):
255 return None
256
257 v = self.clib_compiler.get_return_value('pcap_lib_version', 'string',
258 '#include <pcap.h>', [], [self])
259 v = re.sub(r'libpcap version ', '', str(v))
260 v = re.sub(r' -- Apple version.*$', '', v)
261 return v
262
263
264 class CupsDependencyConfigTool(ConfigToolDependency):
265
266 tools = ['cups-config']
267 tool_name = 'cups-config'
268
269 def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObjectKWs):
270 super().__init__(name, environment, kwargs)
271 if not self.is_found:
272 return
273 self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
274 self.link_args = self.get_config_value(['--ldflags', '--libs'], 'link_args')
275
276
277 class LibWmfDependencyConfigTool(ConfigToolDependency):
278
279 tools = ['libwmf-config']
280 tool_name = 'libwmf-config'
281
282 def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObjectKWs):
283 super().__init__(name, environment, kwargs)
284 if not self.is_found:
285 return
286 self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
287 self.link_args = self.get_config_value(['--libs'], 'link_args')
288
289
290 class LibGCryptDependencyConfigTool(ConfigToolDependency):
291
292 tools = ['libgcrypt-config']
293 tool_name = 'libgcrypt-config'
294
295 def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObjectKWs):
296 super().__init__(name, environment, kwargs)
297 if not self.is_found:
298 return
299 self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
300 self.link_args = self.get_config_value(['--libs'], 'link_args')
301 self.version = self.get_config_value(['--version'], 'version')[0]
302
303
304 class GpgmeDependencyConfigTool(ConfigToolDependency):
305
306 tools = ['gpgme-config']
307 tool_name = 'gpg-config'
308
309 def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObjectKWs):
310 super().__init__(name, environment, kwargs)
311 if not self.is_found:
312 return
313 self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
314 self.link_args = self.get_config_value(['--libs'], 'link_args')
315 self.version = self.get_config_value(['--version'], 'version')[0]
316
317
318 class ShadercDependency(SystemDependency):
319
320 def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObjectKWs):
321 super().__init__(name, environment, kwargs)
322
323 static_lib = 'shaderc_combined'
324 shared_lib = 'shaderc_shared'
325
326 libs = [shared_lib, static_lib]
327 if self.static:
328 libs.reverse()
329
330 cc = self.get_compiler()
331
332 for lib in libs:
333 self.link_args = cc.find_library(lib, [])
334 if self.link_args is not None:
335 self.is_found = True
336
337 if self.static and lib != static_lib:
338 mlog.warning(f'Static library {static_lib!r} not found for dependency '
339 f'{self.name!r}, may not be statically linked')
340
341 break
342
343
344 class CursesConfigToolDependency(ConfigToolDependency):
345
346 """Use the curses config tools."""
347
348 tool = 'curses-config'
349 # ncurses5.4-config is for macOS Catalina
350 tools = ['ncursesw6-config', 'ncursesw5-config', 'ncurses6-config', 'ncurses5-config', 'ncurses5.4-config']
351
352 def __init__(self, name: str, env: 'Environment', kwargs: DependencyObjectKWs):
353 exclude_paths = None
354 # macOS mistakenly ships /usr/bin/ncurses5.4-config and a man page for
355 # it, but none of the headers or libraries. Ignore /usr/bin because it
356 # can only contain this broken configtool script.
357 # Homebrew is /usr/local or /opt/homebrew.
358 if env.machines.build and env.machines.build.system == 'darwin':
359 exclude_paths = ['/usr/bin']
360 super().__init__(name, env, kwargs, exclude_paths=exclude_paths)
361 if not self.is_found:
362 return
363 self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
364 self.link_args = self.get_config_value(['--libs'], 'link_args')
365
366
367 class CursesSystemDependency(SystemDependency):
368
369 """Curses dependency the hard way.
370
371 This replaces hand rolled find_library() and has_header() calls. We
372 provide this for portability reasons, there are a large number of curses
373 implementations, and the differences between them can be very annoying.
374 """
375
376 def __init__(self, name: str, env: 'Environment', kwargs: DependencyObjectKWs):
377 super().__init__(name, env, kwargs)
378
379 candidates = [
380 ('pdcurses', ['pdcurses/curses.h']),
381 ('ncursesw', ['ncursesw/ncurses.h', 'ncurses.h']),
382 ('ncurses', ['ncurses/ncurses.h', 'ncurses/curses.h', 'ncurses.h']),
383 ('curses', ['curses.h']),
384 ]
385
386 # Not sure how else to elegantly break out of both loops
387 for lib, headers in candidates:
388 l = self.clib_compiler.find_library(lib, [])
389 if l:
390 for header in headers:
391 h = self.clib_compiler.has_header(header, '')
392 if h[0]:
393 self.is_found = True
394 self.link_args = l
395 # Not sure how to find version for non-ncurses curses
396 # implementations. The one in illumos/OpenIndiana
397 # doesn't seem to have a version defined in the header.
398 if lib.startswith('ncurses'):
399 v, _ = self.clib_compiler.get_define('NCURSES_VERSION', f'#include <{header}>', [], [self])
400 self.version = v.strip('"')
401 if lib.startswith('pdcurses'):
402 v_major, _ = self.clib_compiler.get_define('PDC_VER_MAJOR', f'#include <{header}>', [], [self])
403 v_minor, _ = self.clib_compiler.get_define('PDC_VER_MINOR', f'#include <{header}>', [], [self])
404 self.version = f'{v_major}.{v_minor}'
405
406 # Check the version if possible, emit a warning if we can't
407 req = kwargs.get('version', [])
408 if req:
409 if self.version:
410 self.is_found, *_ = mesonlib.version_compare_many(self.version, req)
411 else:
412 mlog.warning('Cannot determine version of curses to compare against.')
413
414 if self.is_found:
415 mlog.debug('Curses library:', l)
416 mlog.debug('Curses header:', header)
417 break
418 if self.is_found:
419 break
420
421
422 class IconvBuiltinDependency(BuiltinDependency):
423 def __init__(self, name: str, env: 'Environment', kwargs: DependencyObjectKWs):
424 super().__init__(name, env, kwargs)
425 self.feature_since = ('0.60.0', "consider checking for `iconv_open` with and without `find_library('iconv')`")
426 code = '''#include <iconv.h>\n\nint main() {\n iconv_open("","");\n}''' # [ignore encoding] this is C, not python, Mr. Lint
427
428 if self.clib_compiler.links(code)[0]:
429 self.is_found = True
430
431
432 class IconvSystemDependency(SystemDependency):
433 def __init__(self, name: str, env: 'Environment', kwargs: DependencyObjectKWs):
434 super().__init__(name, env, kwargs)
435 self.feature_since = ('0.60.0', "consider checking for `iconv_open` with and without find_library('iconv')")
436
437 h = self.clib_compiler.has_header('iconv.h', '')
438 self.link_args = self.clib_compiler.find_library('iconv', [], self.libtype)
439
440 if h[0] and self.link_args:
441 self.is_found = True
442
443
444 class IntlBuiltinDependency(BuiltinDependency):
445 def __init__(self, name: str, env: 'Environment', kwargs: DependencyObjectKWs):
446 super().__init__(name, env, kwargs)
447 self.feature_since = ('0.59.0', "consider checking for `ngettext` with and without `find_library('intl')`")
448 code = '''#include <libintl.h>\n\nint main() {\n gettext("Hello world");\n}'''
449
450 if self.clib_compiler.links(code)[0]:
451 self.is_found = True
452
453
454 class IntlSystemDependency(SystemDependency):
455 def __init__(self, name: str, env: 'Environment', kwargs: DependencyObjectKWs):
456 super().__init__(name, env, kwargs)
457 self.feature_since = ('0.59.0', "consider checking for `ngettext` with and without `find_library('intl')`")
458
459 h = self.clib_compiler.has_header('libintl.h', '')
460 self.link_args = self.clib_compiler.find_library('intl', [], self.libtype)
461
462 if h[0] and self.link_args:
463 self.is_found = True
464
465 if self.static:
466 if not self._add_sub_dependency(iconv_factory(env, {'static': True, 'native': self.for_machine})):
467 self.is_found = False
468
469
470 class OpensslSystemDependency(SystemDependency):
471 def __init__(self, name: str, env: 'Environment', kwargs: DependencyObjectKWs):
472 super().__init__(name, env, kwargs)
473
474 dependency_kwargs: DependencyObjectKWs = {
475 'method': DependencyMethods.SYSTEM,
476 'static': self.static,
477 'native': kwargs.get('native'),
478 }
479 if not self.clib_compiler.has_header('openssl/ssl.h', '')[0]:
480 return
481
482 # openssl >= 3 only
483 self.version = self.clib_compiler.get_define('OPENSSL_VERSION_STR', '#include <openssl/opensslv.h>', [], [self])[0]
484 # openssl < 3 only
485 if not self.version:
486 version_hex = self.clib_compiler.get_define('OPENSSL_VERSION_NUMBER', '#include <openssl/opensslv.h>', [], [self])[0]
487 if not version_hex:
488 return
489 version_hex = version_hex.rstrip('L')
490 version_ints = [((int(version_hex.rstrip('L'), 16) >> 4 + i) & 0xFF) for i in (24, 16, 8, 0)]
491 # since this is openssl, the format is 1.2.3a in four parts
492 self.version = '.'.join(str(i) for i in version_ints[:3]) + chr(ord('a') + version_ints[3] - 1)
493
494 if name == 'openssl':
495 if self._add_sub_dependency(libssl_factory(env, dependency_kwargs)) and \
496 self._add_sub_dependency(libcrypto_factory(env, dependency_kwargs)):
497 self.is_found = True
498 return
499 else:
500 self.link_args = self.clib_compiler.find_library(name.lstrip('lib'), [], self.libtype)
501 if not self.link_args:
502 return
503
504 if not self.static:
505 self.is_found = True
506 else:
507 if name == 'libssl':
508 if self._add_sub_dependency(libcrypto_factory(env, dependency_kwargs)):
509 self.is_found = True
510 elif name == 'libcrypto':
511 use_threads = self.clib_compiler.has_header_symbol('openssl/opensslconf.h', 'OPENSSL_THREADS', '', dependencies=[self])[0]
512 if not use_threads or self._add_sub_dependency(threads_factory(env, {'native': self.for_machine})):
513 self.is_found = True
514 # only relevant on platforms where it is distributed with the libc, in which case it always succeeds
515 sublib = self.clib_compiler.find_library('dl', [], self.libtype)
516 if sublib:
517 self.link_args.extend(sublib)
518
519
520 class ObjFWDependency(ConfigToolDependency):
521
522 tools = ['objfw-config']
523 tool_name = 'objfw-config'
524
525 def __init__(self, name: str, environment: 'Environment', kwargs: DependencyObjectKWs):
526 super().__init__(name, environment, kwargs)
527 self.feature_since = ('1.5.0', '')
528 if not self.is_found:
529 return
530
531 # TODO: Expose --reexport
532 # TODO: Expose --framework-libs
533 extra_flags = []
534
535 for module in kwargs.get('modules', []):
536 extra_flags.append('--package')
537 extra_flags.append(module)
538
539 # TODO: Once Meson supports adding flags per language, only add --objcflags to ObjC
540 self.compile_args = self.get_config_value(['--cppflags', '--cflags', '--objcflags'] + extra_flags, 'compile_args')
541 self.link_args = self.get_config_value(['--ldflags', '--libs'] + extra_flags, 'link_args')
542
543
544 @factory_methods({DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.SYSTEM})
545 def curses_factory(env: 'Environment',
546 kwargs: DependencyObjectKWs,
547 methods: T.List[DependencyMethods]) -> T.List['DependencyGenerator']:
548 candidates: T.List['DependencyGenerator'] = []
549 for_machine = kwargs['native']
550
551 if DependencyMethods.PKGCONFIG in methods:
552 pkgconfig_files = ['pdcurses', 'ncursesw', 'ncurses', 'curses']
553 for pkg in pkgconfig_files:
554 candidates.append(DependencyCandidate.from_dependency(
555 pkg, PkgConfigDependency, (env, kwargs)))
556
557 # There are path handling problems with these methods on msys, and they
558 # don't apply to windows otherwise (cygwin is handled separately from
559 # windows)
560 if not env.machines[for_machine].is_windows():
561 if DependencyMethods.CONFIG_TOOL in methods:
562 candidates.append(DependencyCandidate.from_dependency(
563 'curses', CursesConfigToolDependency, (env, kwargs)))
564
565 if DependencyMethods.SYSTEM in methods:
566 candidates.append(DependencyCandidate.from_dependency(
567 'curses', CursesSystemDependency, (env, kwargs)))
568
569 return candidates
570 packages['curses'] = curses_factory
571
572
573 @factory_methods({DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM})
574 def shaderc_factory(env: 'Environment',
575 kwargs: DependencyObjectKWs,
576 methods: T.List[DependencyMethods]) -> T.List['DependencyGenerator']:
577 """Custom DependencyFactory for ShaderC.
578
579 ShaderC's odd you get three different libraries from the same build
580 thing are just easier to represent as a separate function than
581 twisting DependencyFactory even more.
582 """
583 candidates: T.List['DependencyGenerator'] = []
584
585 if DependencyMethods.PKGCONFIG in methods:
586 # ShaderC packages their shared and static libs together
587 # and provides different pkg-config files for each one. We
588 # smooth over this difference by handling the static
589 # keyword before handing off to the pkg-config handler.
590 shared_libs = ['shaderc']
591 static_libs = ['shaderc_combined', 'shaderc_static']
592
593 static = kwargs.get('static')
594 if static is None:
595 static = T.cast('bool', env.coredata.optstore.get_value_for(OptionKey('prefer_static')))
596 if static:
597 c = [DependencyCandidate.from_dependency(name, PkgConfigDependency, (env, kwargs))
598 for name in static_libs + shared_libs]
599 else:
600 c = [DependencyCandidate.from_dependency(name, PkgConfigDependency, (env, kwargs))
601 for name in shared_libs + static_libs]
602 candidates.extend(c)
603
604 if DependencyMethods.SYSTEM in methods:
605 candidates.append(DependencyCandidate.from_dependency(
606 'shaderc', ShadercDependency, (env, kwargs)))
607
608 return candidates
609 packages['shaderc'] = shaderc_factory
610
611
612 packages['atomic'] = atomic_factory = DependencyFactory(
613 'atomic',
614 [DependencyMethods.SYSTEM, DependencyMethods.BUILTIN],
615 system=AtomicSystemDependency,
616 builtin=AtomicBuiltinDependency,
617 )
618
619 packages['cups'] = cups_factory = DependencyFactory(
620 'cups',
621 [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK, DependencyMethods.CMAKE],
622 configtool=CupsDependencyConfigTool,
623 cmake=DependencyCandidate.from_dependency('Cups', CMakeDependency),
624 )
625
626 packages['dl'] = dl_factory = DependencyFactory(
627 'dl',
628 [DependencyMethods.BUILTIN, DependencyMethods.SYSTEM],
629 builtin=DlBuiltinDependency,
630 system=DlSystemDependency,
631 )
632
633 packages['gpgme'] = gpgme_factory = DependencyFactory(
634 'gpgme',
635 [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL],
636 configtool=GpgmeDependencyConfigTool,
637 )
638
639 packages['libgcrypt'] = libgcrypt_factory = DependencyFactory(
640 'libgcrypt',
641 [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL],
642 configtool=LibGCryptDependencyConfigTool,
643 )
644
645 packages['libwmf'] = libwmf_factory = DependencyFactory(
646 'libwmf',
647 [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL],
648 configtool=LibWmfDependencyConfigTool,
649 )
650
651 packages['pcap'] = pcap_factory = DependencyFactory(
652 'pcap',
653 [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL],
654 configtool=PcapDependencyConfigTool,
655 pkgconfig=DependencyCandidate.from_dependency('libpcap', PkgConfigDependency),
656 )
657
658 packages['threads'] = threads_factory = DependencyFactory(
659 'threads',
660 [DependencyMethods.SYSTEM, DependencyMethods.CMAKE],
661 cmake=DependencyCandidate.from_dependency('Threads', CMakeDependency),
662 system=ThreadDependency,
663 )
664
665 packages['iconv'] = iconv_factory = DependencyFactory(
666 'iconv',
667 [DependencyMethods.BUILTIN, DependencyMethods.SYSTEM],
668 builtin=IconvBuiltinDependency,
669 system=IconvSystemDependency,
670 )
671
672 packages['intl'] = intl_factory = DependencyFactory(
673 'intl',
674 [DependencyMethods.BUILTIN, DependencyMethods.SYSTEM],
675 builtin=IntlBuiltinDependency,
676 system=IntlSystemDependency,
677 )
678
679 packages['openssl'] = openssl_factory = DependencyFactory(
680 'openssl',
681 [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM, DependencyMethods.CMAKE],
682 system=OpensslSystemDependency,
683 cmake=DependencyCandidate.from_dependency('OpenSSL', CMakeDependency, modules=['OpenSSL::Crypto', 'OpenSSL::SSL']),
684 )
685
686 packages['libcrypto'] = libcrypto_factory = DependencyFactory(
687 'libcrypto',
688 [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM, DependencyMethods.CMAKE],
689 system=OpensslSystemDependency,
690 cmake=DependencyCandidate.from_dependency('OpenSSL', CMakeDependency, modules=['OpenSSL::Crypto']),
691 )
692
693 packages['libssl'] = libssl_factory = DependencyFactory(
694 'libssl',
695 [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM, DependencyMethods.CMAKE],
696 system=OpensslSystemDependency,
697 cmake=DependencyCandidate.from_dependency('OpenSSL', CMakeDependency, modules=['OpenSSL::SSL']),
698 )
699
700 packages['objfw'] = ObjFWDependency