sb: Add support for building RTEMS 3rd party packages.

Remove the 'opt' from various macros and shell variables.

Add pkgconfig to the checks to make it clear the check is a
pkgconfig check.

Add NTP support as the first package to be built using the RSB.

Split the RTEMS URL's out from the base bset file into a separate
file that be included by other files.

Add an RTEMS BSP configuration file to help abstract the process
of building 3rd party packages.

Clean the cross and canadian cross support up so we can cleanly support
cross and canadian cross building.

Refactor the pkgconfig support and clean up the PC file handling of
loading modules.

Add support for %{?..} to return false if a macro is %{nil}.

Add %{pkgconfig ..} support to allow better control of access RTEMS
pkgconfig files.
This commit is contained in:
Chris Johns
2014-06-15 17:40:34 +12:00
parent 339f92f89f
commit 0ffee19316
24 changed files with 441 additions and 164 deletions

View File

@@ -34,6 +34,7 @@
# provided by the full pkg-config so packages can configure and build.
#
import copy
import os
import os.path
import re
@@ -72,6 +73,14 @@ class package(object):
lib_list_splitter = re.compile('[\s,]+')
loaded = {}
@staticmethod
def _copy(src, dst):
dst.name_ = src.name_
dst.file_ = src.file_
dst.defines = copy.copy(src.defines)
dst.fields = copy.copy(src.fields)
dst.nodes = copy.copy(src.nodes)
@staticmethod
def is_version(v):
for n in v.split('.'):
@@ -384,7 +393,9 @@ class package(object):
def load(self, name):
if name in package.loaded:
raise error('package already loaded: %s' % (name))
package._copy(package.loaded[name], self)
return
self._log('loading: %s' % (name))
if self.name_:
self._clean()
self.name_ = name
@@ -392,14 +403,14 @@ class package(object):
if file:
self._log('load: %s (%s)' % (name, file))
if self.src:
self.src.writelines('==%s%s' % ('=' * 80, os.linesep))
self.src.writelines(' %s %s%s' % (file, '=' * (80 - len(file)), os.linesep))
self.src.writelines('==%s%s' % ('=' * 80, os.linesep))
self.src('==%s%s' % ('=' * 80, os.linesep))
self.src(' %s %s%s' % (file, '=' * (80 - len(file)), os.linesep))
self.src('==%s%s' % ('=' * 80, os.linesep))
f = open(file)
tm = False
for l in f.readlines():
if self.src:
self.src.writelines(l)
self.src(l)
l = l[:-1]
hash = l.find('#')
if hash >= 0:
@@ -455,6 +466,7 @@ class package(object):
package.loaded[name] = self
def get(self, label, private = True):
self._log('get: %s (%s)' % (label, ','.join(self.fields)))
if label.lower() not in self.fields:
return None
s = ''
@@ -504,3 +516,46 @@ class package(object):
else:
self._log('check: %s not found' % (self.name_))
return ok
def check_package(libraries, args, output, src):
ec = 1
pkg = None
flags = { 'cflags': '',
'libs': '' }
output('libraries: %s' % (libraries))
libs = package.splitter(libraries)
for lib in libs:
output('pkg: %s' % (lib))
pkg = package(lib[0], prefix = args.prefix, output = output, src = src)
if args.dump:
output(pkg)
if pkg.exists():
if len(lib) == 1:
if args.exact_version:
if pkg.check('=', args.exact_version):
ec = 0
elif args.atleast_version:
if pkg.check('>=', args.atleast_version):
ec = 0
elif args.max_version:
if pkg.check('<=', args.max_version):
ec = 0
else:
ec = 0
else:
if len(lib) != 3:
raise error('invalid package check: %s' % (' '.join(lib)))
if pkg.check(lib[1], lib[2]):
ec = 0
if ec == 0:
cflags = pkg.get('cflags')
if cflags:
flags['cflags'] += cflags
libs = pkg.get('libs', private = False)
if libs:
flags['libs'] += libs
break
if ec > 0:
break
return ec, pkg, flags