diff options
author | Chris Johns <chrisj@rtems.org> | 2014-02-11 10:18:35 +1100 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2014-02-11 10:18:35 +1100 |
commit | c4fefdeb551d8beb8fb8188609924d9bdf468e70 (patch) | |
tree | 577708235ad136f6ac2c6a80422ef3d4166047e0 /source-builder/sb/config.py | |
parent | config: Add support to build qemu. (diff) | |
download | rtems-source-builder-c4fefdeb551d8beb8fb8188609924d9bdf468e70.tar.bz2 |
sb: Add pkg-config support.
Add a pkg-config look alike command so packages that use pkg-config can
build if pkg-config is not present on a host.
Add support to query package config from configuration scripts.
Diffstat (limited to 'source-builder/sb/config.py')
-rw-r--r-- | source-builder/sb/config.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py index ff63b32..4da00f0 100644 --- a/source-builder/sb/config.py +++ b/source-builder/sb/config.py @@ -36,6 +36,7 @@ try: import log import options import path + import pkgconfig except KeyboardInterrupt: print 'user terminated' sys.exit(1) @@ -367,6 +368,26 @@ class file: raise error.general('shell macro failed: %s:%d: %s' % (s, exit_code, output)) return line + def _pkgconfig(self, test): + ts = test.split() + ok = False + pkg = pkgconfig.package(ts[0], output = log.output) + if len(ts) > 1 and len(ts) != 3: + self._error('malformed pkgconfig check') + else: + op = '>=' + ver = '0' + if len(ts) == 3: + op = ts[1] + ver = self.macros.expand(ts[2]) + try: + ok = pkg.check(op, ver) + except pkgconfig.error, pe: + self._error('pkgconfig: %s' % (pe)) + except: + raise error.interal('pkgconfig failure') + return ok + def _expand(self, s): expand_count = 0 expanded = True @@ -429,6 +450,13 @@ class file: s = s.replace(m, '0') expanded = True mn = None + elif m.startswith('%{pkgconfig'): + if self._pkgconfig(m[11:-1].strip()): + s = s.replace(m, '1') + else: + s = s.replace(m, '0') + expanded = True + mn = None elif m.startswith('%{?') or m.startswith('%{!?'): if m[2] == '!': start = 4 |