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 | |
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.
33 files changed, 240 insertions, 104 deletions
diff --git a/rtems/config/4.11/rtems-arm.bset b/rtems/config/4.11/rtems-arm.bset index 4b90413..41b5e77 100644 --- a/rtems/config/4.11/rtems-arm.bset +++ b/rtems/config/4.11/rtems-arm.bset @@ -31,6 +31,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-autotools-base.bset b/rtems/config/4.11/rtems-autotools-base.bset new file mode 100644 index 0000000..fb446d4 --- /dev/null +++ b/rtems/config/4.11/rtems-autotools-base.bset @@ -0,0 +1,23 @@ +# +# Tools Set for RTEMS 4.11 Internal Autotools Stable +# + +%define release 1 + +%define rtems_arch none + +# +# The RTEMS 4.11 base defines. +# +%include rtems-4.11-base.bset + +# +# The autotools package. +# +package: rtems-%{rtems_version}-autotools-%{release} + +# +# Tools configuration. +# +tools/rtems-autoconf-2.69-1 +tools/rtems-automake-1.12.6-1 diff --git a/rtems/config/4.11/rtems-autotools-internal.bset b/rtems/config/4.11/rtems-autotools-internal.bset new file mode 100644 index 0000000..d70dc80 --- /dev/null +++ b/rtems/config/4.11/rtems-autotools-internal.bset @@ -0,0 +1,13 @@ +# +# Tools Set for RTEMS 4.11 Internal Autotools Stable +# +# Do not use via the command line. +# + +%define _internal_autotools yes +%define _disable_collecting yes +%define _disable_packaging yes +%define _disable_reporting yes +%define _disable_installing yes + +%include 4.11/rtems-autotools-base.bset diff --git a/rtems/config/4.11/rtems-autotools.bset b/rtems/config/4.11/rtems-autotools.bset index cf71f8d..2eeffb7 100644 --- a/rtems/config/4.11/rtems-autotools.bset +++ b/rtems/config/4.11/rtems-autotools.bset @@ -1,23 +1,22 @@ # # Tools Set for RTEMS 4.11 Autotools Stable # - -%define release 1 - -%define rtems_arch none - +# Autoconf and automake are not relocatable and cannot be cross-compiled. +# RTEMS uses autoconf and automake and building RTEMS in the RSB requires +# bootstrapping and this requires a current autoconf and automake. The RSB +# provides to support by: # -# The RTEMS 4.11 base defines. +# 1. Building and installing autoconf and automake with a prefix to a +# temporary internal path. +# 2. Using the temporary internal build, build and install another copy +# using the final prefix location. # -%include rtems-4.11-base.bset # -# The autotoolspackage. +# A magic internal path that would break if changes in the defaults.mc +# macro file are made. # -package: rtems-%{rtems_version}-autotools-%{release} +%define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN} -# -# Tools configuration. -# -devel/autoconf-2.69-1 -devel/automake-1.12.6-1 +4.11/rtems-autotools-internal +4.11/rtems-autotools-base diff --git a/rtems/config/4.11/rtems-avr.bset b/rtems/config/4.11/rtems-avr.bset index 3ad25e2..735dc92 100644 --- a/rtems/config/4.11/rtems-avr.bset +++ b/rtems/config/4.11/rtems-avr.bset @@ -38,6 +38,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-bfin.bset b/rtems/config/4.11/rtems-bfin.bset index f9bb5a3..5f883b6 100644 --- a/rtems/config/4.11/rtems-bfin.bset +++ b/rtems/config/4.11/rtems-bfin.bset @@ -20,6 +20,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-h8300.bset b/rtems/config/4.11/rtems-h8300.bset index 2179bcc..3074181 100644 --- a/rtems/config/4.11/rtems-h8300.bset +++ b/rtems/config/4.11/rtems-h8300.bset @@ -20,6 +20,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-i386.bset b/rtems/config/4.11/rtems-i386.bset index 77be484..3860fb0 100644 --- a/rtems/config/4.11/rtems-i386.bset +++ b/rtems/config/4.11/rtems-i386.bset @@ -24,6 +24,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-lm32.bset b/rtems/config/4.11/rtems-lm32.bset index 9f1941c..cbf5524 100644 --- a/rtems/config/4.11/rtems-lm32.bset +++ b/rtems/config/4.11/rtems-lm32.bset @@ -25,6 +25,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.5.3-newlib-2.0.0-1 diff --git a/rtems/config/4.11/rtems-m32c.bset b/rtems/config/4.11/rtems-m32c.bset index 03490b1..765c050 100644 --- a/rtems/config/4.11/rtems-m32c.bset +++ b/rtems/config/4.11/rtems-m32c.bset @@ -34,6 +34,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-m32r.bset b/rtems/config/4.11/rtems-m32r.bset index 87be740..5991283 100644 --- a/rtems/config/4.11/rtems-m32r.bset +++ b/rtems/config/4.11/rtems-m32r.bset @@ -20,6 +20,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-m68k.bset b/rtems/config/4.11/rtems-m68k.bset index 148e93a..2f470d0 100644 --- a/rtems/config/4.11/rtems-m68k.bset +++ b/rtems/config/4.11/rtems-m68k.bset @@ -21,6 +21,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-microblaze.bset b/rtems/config/4.11/rtems-microblaze.bset index da8cd0e..eac2ea1 100644 --- a/rtems/config/4.11/rtems-microblaze.bset +++ b/rtems/config/4.11/rtems-microblaze.bset @@ -25,6 +25,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-mips.bset b/rtems/config/4.11/rtems-mips.bset index 7fef992..d6cf3d8 100644 --- a/rtems/config/4.11/rtems-mips.bset +++ b/rtems/config/4.11/rtems-mips.bset @@ -20,6 +20,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-moxie.bset b/rtems/config/4.11/rtems-moxie.bset index b3058df..edaa901 100644 --- a/rtems/config/4.11/rtems-moxie.bset +++ b/rtems/config/4.11/rtems-moxie.bset @@ -26,6 +26,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 devel/dtc-1.2.0 tools/rtems-binutils-2.23.2-1 diff --git a/rtems/config/4.11/rtems-nios2.bset b/rtems/config/4.11/rtems-nios2.bset index 969fcdc..602a853 100644 --- a/rtems/config/4.11/rtems-nios2.bset +++ b/rtems/config/4.11/rtems-nios2.bset @@ -22,6 +22,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-nios2-binutils-2.20-1 tools/rtems-nios2-gcc-4.1-newlib-1.19.0-1 diff --git a/rtems/config/4.11/rtems-powerpc.bset b/rtems/config/4.11/rtems-powerpc.bset index 6355dff..8d0158a 100644 --- a/rtems/config/4.11/rtems-powerpc.bset +++ b/rtems/config/4.11/rtems-powerpc.bset @@ -20,6 +20,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-sh.bset b/rtems/config/4.11/rtems-sh.bset index b38b12b..bc48b70 100644 --- a/rtems/config/4.11/rtems-sh.bset +++ b/rtems/config/4.11/rtems-sh.bset @@ -20,6 +20,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-sparc.bset b/rtems/config/4.11/rtems-sparc.bset index bb1a7b7..6824d21 100644 --- a/rtems/config/4.11/rtems-sparc.bset +++ b/rtems/config/4.11/rtems-sparc.bset @@ -20,6 +20,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-sparc64.bset b/rtems/config/4.11/rtems-sparc64.bset index 9088b97..c2ac589 100644 --- a/rtems/config/4.11/rtems-sparc64.bset +++ b/rtems/config/4.11/rtems-sparc64.bset @@ -20,6 +20,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/4.11/rtems-v850.bset b/rtems/config/4.11/rtems-v850.bset index 4fb0aab..e1a9988 100644 --- a/rtems/config/4.11/rtems-v850.bset +++ b/rtems/config/4.11/rtems-v850.bset @@ -20,6 +20,7 @@ # # Tools configuration. # +4.11/rtems-autotools devel/expat-2.1.0-1 tools/rtems-binutils-2.23.2-1 tools/rtems-gcc-4.8.1-newlib-cvs-1 diff --git a/rtems/config/tools/rtems-autoconf-2.69-1.cfg b/rtems/config/tools/rtems-autoconf-2.69-1.cfg new file mode 100644 index 0000000..1db8746 --- /dev/null +++ b/rtems/config/tools/rtems-autoconf-2.69-1.cfg @@ -0,0 +1,19 @@ +# +# Autoconf 2.69. +# + +%include %{_configdir}/checks.cfg +%include %{_configdir}/base.cfg +%include %{_configdir}/versions.cfg + +%define rtems_autoconf_version 2.69 + +# +# Check the version of autoconf in the path. +# +%if %{__autoconf_ver} < %{rtems_autoconf_version} + # + # Tools configuration. + # + %include %{_configdir}/devel/autoconf-2.69-1.cfg +%endif diff --git a/rtems/config/tools/rtems-automake-1.12.6-1.cfg b/rtems/config/tools/rtems-automake-1.12.6-1.cfg new file mode 100644 index 0000000..1585cf4 --- /dev/null +++ b/rtems/config/tools/rtems-automake-1.12.6-1.cfg @@ -0,0 +1,19 @@ +# +# Automake 1.12.6 +# + +%include %{_configdir}/checks.cfg +%include %{_configdir}/base.cfg +%include %{_configdir}/versions.cfg + +%define rtems_automake_version 1.12.6 + +# +# Check the version of automake in the path. +# +%if %{__automake_ver} < %{rtems_automake_version} + # + # Tools configuration. + # + %include %{_configdir}/devel/automake-1.12.6-1.cfg +%endif diff --git a/rtems/config/tools/rtems-kernel-4-1.cfg b/rtems/config/tools/rtems-kernel-4-1.cfg index 0cec85d..d22f9c2 100644 --- a/rtems/config/tools/rtems-kernel-4-1.cfg +++ b/rtems/config/tools/rtems-kernel-4-1.cfg @@ -74,6 +74,9 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n) %{?patch8:%patch8 %{?patch8_opts:%{patch8_opts}}%{!?patch8_opts:-p1}} %{?patch9:%patch9 %{?patch9_opts:%{patch9_opts}}%{!?patch9_opts:-p1}} %if %{rtems_bootstrap} + %if %{defined _internal_autotools_path} + export PATH="%{_internal_autotools_path}/bin:${PATH}" + %endif ./bootstrap -c %{_sbdir}/sb-bootstrap --preinstall %{_sbdir}/sb-bootstrap diff --git a/rtems/config/tools/rtems-kernel-4.11.cfg b/rtems/config/tools/rtems-kernel-4.11.cfg index 0eb6272..dd010e3 100644 --- a/rtems/config/tools/rtems-kernel-4.11.cfg +++ b/rtems/config/tools/rtems-kernel-4.11.cfg @@ -9,13 +9,20 @@ %define rtems_kernel_version 4.11 # -# Check the version of autoconf. +# Check the version of autoconf. Check autoreconf as it is used. # -%if %{__autoconf_ver} <= 2.68 - %error Autoconf version 2.69 or higher is needed. +%if %{__autoreconf_ver} <= 2.68 + %if %{__autoreconf_bindir_ver} <= 2.68 + %error Autoconf (autoreconf) version 2.69 or higher is needed. + %endif %endif # +# A magic internal path that would break if changes in the defaults.mc +# macro file are made. +# +%define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN} +# # Pull the latest changes from git each build. Override if this is not what you # want. # 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: |