diff options
author | Chris Johns <chrisj@rtems.org> | 2013-07-16 10:02:41 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2013-07-16 10:02:41 +1000 |
commit | ebf8a1f0f82b35235c39b67bde9e6acc2d464dee (patch) | |
tree | 584caa96e8ee80998f9754ecf45ae13edf03636e /source-builder | |
parent | Move newlib to 14-Jul-2013. (diff) | |
download | rtems-source-builder-ebf8a1f0f82b35235c39b67bde9e6acc2d464dee.tar.bz2 |
Automtically build the Autotools to bootstrap RTEMS.
This changes adds support to build the autotools if the host installed
version is not a suitable version. Autoconf and automake have hard coded
references to the install prefix and host tools and this makes it impossible
to relocate, that is use in any path other than the install prefix. To
bootstrap automake you need to first build a suitable autoconf and with that
you can built automake for the install prefix. The other complication is
not referencing the install prefix in the path when building in the RSB.
Having the install prefix in the path can result in strange issues appearing
such as gcc using a new assembler feature not present in an older assember
installed under the install prefix.
The process is to build the autotools using an install prefix to an
internal path inside the RSB temporary path and to use that autoconf
to build the version for the install prefix. The internal install
prefix version is also used to bootstrap RTEMS.
Diffstat (limited to 'source-builder')
-rw-r--r-- | source-builder/config/autoconf-2-1.cfg | 14 | ||||
-rw-r--r-- | source-builder/config/automake-1-1.cfg | 16 | ||||
-rw-r--r-- | source-builder/config/versions.cfg | 12 | ||||
-rw-r--r-- | source-builder/defaults.mc | 7 | ||||
-rw-r--r-- | source-builder/sb/build.py | 83 | ||||
-rw-r--r-- | source-builder/sb/config.py | 8 | ||||
-rw-r--r-- | source-builder/sb/options.py | 2 | ||||
-rw-r--r-- | source-builder/sb/setbuilder.py | 67 |
8 files changed, 122 insertions, 87 deletions
diff --git a/source-builder/config/autoconf-2-1.cfg b/source-builder/config/autoconf-2-1.cfg index 51e683d..48fd542 100644 --- a/source-builder/config/autoconf-2-1.cfg +++ b/source-builder/config/autoconf-2-1.cfg @@ -31,16 +31,14 @@ VersionControl0: git clone git://git.sv.gnu.org/autoconf cd .. %build - if test "%{_internal_autotools}" == "yes"; then - export PATH="%{_bindir}:${PATH}" - else - export PATH=$SB_ORIG_PATH - fi + %if %{defined _internal_autotools_path} + export PATH="%{_internal_autotools_path}/bin:${PATH}" + %endif cd autoconf-%{autoconf_version} if test "%{_internal_autotools}" == "yes"; then - ac_prefix=$SB_TMPPREFIX + ac_prefix=%{_internal_autotools_path} else ac_prefix=%{_prefix} fi @@ -65,11 +63,11 @@ VersionControl0: git clone git://git.sv.gnu.org/autoconf %install export PATH="%{_bindir}:${PATH}" - rm -rf $SB_BUILD_ROOT + %{__rmdir} $SB_BUILD_ROOT cd autoconf-%{autoconf_version} - if "%{_internal_autotools}" == "yes"; then + if test "%{_internal_autotools}" == "yes"; then %{__make} install else %{__make} DESTDIR=$SB_BUILD_ROOT install diff --git a/source-builder/config/automake-1-1.cfg b/source-builder/config/automake-1-1.cfg index 8a52661..6ad4bd5 100644 --- a/source-builder/config/automake-1-1.cfg +++ b/source-builder/config/automake-1-1.cfg @@ -31,22 +31,20 @@ VersionControl0: git clone git://git.savannah.gnu.org/automake.git cd .. %build - if test "%{_internal_autotools}" == "yes"; then - export PATH="%{_bindir}:${PATH}" - else - export PATH=$SB_ORIG_PATH - fi + %if %{defined _internal_autotools_path} + export PATH="%{_internal_autotools_path}/bin:${PATH}" + %endif cd automake-%{automake_version} if test "%{_internal_autotools}" == "yes"; then - am_prefix=$SB_TMPPREFIX + am_prefix=%{_internal_autotools_path} else am_prefix=%{_prefix} fi if test "%{_build}" != "%{_host}" ; then - CFLAGS_FOR_BUILD="-g -O2 -Wall" + CFLAGS_FOR_BUILD="-g -O2 -Wall" fi export CFLAGS CFLAGS_FOR_BUILD CC @@ -64,11 +62,11 @@ VersionControl0: git clone git://git.savannah.gnu.org/automake.git %install export PATH="%{_bindir}:${PATH}" - rm -rf $SB_BUILD_ROOT + %{__rmdir} $SB_BUILD_ROOT cd automake-%{automake_version} - if "%{_internal_autotools}" == "yes"; then + if test "%{_internal_autotools}" == "yes"; then %{__make} install else %{__make} DESTDIR=$SB_BUILD_ROOT install diff --git a/source-builder/config/versions.cfg b/source-builder/config/versions.cfg index 0e574ff..ee0a657 100644 --- a/source-builder/config/versions.cfg +++ b/source-builder/config/versions.cfg @@ -1,7 +1,9 @@ # Generate version strings. -%define __makeinfo_ver %(%{__makeinfo} --version | %{__awk} 'NR==1 {print $NF}') -%define __autoconf_ver %(%{__autoconf} --version | %{__awk} 'NR==1 {print $NF}') -%define __automake_ver %(%{__automake} --version | %{__awk} 'NR==1 {print $NF}') - - +%define __makeinfo_ver %(test -x %{__makeinfo} && %{__makeinfo} --version | %{__awk} 'NR==1 {print $NF}' || echo "0") +%define __autoconf_ver %(test -x %{__autoconf} && %{__autoconf} --version | %{__awk} 'NR==1 {print $NF}' || echo "0") +%define __autoconf_bindir_ver %(test -x %{_bindir}/autoconf && %{_bindir}/autoconf --version | %{__awk} 'NR==1 {print $NF}' || echo "0") +%define __autoreconf_ver %(test -x %{__autoreconf} && %{__autoreconf} --version | %{__awk} 'NR==1 {print $NF}' || echo "0") +%define __autoreconf_bindir_ver %(test -x %{_bindir}/autoreconf && %{_bindir}/autoreconf --version | %{__awk} 'NR==1 {print $NF}' || echo "0") +%define __automake_ver %(test -x %{__automake} && %{__automake} --version | %{__awk} 'NR==1 {print $NF}' || echo "0") +%define __automake_bindir_ver %(test -x %{_bindir}/automake && %{_bindir}/automake --version | %{__awk} 'NR==1 {print $NF}' || echo "0") diff --git a/source-builder/defaults.mc b/source-builder/defaults.mc index 20a3f0c..bfb4665 100644 --- a/source-builder/defaults.mc +++ b/source-builder/defaults.mc @@ -106,9 +106,10 @@ __aclocal: exe, optional, 'aclocal' __ar: exe, required, 'ar' __arch_install_post: exe, none, '%{nil}' __as: exe, required, 'as' -__autoconf: exe, required, 'autoconf' -__autoheader: exe, required, 'autoheader' -__automake: exe, required, 'automake' +__autoconf: exe, optional, 'autoconf' +__autoheader: exe, optional, 'autoheader' +__automake: exe, optional, 'automake' +__autoreconf: exe, optional, 'autoreconf' __awk: exe, required, 'awk' __bash: exe, optional, '/bin/bash' __bison: exe, required, '/usr/bin/bison' diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py index 8b6ae35..c9ff07a 100644 --- a/source-builder/sb/build.py +++ b/source-builder/sb/build.py @@ -273,14 +273,15 @@ class build: def prep(self, package): self.script.append('echo "==> %prep:"') _prep = package.prep() - for l in _prep: - args = l.split() - if args[0] == '%setup': - self.setup(package, args) - elif args[0].startswith('%patch'): - self.patch(package, args) - else: - self.script.append(' '.join(args)) + if _prep: + for l in _prep: + args = l.split() + if args[0] == '%setup': + self.setup(package, args) + elif args[0].startswith('%patch'): + self.patch(package, args) + else: + self.script.append(' '.join(args)) def build(self, package): self.script.append('echo "==> clean %{buildroot}: ${SB_BUILD_ROOT}"') @@ -290,18 +291,21 @@ class build: (self.config.expand('%{__mkdir_p}'))) self.script.append('echo "==> %build:"') _build = package.build() - for l in _build: - self.script.append(l) + if _build: + for l in _build: + self.script.append(l) def install(self, package): self.script.append('echo "==> %install:"') _install = package.install() - for l in _install: - args = l.split() - self.script.append(' '.join(args)) + if _install: + for l in _install: + args = l.split() + self.script.append(' '.join(args)) def files(self, package): - if self.create_tar_files: + if self.create_tar_files \ + and not self.macros.get('%{_disable_packaging'): self.script.append('echo "==> %files:"') inpath = path.abspath(self.config.expand('%{buildroot}')) tardir = path.abspath(self.config.expand('%{_tardir}')) @@ -335,7 +339,8 @@ class build: self.clean(package) def cleanup(self): - if not self.opts.no_clean(): + package = self.main_package() + if not package.disabled() and not self.opts.no_clean(): buildroot = self.config.abspath('buildroot') builddir = self.config.abspath('_builddir') buildcxcdir = self.config.abspath('_buildcxcdir') @@ -356,35 +361,43 @@ class build: def make(self): package = self.main_package() - name = package.name() - if self.canadian_cross(): - log.notice('package: (Cxc) %s' % (name)) + if package.disabled(): + log.notice('package: nothing to build') else: - log.notice('package: %s' % (name)) - log.trace('---- macro maps %s' % ('-' * 55)) - log.trace('%s' % (str(self.config.macros))) - log.trace('-' * 70) - self.script.reset() - self.script.append(self.config.expand('%{___build_template}')) - self.script.append('echo "=> ' + name + ':"') - self.prep(package) - self.build_package(package) - if not self.opts.dry_run(): - self.builddir() - sn = path.join(self.config.expand('%{_builddir}'), 'doit') - log.output('write script: ' + sn) - self.script.write(sn) + name = package.name() if self.canadian_cross(): - log.notice('building: (Cxc) %s' % (name)) + log.notice('package: (Cxc) %s' % (name)) else: - log.notice('building: %s' % (name)) - self.run(sn) + log.notice('package: %s' % (name)) + log.trace('---- macro maps %s' % ('-' * 55)) + log.trace('%s' % (str(self.config.macros))) + log.trace('-' * 70) + self.script.reset() + self.script.append(self.config.expand('%{___build_template}')) + self.script.append('echo "=> ' + name + ':"') + self.prep(package) + self.build_package(package) + if not self.opts.dry_run(): + self.builddir() + sn = path.join(self.config.expand('%{_builddir}'), 'doit') + log.output('write script: ' + sn) + self.script.write(sn) + if self.canadian_cross(): + log.notice('building: (Cxc) %s' % (name)) + else: + log.notice('building: %s' % (name)) + self.run(sn) def name(self): packages = self.config.packages() package = packages['main'] return package.name() + def disabled(self): + packages = self.config.packages() + package = packages['main'] + return package.disabled() + def get_configs(opts): def _scan(_path, ext): diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py index 9838a10..1d55eeb 100644 --- a/source-builder/sb/config.py +++ b/source-builder/sb/config.py @@ -203,6 +203,9 @@ class package: def long_name(self): return self.name() + def disabled(self): + return len(self.name()) == 0 + class file: """Parse a config file.""" @@ -540,6 +543,11 @@ class file: return text if r[1] == '%else': in_iftrue = False + elif r[0] == 'directive': + if r[1] == '%include': + self.load(r[2][0]) + else: + log.warning("directive not supported in if: '%s'" % (' '.join(r[2]))) elif r[0] == 'data': if this_isvalid: text.extend(r[1]) diff --git a/source-builder/sb/options.py b/source-builder/sb/options.py index cf05935..4977172 100644 --- a/source-builder/sb/options.py +++ b/source-builder/sb/options.py @@ -523,6 +523,8 @@ def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc'): o.process() o.post_process() + log.notice(' '.join(args)) + return o def run(args): diff --git a/source-builder/sb/setbuilder.py b/source-builder/sb/setbuilder.py index 3399d2d..00bcec3 100644 --- a/source-builder/sb/setbuilder.py +++ b/source-builder/sb/setbuilder.py @@ -99,7 +99,9 @@ class buildset: raise error.general('copying tree: %s' % (str(err))) def report(self, _config, _build): - if not _build.opts.get_arg('--no-report') and _build.opts.get_arg('--mail'): + if not _build.opts.get_arg('--no-report') \ + and not _build.macros.get('%{_disable_reporting}') \ + and _build.opts.get_arg('--mail'): format = _build.opts.get_arg('--report-format') if format is None: format = 'html' @@ -172,20 +174,24 @@ class buildset: _build.make() for m in macros_to_save: _build.config.set_define(m, orig_macros[m]) - self.root_copy(_build.config.expand('%{buildcxcroot}'), - _build.config.expand('%{_tmpcxcroot}')) + if not _build.macros.get('%{_disable_collecting}'): + self.root_copy(_build.config.expand('%{buildcxcroot}'), + _build.config.expand('%{_tmpcxcroot}')) def build_package(self, _config, _build): - if _build.canadian_cross(): - self.canadian_cross(_build) - _build.make() - self.report(_config, _build) - self.root_copy(_build.config.expand('%{buildroot}'), - _build.config.expand('%{_tmproot}')) + if not _build.disabled(): + if _build.canadian_cross(): + self.canadian_cross(_build) + _build.make() + self.report(_config, _build) + if not _build.macros.get('%{_disable_collecting}'): + self.root_copy(_build.config.expand('%{buildroot}'), + _build.config.expand('%{_tmproot}')) def bset_tar(self, _build): tardir = _build.config.expand('%{_tardir}') - if self.opts.get_arg('--bset-tar-file'): + if self.opts.get_arg('--bset-tar-file') \ + and not _build.macros.get('%{_disable_packaging}'): path.mkdir(tardir) tar = path.join(tardir, _build.config.expand('%s.tar.bz2' % (self.bset_pkg))) log.notice('tarball: %s' % (os.path.relpath(path.host(tar)))) @@ -306,6 +312,7 @@ class buildset: try: builds = [] for s in range(0, len(configs)): + b = None try: # # Each section of the build set gets a separate set of @@ -334,30 +341,36 @@ class buildset: else: raise error.general('invalid config type: %s' % (configs[s])) except error.general, gerr: - if self.build_failure is None: - self.build_failure = b.name() - self.write_mail_header('') - self.write_mail_header('= ' * 40) - self.write_mail_header('Build FAILED: %s' % (b.name())) - self.write_mail_header('- ' * 40) - self.write_mail_header(str(log.default)) - self.write_mail_header('- ' * 40) - if self.opts.keep_going(): - print gerr - if self.opts.always_clean(): - builds += [b] + if b is not None: + if self.build_failure is None: + self.build_failure = b.name() + self.write_mail_header('') + self.write_mail_header('= ' * 40) + self.write_mail_header('Build FAILED: %s' % (b.name())) + self.write_mail_header('- ' * 40) + self.write_mail_header(str(log.default)) + self.write_mail_header('- ' * 40) + if self.opts.keep_going(): + print gerr + if self.opts.always_clean(): + builds += [b] + else: + raise else: raise if deps is None and not self.opts.no_install(): for b in builds: - self.install(b.name(), - b.config.expand('%{buildroot}'), - b.config.expand('%{_prefix}')) + if not b.disabled() \ + and not b.macros.get('%{_disable_installing}'): + self.install(b.name(), + b.config.expand('%{buildroot}'), + b.config.expand('%{_prefix}')) if deps is None and \ (not self.opts.no_clean() or self.opts.always_clean()): for b in builds: - log.notice('cleaning: %s' % (b.name())) - b.cleanup() + if not b.disabled(): + log.notice('cleaning: %s' % (b.name())) + b.cleanup() for b in builds: del b except error.general, gerr: |