diff options
author | Chris Johns <chrisj@rtems.org> | 2019-07-12 08:25:15 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2019-07-21 21:09:34 +1000 |
commit | 8db33fbe434267d385e637a14f38d444c72254fa (patch) | |
tree | 618a7fe3a19cf0181b54e2aafdd0063b29bf02a2 /source-builder | |
parent | sb/config: Fix GDB probes when using python-config. (diff) | |
download | rtems-source-builder-8db33fbe434267d385e637a14f38d444c72254fa.tar.bz2 |
rtems: Add kernel, libbsd and BSP building as packages.
Diffstat (limited to 'source-builder')
-rw-r--r-- | source-builder/defaults.mc | 12 | ||||
-rw-r--r-- | source-builder/sb/build.py | 21 | ||||
-rw-r--r-- | source-builder/sb/config.py | 74 |
3 files changed, 65 insertions, 42 deletions
diff --git a/source-builder/defaults.mc b/source-builder/defaults.mc index 646be78..1feaca1 100644 --- a/source-builder/defaults.mc +++ b/source-builder/defaults.mc @@ -184,7 +184,7 @@ __sed: exe, required, '/usr/bin/sed' __setup_post: exe, none, '%{__chmod} -R a+rX,g-w,o-w .' __sh: exe, required, '/bin/sh' __tar: exe, required, '/usr/bin/tar' -__tar_extract: exe, none, '%{__tar} -xvvf' +__tar_extract: exe, none, '%{__tar} -xvv' __touch: exe, required, '/usr/bin/touch' __unzip: exe, required, '/usr/bin/unzip' __xz: exe, required, '/usr/bin/xz' @@ -390,3 +390,13 @@ iso_ir_111,koi8_r,koi8_ru,koi8_u,koi8_uni,ucs_2,ucs_2_internal,\ ucs_2be,ucs_2le,ucs_4,ucs_4_internal,ucs_4be,ucs_4le,us_ascii,\ utf_16,utf_16be,utf_16le,utf_8,win_1250,win_1251,win_1252,\ win_1253,win_1254,win_1255,win_1256,win_1257,win_1258''' + +# Waf build root suffix, only use for win32 mingw ming32 OSs +# +# If on Windows we need to add the driver prefix to the built root as waf +# strips the driver prefix from the prefix path when joining it to the +# destdir path. Waf is correct in doing this and the RSB is design to match +# the configure behaviour which treats the whole path including the drive +# prefix as part of the path as just a path. +# +waf_build_root_suffix: none, none, ' %(echo %{_prefix} | cut -c 1-2)' diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py index faa11cc..abc50c0 100644 --- a/source-builder/sb/build.py +++ b/source-builder/sb/build.py @@ -203,7 +203,7 @@ class build: not _disable_installing and \ not _canadian_cross - def source(self, name): + def source(self, name, strip_components): # # Return the list of sources. Merge in any macro defined sources as # these may be overridden by user loaded macros. @@ -246,6 +246,10 @@ class build: url = self.config.expand(' '.join(url)) src = download.parse_url(url, '_sourcedir', self.config, self.opts, file_override) download.get_file(src['url'], src['local'], self.opts, self.config) + if strip_components > 0: + tar_extract = '%%{__tar_extract} --strip-components %d' % (strip_components) + else: + tar_extract = '%{__tar_extract}' if 'symlink' in src: sname = name.replace('-', '_') src['script'] = '%%{__ln_s} %s ${source_dir_%s}' % (src['symlink'], sname) @@ -255,9 +259,9 @@ class build: # src['script'] = '%s %s' % (src['compressed'], src['local']) if src['compressed-type'] != 'zip': - src['script'] += ' | %{__tar_extract} -' + src['script'] += ' | %s -f -' % (tar_extract) else: - src['script'] = '%%{__tar_extract} %s' % (src['local']) + src['script'] = '%s -f %s' % (tar_extract, src['local']) srcs += [src] return srcs @@ -266,7 +270,7 @@ class build: setup_name = args[1] args = args[1:] try: - opts, args = getopt.getopt(args[1:], 'qDcn:ba') + opts, args = getopt.getopt(args[1:], 'qDcn:bas:') except getopt.GetoptError as ge: raise error.general('source setup error: %s' % str(ge)) quiet = False @@ -276,6 +280,7 @@ class build: deleted_dir = False created_dir = False changed_dir = False + strip_components = 0 opt_name = None for o in opts: if o[0] == '-q': @@ -290,8 +295,12 @@ class build: unpack_before_chdir = True elif o[0] == '-a': unpack_before_chdir = False + elif o[0] == '-s': + if not o[1].isdigit(): + raise error.general('source setup error: invalid strip count: %s' % (o[1])) + strip_components = int(o[1]) name = None - for source in self.source(setup_name): + for source in self.source(setup_name, strip_components): if name is None: if opt_name is None: if source: @@ -301,7 +310,7 @@ class build: else: name = opt_name self.script_build.append(self.config.expand('cd %{_builddir}')) - if not deleted_dir and delete_before_unpack: + if not deleted_dir and delete_before_unpack: self.script_build.append(self.config.expand('%{__rm} -rf ' + name)) deleted_dir = True if not created_dir and create_dir: diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py index 93a74f3..2c3a13e 100644 --- a/source-builder/sb/config.py +++ b/source-builder/sb/config.py @@ -504,9 +504,9 @@ class file: if not f.startswith('-W'): fflags += [f] pkg_flags = ' '.join(fflags) - log.trace('pkgconfig: %s: %s' % (flags, pkg_flags)) + log.trace('pkgconfig: %s: %s' % (flags, pkg_flags)) except pkgconfig.error as pe: - self._error('pkgconfig: %s: %s' % (flags, pe)) + self._error('pkgconfig: %s: %s' % (flags, pe)) except: raise error.internal('pkgconfig failure') if pkg_flags is None: @@ -719,7 +719,7 @@ class file: else: if ls[1] == 'select': self.macros.lock_read_map() - log.trace('config: %s: %3d: _disable_select: %s' % (self.name, self.lc, + log.trace('config: %s: %3d: _disable_select: %s' % (self.name, self.lc, ls[1])) else: log.warning(self._name_line_msg('invalid disable statement: %s' % (ls[1]))) @@ -729,7 +729,7 @@ class file: log.warning(self._name_line_msg('invalid select statement')) else: r = self.macros.set_read_map(ls[1]) - log.trace('config: %s: %3d: _select: %s %s %r' % \ + log.trace('config: %s: %3d: _select: %s %s %r' % \ (self.name, self.lc, r, ls[1], self.macros.maps())) @@ -768,7 +768,7 @@ class file: del self.macros[mn] def _ifs(self, config, ls, label, iftrue, isvalid, dir, info): - log.trace('config: %s: %3d: _ifs[%i]: dir=%s %i %r' % \ + log.trace('config: %s: %3d: _ifs[%i]: dir=%s %i %r' % \ (self.name, self.lc, self.if_depth, str(dir), len(ls), ls)) in_dir = dir in_iftrue = True @@ -788,7 +788,7 @@ class file: self._error(label + ' without %endif') raise error.general('terminating build') if r[1] == '%endif': - log.trace('config: %s: %3d: _ifs[%i]: %%endif: dir=%s %s %s %r' % \ + log.trace('config: %s: %3d: _ifs[%i]: %%endif: dir=%s %s %s %r' % \ (self.name, self.lc, self.if_depth, str(dir), r[1], this_isvalid, data)) if in_dir is None: @@ -824,7 +824,7 @@ class file: sls = reduce(add, ls[1:], '').split() cls = sls - log.trace('config: %s: %3d: _if[%i]: %s' % (self.name, self.lc, + log.trace('config: %s: %3d: _if[%i]: %s' % (self.name, self.lc, self.if_depth, sls)) self.if_depth += 1 @@ -839,22 +839,22 @@ class file: elif cls[0] == '&&': join_op = 'and' cls = cls[1:] - log.trace('config: %s: %3d: _if[%i]: joining: %s' % (self.name, self.lc, - self.if_depth, - join_op)) + log.trace('config: %s: %3d: _if[%i]: joining: %s' % (self.name, self.lc, + self.if_depth, + join_op)) ori = 0 andi = 0 i = len(cls) if '||' in cls: ori = cls.index('||') - log.trace('config: %s: %3d: _if[%i}: OR found at %i' % (self.name, self.lc, - self.if_depth, - ori)) + log.trace('config: %s: %3d: _if[%i}: OR found at %i' % (self.name, self.lc, + self.if_depth, + ori)) if '&&' in cls: andi = cls.index('&&') - log.trace('config: %s: %3d: _if[%i]: AND found at %i' % (self.name, self.lc, - self.if_depth, - andi)) + log.trace('config: %s: %3d: _if[%i]: AND found at %i' % (self.name, self.lc, + self.if_depth, + andi)) if ori > 0 or andi > 0: if ori == 0: i = andi @@ -864,9 +864,9 @@ class file: i = andi else: i = andi - log.trace('config: %s: %3d: _if[%i]: next OP found at %i' % (self.name, self.lc, - self.if_depth, - i)) + log.trace('config: %s: %3d: _if[%i]: next OP found at %i' % (self.name, self.lc, + self.if_depth, + i)) ls = cls[:i] if len(ls) == 0: self._error('invalid if expression: ' + reduce(add, sls, '')) @@ -963,10 +963,10 @@ class file: else: cistrue = istrue - log.trace('config: %s: %3d: _if[%i]: %s %s %s %s' % (self.name, self.lc, - self.if_depth, - ifls, str(cistrue), - join_op, str(istrue))) + log.trace('config: %s: %3d: _if[%i]: %s %s %s %s' % (self.name, self.lc, + self.if_depth, + ifls, str(cistrue), + join_op, str(istrue))) if invert: cistrue = not cistrue @@ -975,8 +975,8 @@ class file: self.if_depth -= 1 - log.trace('config: %s: %3d: _if[%i]: %r' % (self.name, self.lc, - self.if_depth, ifs_return)) + log.trace('config: %s: %3d: _if[%i]: %r' % (self.name, self.lc, + self.if_depth, ifs_return)) return ifs_return @@ -1036,8 +1036,12 @@ class file: l = _clean(l) if len(l) == 0: continue - log.trace('config: %s: %0d: %s %s' % \ - (self.name, self.lc, str(isvalid), l)) + if isvalid: + indicator = '>' + else: + indicator = ' ' + log.trace('config: %s: %3d:%s%s [%s]' % \ + (self.name, self.lc, indicator, l, str(isvalid))) lo = l if isvalid: l = self._expand(l) @@ -1090,12 +1094,12 @@ class file: elif ls[0] == '%if': d = self._if(config, ls, isvalid, dir, info) if len(d): - log.trace('config: %s: %3d: %%if: %s' % (self.name, self.lc, d)) + log.trace('config: %s: %3d: %%if: %s' % (self.name, self.lc, d)) return ('data', d) elif ls[0] == '%ifn': d = self._if(config, ls, isvalid, dir, info, True) if len(d): - log.trace('config: %s: %3d: %%ifn: %s' % (self.name, self.lc, d)) + log.trace('config: %s: %3d: %%ifn: %s' % (self.name, self.lc, d)) return ('data', d) elif ls[0] == '%ifos': d = self._ifos(config, ls, isvalid, dir, info) @@ -1142,7 +1146,7 @@ class file: if isvalid: for d in self._directive: if ls[0].strip() == d: - log.trace('config: %s: %0d: _parse: directive: %s' % \ + log.trace('config: %s: %3d: _parse: directive: %s' % \ (self.name, self.lc, ls[0].strip())) return ('directive', ls[0].strip(), ls[1:]) log.warning(self._name_line_msg("unknown directive: '" + ls[0] + "'")) @@ -1176,7 +1180,7 @@ class file: return (directive, info, data) def _process_data(self, results, directive, info, data): - log.trace('config: %s: %3d: _process_data: result=#%r# directive=#%s# info=#%r# data=#%r#' % \ + log.trace('config: %s: %3d: _process_data: result=#%r# directive=#%s# info=#%r# data=#%r#' % \ (self.name, self.lc, results, directive, info, data)) new_data = [] for l in results[1]: @@ -1192,7 +1196,7 @@ class file: if not directive: l = self._expand(l) ls = self.tags.split(l, 1) - log.trace('config: %s: %3d: _tag: %s %s' % (self.name, self.lc, l, ls)) + log.trace('config: %s: %3d: _tag: %s %s' % (self.name, self.lc, l, ls)) if len(ls) > 1: info = ls[0].lower() if info[-1] == ':': @@ -1206,7 +1210,7 @@ class file: log.warning(self._name_line_msg("invalid format: '%s'" % (info_data[:-1]))) else: l = self._expand(l) - log.trace('config: %s: %3d: _data: %s %s' % (self.name, self.lc, l, new_data)) + log.trace('config: %s: %3d: _data: %s %s' % (self.name, self.lc, l, new_data)) new_data.append(l) return (directive, info, data + new_data) @@ -1222,7 +1226,7 @@ class file: self.package = _package def _directive_extend(self, dir, data): - log.trace('config: %s: %3d: _directive_extend: %s: %r' % (self.name, self.lc, dir, data)) + log.trace('config: %s: %3d: _directive_extend: %s: %r' % (self.name, self.lc, dir, data)) self._packages[self.package].directive_extend(dir, data) def _info_append(self, info, data): @@ -1295,7 +1299,7 @@ class file: raise error.general('no config file found: %s' % (cfgname)) try: - log.trace('config: %s: _open: %s' % (self.name, path.host(configname))) + log.trace('config: %s: _open: %s' % (self.name, path.host(configname))) config = open(path.host(configname), 'r') except IOError as err: raise error.general('error opening config file: %s' % (path.host(configname))) |