summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2013-04-01 15:19:56 +1100
committerChris Johns <chrisj@rtems.org>2013-04-01 15:19:56 +1100
commit4f26bdb2f0372abc1273f16594e9ac1fd96e0559 (patch)
treef904e09cfe49b15b35b66d96a934a139c497a132
parentAdd which type of hosts work. Some 32bit hosts have issues. (diff)
downloadrtems-source-builder-4f26bdb2f0372abc1273f16594e9ac1fd96e0559.tar.bz2
Add Canadian Cross support.
Add support to build MinGW tools using Cygwin. This is a Canadian cross build. Do not expand the directives when parsing a configuration file. Hold in the package object the text as read from the configuration file. Still parse the logic but leave the macros. This allows a configuration to be varied when the build happens. The Canadian cross uses this to build a build compiler used to build a Cxc runtime. Add Cxc support to the build module. In the defaults add rm and rmfile macros, add Cxc paths and pre-build script code. In the setbuilder check for a Cxc build and if so and the package allow Cxc build the build host version then the host target version. Add cygiwn support to the defaults processing and to the Windows module.
-rw-r--r--rtems/config/tools/rtems-binutils-2.20.1-1.cfg3
-rw-r--r--rtems/config/tools/rtems-gcc-4.3.2-newlib-1.16.0-1.cfg8
-rw-r--r--rtems/config/tools/rtems-gcc-4.4.7-newlib-1.18.0-1.cfg20
-rw-r--r--rtems/config/tools/rtems-gcc-4.5.3-newlib-2.0.0-1.cfg8
-rw-r--r--rtems/config/tools/rtems-gcc-4.6.3-newlib-1.20.0-1.cfg28
-rw-r--r--rtems/config/tools/rtems-gcc-4.7.2-newlib-1.20.0-1.cfg30
-rw-r--r--rtems/config/tools/rtems-gcc-4.7.2-newlib-2.0.0-1.cfg10
-rw-r--r--rtems/config/tools/rtems-gcc-4.8-ss-newlib-2.0.0-1.cfg4
-rw-r--r--source-builder/config/autoconf-2-1.cfg18
-rw-r--r--source-builder/config/autoconf-2.69-1.cfg2
-rw-r--r--source-builder/config/automake-1-1.cfg18
-rw-r--r--source-builder/config/binutils-2-1.cfg37
-rw-r--r--source-builder/config/checks.cfg15
-rw-r--r--source-builder/config/dtc-1-1.cfg24
-rw-r--r--source-builder/config/dtc-1.2.0.cfg2
-rw-r--r--source-builder/config/expat-2-1.cfg20
-rw-r--r--source-builder/config/gcc-4.3-1.cfg169
-rw-r--r--source-builder/config/gcc-4.4-1.cfg153
-rw-r--r--source-builder/config/gcc-4.5-1.cfg169
-rw-r--r--source-builder/config/gcc-4.6-1.cfg151
-rw-r--r--source-builder/config/gcc-4.7-1.cfg169
-rw-r--r--source-builder/config/gcc-4.8-1.cfg172
-rw-r--r--source-builder/config/gcc-common-1.cfg166
-rw-r--r--source-builder/config/gdb-7-1.cfg33
-rw-r--r--source-builder/sb/build.py50
-rw-r--r--source-builder/sb/config.py87
-rw-r--r--source-builder/sb/defaults.py54
-rwxr-xr-xsource-builder/sb/execute.py6
-rw-r--r--source-builder/sb/setbuilder.py100
-rw-r--r--source-builder/sb/windows.py38
30 files changed, 563 insertions, 1201 deletions
diff --git a/rtems/config/tools/rtems-binutils-2.20.1-1.cfg b/rtems/config/tools/rtems-binutils-2.20.1-1.cfg
index 21272e9..172d2b2 100644
--- a/rtems/config/tools/rtems-binutils-2.20.1-1.cfg
+++ b/rtems/config/tools/rtems-binutils-2.20.1-1.cfg
@@ -8,6 +8,9 @@
%define binutils_version 2.20.1
Patch0: %{rtems_binutils_patches}/binutils-2.20.1-rtems4.10-20100826.diff
+%ifos win32 mingw ming32 cygwin
+ Patch1: %{rtems_binutils_patches}/cygwin/binutils-2.20.1-cygwin-w64-20130324.diff
+%endif
#
# RTEMS Build Set patches.
diff --git a/rtems/config/tools/rtems-gcc-4.3.2-newlib-1.16.0-1.cfg b/rtems/config/tools/rtems-gcc-4.3.2-newlib-1.16.0-1.cfg
index 83773ad..f115447 100644
--- a/rtems/config/tools/rtems-gcc-4.3.2-newlib-1.16.0-1.cfg
+++ b/rtems/config/tools/rtems-gcc-4.3.2-newlib-1.16.0-1.cfg
@@ -15,14 +15,6 @@
%define with_plugin 0
%define with_iconv 0
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
-%ifn %{defined enable_obsolete}
-%define enable_obsolete 0
-%endif
-
#
# The RTEMS 4.9 patches
#
diff --git a/rtems/config/tools/rtems-gcc-4.4.7-newlib-1.18.0-1.cfg b/rtems/config/tools/rtems-gcc-4.4.7-newlib-1.18.0-1.cfg
index 36e1861..6035486 100644
--- a/rtems/config/tools/rtems-gcc-4.4.7-newlib-1.18.0-1.cfg
+++ b/rtems/config/tools/rtems-gcc-4.4.7-newlib-1.18.0-1.cfg
@@ -2,6 +2,14 @@
# GCC 4.4.7, Newlib 1.18.0
#
+#
+# M32C C++ does not work.
+# gcc-4.4.7/libstdc++-v3/src/mt_allocator.cc:76: error: cast from 'void*' to 'size_t' loses precision
+#
+%if %{_target} == m32c-rtems4.10
+%define enable_cxx 0
+%endif
+
%include %{_configdir}/checks.cfg
%include %{_configdir}/base.cfg
@@ -16,18 +24,6 @@
%define with_iconv 1
#
-# M32C C++ does not work.
-# gcc-4.4.7/libstdc++-v3/src/mt_allocator.cc:76: error: cast from 'void*' to 'size_t' loses precision
-#
-%if %{_target} == m32c-rtems4.10
-%define enable_cxx 0
-%endif
-
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
-#
# The RTEMS 4.10 patches
#
Patch0: %{rtems_gcc_patches}/gcc-core-4.4.7-rtems4.10-20120314.diff
diff --git a/rtems/config/tools/rtems-gcc-4.5.3-newlib-2.0.0-1.cfg b/rtems/config/tools/rtems-gcc-4.5.3-newlib-2.0.0-1.cfg
index 683393a..41c0fe1 100644
--- a/rtems/config/tools/rtems-gcc-4.5.3-newlib-2.0.0-1.cfg
+++ b/rtems/config/tools/rtems-gcc-4.5.3-newlib-2.0.0-1.cfg
@@ -15,14 +15,6 @@
%define with_plugin 0
%define with_iconv 1
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
-%ifn %{defined enable_obsolete}
-%define enable_obsolete 0
-%endif
-
#
# Libiberty strsignal fix
#
diff --git a/rtems/config/tools/rtems-gcc-4.6.3-newlib-1.20.0-1.cfg b/rtems/config/tools/rtems-gcc-4.6.3-newlib-1.20.0-1.cfg
index 5d78587..8a73626 100644
--- a/rtems/config/tools/rtems-gcc-4.6.3-newlib-1.20.0-1.cfg
+++ b/rtems/config/tools/rtems-gcc-4.6.3-newlib-1.20.0-1.cfg
@@ -2,19 +2,6 @@
# GCC 4.6.3, Newlib 1.20.0
#
-%include %{_configdir}/checks.cfg
-%include %{_configdir}/base.cfg
-
-%define gcc_version 4.6.3
-%define newlib_version 1.20.0
-%define mpfr_version 3.0.1
-%define mpc_version 0.8.2
-%define gmp_version 5.0.5
-
-%define with_threads 1
-%define with_plugin 0
-%define with_iconv 1
-
#
# AVR C++ does not work.
# configure: error: unable to detect exception model
@@ -31,9 +18,18 @@
%define enable_cxx 0
%endif
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
+%include %{_configdir}/checks.cfg
+%include %{_configdir}/base.cfg
+
+%define gcc_version 4.6.3
+%define newlib_version 1.20.0
+%define mpfr_version 3.0.1
+%define mpc_version 0.8.2
+%define gmp_version 5.0.5
+
+%define with_threads 1
+%define with_plugin 0
+%define with_iconv 1
#
# The RTEMS 4.11 patches
diff --git a/rtems/config/tools/rtems-gcc-4.7.2-newlib-1.20.0-1.cfg b/rtems/config/tools/rtems-gcc-4.7.2-newlib-1.20.0-1.cfg
index 04d2f97..18bb1b7 100644
--- a/rtems/config/tools/rtems-gcc-4.7.2-newlib-1.20.0-1.cfg
+++ b/rtems/config/tools/rtems-gcc-4.7.2-newlib-1.20.0-1.cfg
@@ -2,19 +2,6 @@
# GCC 4.7.2., Newlib 1.20.0
#
-%include %{_configdir}/checks.cfg
-%include %{_configdir}/base.cfg
-
-%define gcc_version 4.7.2
-%define newlib_version 1.20.0
-%define mpfr_version 3.0.1
-%define mpc_version 0.8.2
-%define gmp_version 5.0.5
-
-%define with_threads 1
-%define with_plugin 0
-%define with_iconv 1
-
#
# AVR C++ does not work.
# configure: error: unable to detect exception model
@@ -31,10 +18,6 @@
%define enable_cxx 0
%endif
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
#
# If arm-rtems4.11 add --enable-obsolete.
#
@@ -44,6 +27,19 @@
%define enable_obsolete 0
%endif
+%include %{_configdir}/checks.cfg
+%include %{_configdir}/base.cfg
+
+%define gcc_version 4.7.2
+%define newlib_version 1.20.0
+%define mpfr_version 3.0.1
+%define mpc_version 0.8.2
+%define gmp_version 5.0.5
+
+%define with_threads 1
+%define with_plugin 0
+%define with_iconv 1
+
#
# The RTEMS 4.11 patches
#
diff --git a/rtems/config/tools/rtems-gcc-4.7.2-newlib-2.0.0-1.cfg b/rtems/config/tools/rtems-gcc-4.7.2-newlib-2.0.0-1.cfg
index a8d72d7..5d1d3d4 100644
--- a/rtems/config/tools/rtems-gcc-4.7.2-newlib-2.0.0-1.cfg
+++ b/rtems/config/tools/rtems-gcc-4.7.2-newlib-2.0.0-1.cfg
@@ -16,14 +16,6 @@
%define with_plugin 0
%define with_iconv 1
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
-%ifn %{defined enable_obsolete}
-%define enable_obsolete 0
-%endif
-
#
# The RTEMS 4.11 patches
#
@@ -32,7 +24,7 @@ Patch0: %{rtems_gcc_patches}/gcc-4.7.2-rtems4.11-20121026.diff
# Incompatible with Texinfo 5
%if %{__makeinfo_ver} >= 5.0
- %error Incomaptible version of makeinfo found!
+ %error Incomaptible version of makeinfo found!
%endif
#
diff --git a/rtems/config/tools/rtems-gcc-4.8-ss-newlib-2.0.0-1.cfg b/rtems/config/tools/rtems-gcc-4.8-ss-newlib-2.0.0-1.cfg
index ae5500a..082fb66 100644
--- a/rtems/config/tools/rtems-gcc-4.8-ss-newlib-2.0.0-1.cfg
+++ b/rtems/config/tools/rtems-gcc-4.8-ss-newlib-2.0.0-1.cfg
@@ -15,10 +15,6 @@
%define with_plugin 0
%define with_iconv 1
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
#
# The RTEMS 4.11 patches
#
diff --git a/source-builder/config/autoconf-2-1.cfg b/source-builder/config/autoconf-2-1.cfg
index c3d0dff..51e683d 100644
--- a/source-builder/config/autoconf-2-1.cfg
+++ b/source-builder/config/autoconf-2-1.cfg
@@ -25,10 +25,10 @@ VersionControl0: git clone git://git.sv.gnu.org/autoconf
# Prepare the source code.
#
%prep
-%setup -q -c -n %{name}-%{version}
-cd autoconf-%{autoconf_version}
-%{?patch0:%patch0 -p1}
-cd ..
+ %setup -q -c -n %{name}-%{version}
+ cd autoconf-%{autoconf_version}
+ %{?patch0:%patch0 -p1}
+ cd ..
%build
if test "%{_internal_autotools}" == "yes"; then
@@ -45,9 +45,11 @@ cd ..
ac_prefix=%{_prefix}
fi
-%if "%{_build}" != "%{_host}"
- CFLAGS_FOR_BUILD="-g -O2 -Wall" \
-%endif
+ if test "%{_build}" != "%{_host}" ; then
+ CFLAGS_FOR_BUILD="-g -O2 -Wall"
+ fi
+ export CFLAGS CFLAGS_FOR_BUILD CC
+
CFLAGS="$SB_OPT_FLAGS" \
./configure \
--build=%{_build} --host=%{_host} \
@@ -57,6 +59,8 @@ cd ..
%{__make} %{?_smp_mflags} all
+ unset CFLAGS_FOR_BUILD
+
cd ..
%install
diff --git a/source-builder/config/autoconf-2.69-1.cfg b/source-builder/config/autoconf-2.69-1.cfg
index 28c26c9..3119aee 100644
--- a/source-builder/config/autoconf-2.69-1.cfg
+++ b/source-builder/config/autoconf-2.69-1.cfg
@@ -1,5 +1,5 @@
#
-# Autoconf 2.22.
+# Autoconf 2.69.
#
%if %{release} == %{nil}
diff --git a/source-builder/config/automake-1-1.cfg b/source-builder/config/automake-1-1.cfg
index 41a8c29..8a52661 100644
--- a/source-builder/config/automake-1-1.cfg
+++ b/source-builder/config/automake-1-1.cfg
@@ -25,10 +25,10 @@ VersionControl0: git clone git://git.savannah.gnu.org/automake.git
# Prepare the source code.
#
%prep
-%setup -q -c -n %{name}-%{version}
-cd automake-%{automake_version}
-%{?patch0:%patch0 -p1}
-cd ..
+ %setup -q -c -n %{name}-%{version}
+ cd automake-%{automake_version}
+ %{?patch0:%patch0 -p1}
+ cd ..
%build
if test "%{_internal_autotools}" == "yes"; then
@@ -45,9 +45,11 @@ cd ..
am_prefix=%{_prefix}
fi
-%if "%{_build}" != "%{_host}"
- CFLAGS_FOR_BUILD="-g -O2 -Wall" \
-%endif
+ if test "%{_build}" != "%{_host}" ; then
+ CFLAGS_FOR_BUILD="-g -O2 -Wall"
+ fi
+ export CFLAGS CFLAGS_FOR_BUILD CC
+
CFLAGS="$SB_OPT_FLAGS" \
./configure \
--build=%{_build} --host=%{_host} \
@@ -56,6 +58,8 @@ cd ..
%{__make} %{?_smp_mflags} all
+ unset CFLAGS_FOR_BUILD
+
cd ..
%install
diff --git a/source-builder/config/binutils-2-1.cfg b/source-builder/config/binutils-2-1.cfg
index ce791d2..af08581 100644
--- a/source-builder/config/binutils-2-1.cfg
+++ b/source-builder/config/binutils-2-1.cfg
@@ -14,6 +14,11 @@ URL: http://sources.redhat.com/binutils
BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
+# Supports Candian Cross (Cxc).
+#
+%define allow_cxc
+
+#
# Source
#
%ifn %{defined Source0}
@@ -40,13 +45,14 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
cd ..
%build
- export PATH="%{_bindir}:${PATH}"
- mkdir -p build
- cd build
%{?host_force_32bit:HOST_FORCE_32BIT="-m32"}
-%if "%{_build}" != "%{_host}"
- CFLAGS_FOR_BUILD="-g -O2 -Wall ${HOST_FORCE_32BIT}" \
-%endif
+ if test "%{_build}" != "%{_host}" ; then
+ build_dir="build-cxc"
+ else
+ build_dir="build"
+ fi
+ mkdir -p ${build_dir}
+ cd ${build_dir}
CFLAGS="$SB_OPT_FLAGS" \
../binutils-%{binutils_version}/configure \
--build=%{_build} --host=%{_host} \
@@ -65,36 +71,35 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
cd ..
%install
- export PATH="%{_bindir}:${PATH}"
- rm -rf $SB_BUILD_ROOT
+ %{__rmdir} $SB_BUILD_ROOT
- cd build
+ cd ${build_dir}
%{__make} DESTDIR=$SB_BUILD_ROOT install
# Dropped in FSF-binutils-2.9.5, but Cygwin still ships it.
- rm -rf $SB_BUILD_ROOT%{_infodir}/configure.info*
+ %{__rmdir} $SB_BUILD_ROOT%{_infodir}/configure.info*
- rm -f $SB_BUILD_ROOT%{_infodir}/dir
+ %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
touch $SB_BUILD_ROOT%{_infodir}/dir
# binutils does not install share/locale, however it uses it
mkdir -p $SB_BUILD_ROOT%{_prefix}/share/locale
# We don't ship host files
- rm -f ${SB_BUILD_ROOT}%{_libdir}/libiberty*
+ %{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty*
# manpages without corresponding tools
if test ! -f ${SB_BUILD_ROOT}%{_bindir}/%{_target}-dlltool%{_exeext}; then
- rm -f ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-dlltool*
+ %{__rmfile} ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-dlltool*
fi
if test ! -f ${SB_BUILD_ROOT}%{_bindir}/%{_target}-nlmconv%{_exeext}; then
- rm -f ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-nlmconv*
+ %{__rmfile} ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-nlmconv*
fi
if test ! -f ${SB_BUILD_ROOT}%{_bindir}/%{_target}-windres%{_exeext}; then
- rm -f ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-windres*
+ %{__rmfile} ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-windres*
fi
if test ! -f ${SB_BUILD_ROOT}%{_bindir}/%{_target}-windmc%{_exeext}; then
- rm -f ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-windmc*
+ %{__rmfile} ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-windmc*
fi
cd ..
diff --git a/source-builder/config/checks.cfg b/source-builder/config/checks.cfg
index 9586f46..eaa8d93 100644
--- a/source-builder/config/checks.cfg
+++ b/source-builder/config/checks.cfg
@@ -9,3 +9,18 @@
%ifn %{defined release}
%error No 'release' defined
%endif
+
+#
+# Default to C++ on.
+#
+%ifn %{defined enable_cxx}
+%define enable_cxx 1
+%endif
+
+#
+# Hack to get around the ARM EABBI mess.
+#
+%ifn %{defined enable_obsolete}
+%define enable_obsolete 0
+%endif
+
diff --git a/source-builder/config/dtc-1-1.cfg b/source-builder/config/dtc-1-1.cfg
index ddc5e2b..ff51e67 100644
--- a/source-builder/config/dtc-1-1.cfg
+++ b/source-builder/config/dtc-1-1.cfg
@@ -24,20 +24,19 @@ Source0: http://www.jdl.com/software/dtc-v%{dtc_version}.tgz
# Prepare the source code.
#
%prep
-%setup -q -c -n %{name}-%{version}
-cd dtc-v%{dtc_version}
-%{?patch0:%patch0 -p1}
-%{?patch1:%patch1 -p1}
-%{?patch2:%patch2 -p1}
-%{?patch3:%patch3 -p1}
-%{?patch4:%patch4 -p1}
-%{?patch5:%patch5 -p1}
-%{?patch6:%patch6 -p1}
-%{?patch7:%patch7 -p1}
-cd ..
+ %setup -q -c -n %{name}-%{version}
+ cd dtc-v%{dtc_version}
+ %{?patch0:%patch0 -p1}
+ %{?patch1:%patch1 -p1}
+ %{?patch2:%patch2 -p1}
+ %{?patch3:%patch3 -p1}
+ %{?patch4:%patch4 -p1}
+ %{?patch5:%patch5 -p1}
+ %{?patch6:%patch6 -p1}
+ %{?patch7:%patch7 -p1}
+ cd ..
%build
- export PATH="%{_bindir}:${PATH}"
cd dtc-v%{dtc_version}
%{__make} PREFIX=%{_prefix}
@@ -45,7 +44,6 @@ cd ..
cd ..
%install
- export PATH="%{_bindir}:${PATH}"
rm -rf $SB_BUILD_ROOT
cd dtc-v%{dtc_version}
diff --git a/source-builder/config/dtc-1.2.0.cfg b/source-builder/config/dtc-1.2.0.cfg
index 8116b1e..ddc5ed9 100644
--- a/source-builder/config/dtc-1.2.0.cfg
+++ b/source-builder/config/dtc-1.2.0.cfg
@@ -1,5 +1,5 @@
#
-# DTC (Device Tree Compiler) 1.3.0
+# DTC (Device Tree Compiler) 1.2.0
#
%if %{release} == %{nil}
diff --git a/source-builder/config/expat-2-1.cfg b/source-builder/config/expat-2-1.cfg
index 97b4108..ff7f4d4 100644
--- a/source-builder/config/expat-2-1.cfg
+++ b/source-builder/config/expat-2-1.cfg
@@ -24,18 +24,19 @@ Source0: http://downloads.sourceforge.net/project/expat/expat/%{expat_version}/e
# Prepare the source code.
#
%prep
-%setup -q -c -n %{name}-%{version}
-cd expat-%{expat_version}
-%{?patch0:%patch0 -p1}
-cd ..
+ %setup -q -c -n %{name}-%{version}
+ cd expat-%{expat_version}
+ %{?patch0:%patch0 -p1}
+ cd ..
%build
- export PATH="%{_bindir}:${PATH}"
cd expat-%{expat_version}
-%if "%{_build}" != "%{_host}"
- CFLAGS_FOR_BUILD="-g -O2 -Wall" \
-%endif
+ if test "%{_build}" != "%{_host}" ; then
+ CFLAGS_FOR_BUILD="-g -O2 -Wall"
+ fi
+ export CFLAGS_FOR_BUILD
+
CFLAGS="$SB_OPT_FLAGS" \
./configure \
--build=%{_build} --host=%{_host} \
@@ -47,10 +48,11 @@ cd ..
%{__make} %{?_smp_mflags} all
+ unset CFLAGS_FOR_BUILD
+
cd ..
%install
- export PATH="%{_bindir}:${PATH}"
rm -rf $SB_BUILD_ROOT
cd expat-%{expat_version}
diff --git a/source-builder/config/gcc-4.3-1.cfg b/source-builder/config/gcc-4.3-1.cfg
index 5ecd27b..fb1fb0b 100644
--- a/source-builder/config/gcc-4.3-1.cfg
+++ b/source-builder/config/gcc-4.3-1.cfg
@@ -6,27 +6,6 @@
#
#
-# Default to C++ on.
-#
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
-%include %{_configdir}/checks.cfg
-
-%ifn %{defined gcc_version_message}
-%error No GCC Version message defined.
-%endif
-
-Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
-Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}.
- GCC uses MPFR v%{mpfr_version}, MPC v%{mpc_version}, and GMP v%{gmp_version}.
-Version: %{gcc_version}
-Release: %{release}
-URL: http://gcc.gnu.org/
-BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
-
-#
# Source
#
#
@@ -51,150 +30,6 @@ Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
-# The GCC library directory
+# GCC Common build script.
#
-%global _gcclibdir %{_prefix}/lib
-
-#
-# Prepare the source code.
-#
-%prep
- # gcc and optional the g++ core if separate packages
- %setup -q -c -n %{name}-%{version}
- %{?source1:%setup -q -D -T -n %{name}-%{version} -a1}
- cd gcc-%{gcc_version}
- %{?patch0:%patch0 %{?patch0_opts:%{patch0_opts}}%{!?patch0_opts:-p1}}
- %{?patch1:%patch1 %{?patch1_opts:%{patch1_opts}}%{!?patch1_opts:-p1}}
- %{?patch2:%patch2 %{?patch2_opts:%{patch2_opts}}%{!?patch2_opts:-p1}}
- %{?patch3:%patch3 %{?patch3_opts:%{patch3_opts}}%{!?patch3_opts:-p1}}
- %{?patch4:%patch4 %{?patch4_opts:%{patch4_opts}}%{!?patch4_opts:-p1}}
- %{?patch5:%patch5 %{?patch5_opts:%{patch5_opts}}%{!?patch5_opts:-p1}}
- %{?patch6:%patch6 %{?patch6_opts:%{patch6_opts}}%{!?patch6_opts:-p1}}
- %{?patch7:%patch7 %{?patch7_opts:%{patch7_opts}}%{!?patch7_opts:-p1}}
- %{?patch8:%patch8 %{?patch8_opts:%{patch8_opts}}%{!?patch8_opts:-p1}}
- %{?patch9:%patch9 %{?patch9_opts:%{patch9_opts}}%{!?patch9_opts:-p1}}
- cd ..
-
- # newlib
- %setup -q -D -T -n %{name}-%{version} -a10
- cd newlib-%{newlib_version}
- %{?patch10:%patch10 %{?patch10_opts:%{patch10_opts}}%{!?patch10_opts:-p1}}
- %{?patch11:%patch11 %{?patch11_opts:%{patch11_opts}}%{!?patch11_opts:-p1}}
- %{?patch12:%patch12 %{?patch12_opts:%{patch12_opts}}%{!?patch12_opts:-p1}}
- %{?patch13:%patch13 %{?patch13_opts:%{patch13_opts}}%{!?patch13_opts:-p1}}
- %{?patch14:%patch14 %{?patch14_opts:%{patch14_opts}}%{!?patch14_opts:-p1}}
- %{?patch15:%patch15 %{?patch15_opts:%{patch15_opts}}%{!?patch15_opts:-p1}}
- %{?patch16:%patch16 %{?patch16_opts:%{patch16_opts}}%{!?patch16_opts:-p1}}
- %{?patch17:%patch17 %{?patch17_opts:%{patch17_opts}}%{!?patch17_opts:-p1}}
- %{?patch18:%patch18 %{?patch18_opts:%{patch18_opts}}%{!?patch18_opts:-p1}}
- %{?patch19:%patch19 %{?patch19_opts:%{patch19_opts}}%{!?patch19_opts:-p1}}
- cd ..
-
- # Link newlib into the gcc source tree
- ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
-
- # MPFR
- %setup -q -D -T -n %{name}-%{version} -a20
- cd mpfr-%{mpfr_version}
- %{?patch20:%patch20 -p1}
- cd ..
- # Build MPFR one-tree style
- ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_version}/mpfr
-
- # MPC
- %setup -q -D -T -n %{name}-%{version} -a21
- cd mpc-%{mpc_version}
- %{?patch21:%patch21 -p1}
- cd ..
- # Build MPC one-tree style
- ln -s ../mpc-%{mpc_version} gcc-%{gcc_version}/mpc
-
- # GMP
- %setup -q -D -T -n %{name}-%{version} -a22
- cd gmp-%{gmp_version}
- %{?patch22:%patch22 -p1}
- cd ..
- # Build GMP one-tree style
- ln -s ../gmp-%{gmp_version} gcc-%{gcc_version}/gmp
-
- echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE
-
- # Fix timestamps
- cd gcc-%{gcc_version}
- contrib/gcc_update --touch
- cd ..
-
-%build
- export PATH="%{_bindir}:${PATH}"
- mkdir -p build
- cd build
- languages="c"
-%if %{enable_cxx}
- languages="$languages,c++"
-%endif
-%if "%{_build}" != "%{_host}"
- CFLAGS_FOR_BUILD="-g -O2 -Wall" \
- CC="%{_host}-gcc ${SB_OPT_FLAGS}" \
-%else
- # gcc is not ready to be compiled with -std=gnu99
- CC=$(echo "%{__cc} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \
-%endif
- ../gcc-%{gcc_version}/configure \
- --prefix=%{_prefix} \
- --bindir=%{_bindir} \
- --exec_prefix=%{_exec_prefix} \
- --includedir=%{_includedir} \
- --libdir=%{_gcclibdir} \
- --libexecdir=%{_libexecdir} \
- --mandir=%{_mandir} \
- --infodir=%{_infodir} \
- --datadir=%{_datadir} \
- --build=%_build --host=%_host \
- --target=%{_target} \
- --disable-libstdcxx-pch \
- --with-gnu-as --with-gnu-ld --verbose \
- --with-newlib \
- --with-system-zlib \
- --disable-nls --without-included-gettext \
- --disable-win32-registry \
- --enable-version-specific-runtime-libs \
- %{?with_lto:--enable-lto}%{!?with_lto:--disable-lto} \
- %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
- %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
- --enable-newlib-io-c99-formats \
- %{?with_iconv:--enable-newlib-iconv} \
-%if %{enable_obsolete}
- --enable-obsolete \
-%endif
- --enable-languages="$languages"
-
-%if "%_host" != "%_build"
- # Bug in gcc-3.2.1:
- # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
- mkdir -p gcc/include
- cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
-%endif
-
- %{__make} %{?_smp_mflags} all
- cd ..
-
-%install
- export PATH="%{_bindir}:${PATH}"
- rm -rf $SB_BUILD_ROOT
-
- cd build
- %{__make} DESTDIR=$SB_BUILD_ROOT install
- cd ..
-
- # libiberty doesn't honor --libdir, but always installs to a
- # magically guessed _libdir
- rm -f ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
-
- # We use the version from binutils
- rm -f $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
-
- # We don't ship info/dir
- rm -f $SB_BUILD_ROOT%{_infodir}/dir
-
- # Don't want libffi's man-pages
- rm -f $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
+%include %{_configdir}/gcc-common-1.cfg
diff --git a/source-builder/config/gcc-4.4-1.cfg b/source-builder/config/gcc-4.4-1.cfg
index adaab92..8d39f0d 100644
--- a/source-builder/config/gcc-4.4-1.cfg
+++ b/source-builder/config/gcc-4.4-1.cfg
@@ -1,31 +1,11 @@
#
-# GCC 4.6 Version 1.
+# GCC 4.4.x Version 1.
#
# This configuration file configure's, make's and install's gcc. It uses
# newlib, MPFR, MPC, and GMP in a one-tree build configuration.
#
#
-# Default to C++ on.
-#
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
-%include %{_configdir}/checks.cfg
-
-%ifn %{defined gcc_version_message}
-%error No GCC Version message defined.
-%endif
-
-Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
-Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}
-Version: %{gcc_version}
-Release: %{release}
-URL: http://gcc.gnu.org/
-BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
-
-#
# Source
#
#
@@ -52,133 +32,6 @@ Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
-# The GCC library directory
+# GCC Common build script.
#
-%global _gcclibdir %{_prefix}/lib
-
-#
-# Prepare the source code.
-#
-%prep
- # gcc core
- %setup -q -c -n %{name}-%{version}
- cd gcc-%{gcc_version}
- %{?patch0:%patch0 -p1}
- cd ..
-
- # g++
- %{?source1:%setup -q -D -T -n %{name}-%{version} -a1}
- cd gcc-%{gcc_version}
- %{?patch1:%patch1 -p1}
- cd ..
-
- # newlib
- %setup -q -D -T -n %{name}-%{version} -a10
- cd newlib-%{newlib_version}
- %{?patch10:%patch10 -p1}
- cd ..
- # Link newlib into the gcc source tree
- ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
-
- # MPFR
- %setup -q -D -T -n %{name}-%{version} -a20
- cd mpfr-%{mpfr_version}
- %{?patch20:%patch20 -p1}
- cd ..
- # Build MPFR one-tree style
- ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_version}/mpfr
-
- # MPC
- %setup -q -D -T -n %{name}-%{version} -a21
- cd mpc-%{mpc_version}
- %{?patch21:%patch21 -p1}
- cd ..
- # Build MPC one-tree style
- ln -s ../mpc-%{mpc_version} gcc-%{gcc_version}/mpc
-
- # GMP
- %setup -q -D -T -n %{name}-%{version} -a22
- cd gmp-%{gmp_version}
- %{?patch22:%patch22 -p1}
- cd ..
- # Build GMP one-tree style
- ln -s ../gmp-%{gmp_version} gcc-%{gcc_version}/gmp
-
- echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE
-
- # Fix timestamps
- cd gcc-%{gcc_version}
- contrib/gcc_update --touch
- cd ..
-
-%build
- export PATH="%{_bindir}:${PATH}"
- mkdir -p build
- cd build
- languages="c"
-%if %{enable_cxx}
- languages="$languages,c++"
-%endif
-%if "%{_build}" != "%{_host}"
- CFLAGS_FOR_BUILD="-g -O2 -Wall" \
- CC="%{_host}-gcc ${SB_OPT_FLAGS}" \
-%else
- # gcc is not ready to be compiled with -std=gnu99
- CC=$(echo "%{__cc} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \
-%endif
- ../gcc-%{gcc_version}/configure \
- --prefix=%{_prefix} \
- --bindir=%{_bindir} \
- --exec_prefix=%{_exec_prefix} \
- --includedir=%{_includedir} \
- --libdir=%{_gcclibdir} \
- --libexecdir=%{_libexecdir} \
- --mandir=%{_mandir} \
- --infodir=%{_infodir} \
- --datadir=%{_datadir} \
- --build=%_build --host=%_host \
- --target=%{_target} \
- --disable-libstdcxx-pch \
- --with-gnu-as --with-gnu-ld --verbose \
- --with-newlib \
- --with-system-zlib \
- --disable-nls --without-included-gettext \
- --disable-win32-registry \
- --enable-version-specific-runtime-libs \
- --disable-lto \
- %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
- %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
- --enable-newlib-io-c99-formats \
- %{?with_iconv:--enable-newlib-iconv} \
- --enable-languages="$languages"
-
-%if "%_host" != "%_build"
- # Bug in gcc-3.2.1:
- # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
- mkdir -p gcc/include
- cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
-%endif
-
- %{__make} %{?_smp_mflags} all
- cd ..
-
-%install
- export PATH="%{_bindir}:${PATH}"
- rm -rf $SB_BUILD_ROOT
-
- cd build
- %{__make} DESTDIR=$SB_BUILD_ROOT install
- cd ..
-
- # libiberty doesn't honor --libdir, but always installs to a
- # magically guessed _libdir
- rm -f ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
-
- # We use the version from binutils
- rm -f $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
-
- # We don't ship info/dir
- rm -f $SB_BUILD_ROOT%{_infodir}/dir
-
- # Don't want libffi's man-pages
- rm -f $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
+%include %{_configdir}/gcc-common-1.cfg
diff --git a/source-builder/config/gcc-4.5-1.cfg b/source-builder/config/gcc-4.5-1.cfg
index fc46411..638e0d1 100644
--- a/source-builder/config/gcc-4.5-1.cfg
+++ b/source-builder/config/gcc-4.5-1.cfg
@@ -6,27 +6,6 @@
#
#
-# Default to C++ on.
-#
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
-%include %{_configdir}/checks.cfg
-
-%ifn %{defined gcc_version_message}
-%error No GCC Version message defined.
-%endif
-
-Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
-Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}.
- GCC uses MPFR v%{mpfr_version}, MPC v%{mpc_version}, and GMP v%{gmp_version}.
-Version: %{gcc_version}
-Release: %{release}
-URL: http://gcc.gnu.org/
-BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
-
-#
# Source
#
#
@@ -49,150 +28,6 @@ Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
-# The GCC library directory
+# GCC Common build script.
#
-%global _gcclibdir %{_prefix}/lib
-
-#
-# Prepare the source code.
-#
-%prep
- # gcc and optional the g++ core if separate packages
- %setup -q -c -n %{name}-%{version}
- %{?source1:%setup -q -D -T -n %{name}-%{version} -a1}
- cd gcc-%{gcc_version}
- %{?patch0:%patch0 %{?patch0_opts:%{patch0_opts}}%{!?patch0_opts:-p1}}
- %{?patch1:%patch1 %{?patch1_opts:%{patch1_opts}}%{!?patch1_opts:-p1}}
- %{?patch2:%patch2 %{?patch2_opts:%{patch2_opts}}%{!?patch2_opts:-p1}}
- %{?patch3:%patch3 %{?patch3_opts:%{patch3_opts}}%{!?patch3_opts:-p1}}
- %{?patch4:%patch4 %{?patch4_opts:%{patch4_opts}}%{!?patch4_opts:-p1}}
- %{?patch5:%patch5 %{?patch5_opts:%{patch5_opts}}%{!?patch5_opts:-p1}}
- %{?patch6:%patch6 %{?patch6_opts:%{patch6_opts}}%{!?patch6_opts:-p1}}
- %{?patch7:%patch7 %{?patch7_opts:%{patch7_opts}}%{!?patch7_opts:-p1}}
- %{?patch8:%patch8 %{?patch8_opts:%{patch8_opts}}%{!?patch8_opts:-p1}}
- %{?patch9:%patch9 %{?patch9_opts:%{patch9_opts}}%{!?patch9_opts:-p1}}
- cd ..
-
- # newlib
- %setup -q -D -T -n %{name}-%{version} -a10
- cd newlib-%{newlib_version}
- %{?patch10:%patch10 %{?patch10_opts:%{patch10_opts}}%{!?patch10_opts:-p1}}
- %{?patch11:%patch11 %{?patch11_opts:%{patch11_opts}}%{!?patch11_opts:-p1}}
- %{?patch12:%patch12 %{?patch12_opts:%{patch12_opts}}%{!?patch12_opts:-p1}}
- %{?patch13:%patch13 %{?patch13_opts:%{patch13_opts}}%{!?patch13_opts:-p1}}
- %{?patch14:%patch14 %{?patch14_opts:%{patch14_opts}}%{!?patch14_opts:-p1}}
- %{?patch15:%patch15 %{?patch15_opts:%{patch15_opts}}%{!?patch15_opts:-p1}}
- %{?patch16:%patch16 %{?patch16_opts:%{patch16_opts}}%{!?patch16_opts:-p1}}
- %{?patch17:%patch17 %{?patch17_opts:%{patch17_opts}}%{!?patch17_opts:-p1}}
- %{?patch18:%patch18 %{?patch18_opts:%{patch18_opts}}%{!?patch18_opts:-p1}}
- %{?patch19:%patch19 %{?patch19_opts:%{patch19_opts}}%{!?patch19_opts:-p1}}
- cd ..
-
- # Link newlib into the gcc source tree
- ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
-
- # MPFR
- %setup -q -D -T -n %{name}-%{version} -a20
- cd mpfr-%{mpfr_version}
- %{?patch20:%patch20 -p1}
- cd ..
- # Build MPFR one-tree style
- ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_version}/mpfr
-
- # MPC
- %setup -q -D -T -n %{name}-%{version} -a21
- cd mpc-%{mpc_version}
- %{?patch21:%patch21 -p1}
- cd ..
- # Build MPC one-tree style
- ln -s ../mpc-%{mpc_version} gcc-%{gcc_version}/mpc
-
- # GMP
- %setup -q -D -T -n %{name}-%{version} -a22
- cd gmp-%{gmp_version}
- %{?patch22:%patch22 -p1}
- cd ..
- # Build GMP one-tree style
- ln -s ../gmp-%{gmp_version} gcc-%{gcc_version}/gmp
-
- echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE
-
- # Fix timestamps
- cd gcc-%{gcc_version}
- contrib/gcc_update --touch
- cd ..
-
-%build
- export PATH="%{_bindir}:${PATH}"
- mkdir -p build
- cd build
- languages="c"
-%if %{enable_cxx}
- languages="$languages,c++"
-%endif
-%if "%{_build}" != "%{_host}"
- CFLAGS_FOR_BUILD="-g -O2 -Wall" \
- CC="%{_host}-gcc ${SB_OPT_FLAGS}" \
-%else
- # gcc is not ready to be compiled with -std=gnu99
- CC=$(echo "%{__cc} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \
-%endif
- ../gcc-%{gcc_version}/configure \
- --prefix=%{_prefix} \
- --bindir=%{_bindir} \
- --exec_prefix=%{_exec_prefix} \
- --includedir=%{_includedir} \
- --libdir=%{_gcclibdir} \
- --libexecdir=%{_libexecdir} \
- --mandir=%{_mandir} \
- --infodir=%{_infodir} \
- --datadir=%{_datadir} \
- --build=%_build --host=%_host \
- --target=%{_target} \
- --disable-libstdcxx-pch \
- --with-gnu-as --with-gnu-ld --verbose \
- --with-newlib \
- --with-system-zlib \
- --disable-nls --without-included-gettext \
- --disable-win32-registry \
- --enable-version-specific-runtime-libs \
- %{?with_lto:--enable-lto}%{!?with_lto:--disable-lto} \
- %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
- %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
- --enable-newlib-io-c99-formats \
- %{?with_iconv:--enable-newlib-iconv} \
-%if %{enable_obsolete}
- --enable-obsolete \
-%endif
- --enable-languages="$languages"
-
-%if "%_host" != "%_build"
- # Bug in gcc-3.2.1:
- # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
- mkdir -p gcc/include
- cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
-%endif
-
- %{__make} %{?_smp_mflags} all
- cd ..
-
-%install
- export PATH="%{_bindir}:${PATH}"
- rm -rf $SB_BUILD_ROOT
-
- cd build
- %{__make} DESTDIR=$SB_BUILD_ROOT install
- cd ..
-
- # libiberty doesn't honor --libdir, but always installs to a
- # magically guessed _libdir
- rm -f ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
-
- # We use the version from binutils
- rm -f $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
-
- # We don't ship info/dir
- rm -f $SB_BUILD_ROOT%{_infodir}/dir
-
- # Don't want libffi's man-pages
- rm -f $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
+%include %{_configdir}/gcc-common-1.cfg
diff --git a/source-builder/config/gcc-4.6-1.cfg b/source-builder/config/gcc-4.6-1.cfg
index 377aa13..1d04f96 100644
--- a/source-builder/config/gcc-4.6-1.cfg
+++ b/source-builder/config/gcc-4.6-1.cfg
@@ -6,26 +6,6 @@
#
#
-# Default to C++ on.
-#
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
-%include %{_configdir}/checks.cfg
-
-%ifn %{defined gcc_version_message}
-%error No GCC Version message defined.
-%endif
-
-Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
-Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}
-Version: %{gcc_version}
-Release: %{release}
-URL: http://gcc.gnu.org/
-BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
-
-#
# Source
#
#
@@ -52,133 +32,6 @@ Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
-# The GCC library directory
+# GCC Common build script.
#
-%global _gcclibdir %{_prefix}/lib
-
-#
-# Prepare the source code.
-#
-%prep
- # gcc core
- %setup -q -c -n %{name}-%{version} -a0
- cd gcc-%{gcc_version}
- %{?patch0:%patch0 -p1}
- cd ..
-
- # g++
- %{?source1:%setup -q -D -n %{name}-%{version} -a1}
- cd gcc-%{gcc_version}
- %{?patch1:%patch1 -p1}
- cd ..
-
- # newlib
- %setup -q -D -n %{name}-%{version} -a10
- cd newlib-%{newlib_version}
- %{?patch10:%patch10 -p1}
- cd ..
- # Link newlib into the gcc source tree
- ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
-
- # MPFR
- %setup -q -D -n %{name}-%{version} -a20
- cd mpfr-%{mpfr_version}
- %{?patch20:%patch20 -p1}
- cd ..
- # Build MPFR one-tree style
- ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_version}/mpfr
-
- # MPC
- %setup -q -D -n %{name}-%{version} -a21
- cd mpc-%{mpc_version}
- %{?patch21:%patch21 -p1}
- cd ..
- # Build MPC one-tree style
- ln -s ../mpc-%{mpc_version} gcc-%{gcc_version}/mpc
-
- # GMP
- %setup -q -D -n %{name}-%{version} -a22
- cd gmp-%{gmp_version}
- %{?patch22:%patch22 -p1}
- cd ..
- # Build GMP one-tree style
- ln -s ../gmp-%{gmp_version} gcc-%{gcc_version}/gmp
-
- echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE
-
- # Fix timestamps
- cd gcc-%{gcc_version}
- contrib/gcc_update --touch
- cd ..
-
-%build
- export PATH="%{_bindir}:${PATH}"
- mkdir -p build
- cd build
- languages="c"
-%if %{enable_cxx}
- languages="$languages,c++"
-%endif
-%if "%{_build}" != "%{_host}"
- CFLAGS_FOR_BUILD="-g -O2 -Wall" \
- CC="%{_host}-gcc ${SB_OPT_FLAGS}" \
-%else
- # gcc is not ready to be compiled with -std=gnu99
- CC=$(echo "%{__cc} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \
-%endif
- ../gcc-%{gcc_version}/configure \
- --prefix=%{_prefix} \
- --bindir=%{_bindir} \
- --exec_prefix=%{_exec_prefix} \
- --includedir=%{_includedir} \
- --libdir=%{_gcclibdir} \
- --libexecdir=%{_libexecdir} \
- --mandir=%{_mandir} \
- --infodir=%{_infodir} \
- --datadir=%{_datadir} \
- --build=%_build --host=%_host \
- --target=%{_target} \
- --disable-libstdcxx-pch \
- --with-gnu-as --with-gnu-ld --verbose \
- --with-newlib \
- --with-system-zlib \
- --disable-nls --without-included-gettext \
- --disable-win32-registry \
- --enable-version-specific-runtime-libs \
- --disable-lto \
- %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
- %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
- --enable-newlib-io-c99-formats \
- %{?with_iconv:--enable-newlib-iconv} \
- --enable-languages="$languages"
-
-%if "%_host" != "%_build"
- # Bug in gcc-3.2.1:
- # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
- mkdir -p gcc/include
- cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
-%endif
-
- %{__make} %{?_smp_mflags} all
- cd ..
-
-%install
- export PATH="%{_bindir}:${PATH}"
- rm -rf $SB_BUILD_ROOT
-
- cd build
- %{__make} DESTDIR=$SB_BUILD_ROOT install
- cd ..
-
- # libiberty doesn't honor --libdir, but always installs to a
- # magically guessed _libdir
- rm -f ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
-
- # We use the version from binutils
- rm -f $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
-
- # We don't ship info/dir
- rm -f $SB_BUILD_ROOT%{_infodir}/dir
-
- # Don't want libffi's man-pages
- rm -f $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
+%include %{_configdir}/gcc-common-1.cfg
diff --git a/source-builder/config/gcc-4.7-1.cfg b/source-builder/config/gcc-4.7-1.cfg
index 5ecd27b..fb1fb0b 100644
--- a/source-builder/config/gcc-4.7-1.cfg
+++ b/source-builder/config/gcc-4.7-1.cfg
@@ -6,27 +6,6 @@
#
#
-# Default to C++ on.
-#
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
-%include %{_configdir}/checks.cfg
-
-%ifn %{defined gcc_version_message}
-%error No GCC Version message defined.
-%endif
-
-Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
-Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}.
- GCC uses MPFR v%{mpfr_version}, MPC v%{mpc_version}, and GMP v%{gmp_version}.
-Version: %{gcc_version}
-Release: %{release}
-URL: http://gcc.gnu.org/
-BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
-
-#
# Source
#
#
@@ -51,150 +30,6 @@ Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
-# The GCC library directory
+# GCC Common build script.
#
-%global _gcclibdir %{_prefix}/lib
-
-#
-# Prepare the source code.
-#
-%prep
- # gcc and optional the g++ core if separate packages
- %setup -q -c -n %{name}-%{version}
- %{?source1:%setup -q -D -T -n %{name}-%{version} -a1}
- cd gcc-%{gcc_version}
- %{?patch0:%patch0 %{?patch0_opts:%{patch0_opts}}%{!?patch0_opts:-p1}}
- %{?patch1:%patch1 %{?patch1_opts:%{patch1_opts}}%{!?patch1_opts:-p1}}
- %{?patch2:%patch2 %{?patch2_opts:%{patch2_opts}}%{!?patch2_opts:-p1}}
- %{?patch3:%patch3 %{?patch3_opts:%{patch3_opts}}%{!?patch3_opts:-p1}}
- %{?patch4:%patch4 %{?patch4_opts:%{patch4_opts}}%{!?patch4_opts:-p1}}
- %{?patch5:%patch5 %{?patch5_opts:%{patch5_opts}}%{!?patch5_opts:-p1}}
- %{?patch6:%patch6 %{?patch6_opts:%{patch6_opts}}%{!?patch6_opts:-p1}}
- %{?patch7:%patch7 %{?patch7_opts:%{patch7_opts}}%{!?patch7_opts:-p1}}
- %{?patch8:%patch8 %{?patch8_opts:%{patch8_opts}}%{!?patch8_opts:-p1}}
- %{?patch9:%patch9 %{?patch9_opts:%{patch9_opts}}%{!?patch9_opts:-p1}}
- cd ..
-
- # newlib
- %setup -q -D -T -n %{name}-%{version} -a10
- cd newlib-%{newlib_version}
- %{?patch10:%patch10 %{?patch10_opts:%{patch10_opts}}%{!?patch10_opts:-p1}}
- %{?patch11:%patch11 %{?patch11_opts:%{patch11_opts}}%{!?patch11_opts:-p1}}
- %{?patch12:%patch12 %{?patch12_opts:%{patch12_opts}}%{!?patch12_opts:-p1}}
- %{?patch13:%patch13 %{?patch13_opts:%{patch13_opts}}%{!?patch13_opts:-p1}}
- %{?patch14:%patch14 %{?patch14_opts:%{patch14_opts}}%{!?patch14_opts:-p1}}
- %{?patch15:%patch15 %{?patch15_opts:%{patch15_opts}}%{!?patch15_opts:-p1}}
- %{?patch16:%patch16 %{?patch16_opts:%{patch16_opts}}%{!?patch16_opts:-p1}}
- %{?patch17:%patch17 %{?patch17_opts:%{patch17_opts}}%{!?patch17_opts:-p1}}
- %{?patch18:%patch18 %{?patch18_opts:%{patch18_opts}}%{!?patch18_opts:-p1}}
- %{?patch19:%patch19 %{?patch19_opts:%{patch19_opts}}%{!?patch19_opts:-p1}}
- cd ..
-
- # Link newlib into the gcc source tree
- ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
-
- # MPFR
- %setup -q -D -T -n %{name}-%{version} -a20
- cd mpfr-%{mpfr_version}
- %{?patch20:%patch20 -p1}
- cd ..
- # Build MPFR one-tree style
- ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_version}/mpfr
-
- # MPC
- %setup -q -D -T -n %{name}-%{version} -a21
- cd mpc-%{mpc_version}
- %{?patch21:%patch21 -p1}
- cd ..
- # Build MPC one-tree style
- ln -s ../mpc-%{mpc_version} gcc-%{gcc_version}/mpc
-
- # GMP
- %setup -q -D -T -n %{name}-%{version} -a22
- cd gmp-%{gmp_version}
- %{?patch22:%patch22 -p1}
- cd ..
- # Build GMP one-tree style
- ln -s ../gmp-%{gmp_version} gcc-%{gcc_version}/gmp
-
- echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE
-
- # Fix timestamps
- cd gcc-%{gcc_version}
- contrib/gcc_update --touch
- cd ..
-
-%build
- export PATH="%{_bindir}:${PATH}"
- mkdir -p build
- cd build
- languages="c"
-%if %{enable_cxx}
- languages="$languages,c++"
-%endif
-%if "%{_build}" != "%{_host}"
- CFLAGS_FOR_BUILD="-g -O2 -Wall" \
- CC="%{_host}-gcc ${SB_OPT_FLAGS}" \
-%else
- # gcc is not ready to be compiled with -std=gnu99
- CC=$(echo "%{__cc} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \
-%endif
- ../gcc-%{gcc_version}/configure \
- --prefix=%{_prefix} \
- --bindir=%{_bindir} \
- --exec_prefix=%{_exec_prefix} \
- --includedir=%{_includedir} \
- --libdir=%{_gcclibdir} \
- --libexecdir=%{_libexecdir} \
- --mandir=%{_mandir} \
- --infodir=%{_infodir} \
- --datadir=%{_datadir} \
- --build=%_build --host=%_host \
- --target=%{_target} \
- --disable-libstdcxx-pch \
- --with-gnu-as --with-gnu-ld --verbose \
- --with-newlib \
- --with-system-zlib \
- --disable-nls --without-included-gettext \
- --disable-win32-registry \
- --enable-version-specific-runtime-libs \
- %{?with_lto:--enable-lto}%{!?with_lto:--disable-lto} \
- %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
- %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
- --enable-newlib-io-c99-formats \
- %{?with_iconv:--enable-newlib-iconv} \
-%if %{enable_obsolete}
- --enable-obsolete \
-%endif
- --enable-languages="$languages"
-
-%if "%_host" != "%_build"
- # Bug in gcc-3.2.1:
- # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
- mkdir -p gcc/include
- cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
-%endif
-
- %{__make} %{?_smp_mflags} all
- cd ..
-
-%install
- export PATH="%{_bindir}:${PATH}"
- rm -rf $SB_BUILD_ROOT
-
- cd build
- %{__make} DESTDIR=$SB_BUILD_ROOT install
- cd ..
-
- # libiberty doesn't honor --libdir, but always installs to a
- # magically guessed _libdir
- rm -f ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
-
- # We use the version from binutils
- rm -f $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
-
- # We don't ship info/dir
- rm -f $SB_BUILD_ROOT%{_infodir}/dir
-
- # Don't want libffi's man-pages
- rm -f $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
+%include %{_configdir}/gcc-common-1.cfg
diff --git a/source-builder/config/gcc-4.8-1.cfg b/source-builder/config/gcc-4.8-1.cfg
index ded7734..a839bb8 100644
--- a/source-builder/config/gcc-4.8-1.cfg
+++ b/source-builder/config/gcc-4.8-1.cfg
@@ -1,31 +1,11 @@
#
-# GCC 4.7 Version 1.
+# GCC 4.8 Version 1.
#
# This configuration file configure's, make's and install's gcc. It uses
# newlib, MPFR, MPC, and GMP in a one-tree build configuration.
#
#
-# Default to C++ on.
-#
-%ifn %{defined enable_cxx}
-%define enable_cxx 1
-%endif
-
-%include %{_configdir}/checks.cfg
-
-%ifn %{defined gcc_version_message}
-%error No GCC Version message defined.
-%endif
-
-Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
-Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}
-Version: %{gcc_version}
-Release: %{release}
-URL: http://gcc.gnu.org/
-BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
-
-#
# Source
#
#
@@ -58,153 +38,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%endif
#
-# The GCC library directory
+# GCC Common build script.
#
-%global _gcclibdir %{_prefix}/lib
-
-#
-# Prepare the source code.
-#
-%prep
- # gcc and optional the g++ core if separate packages
- %setup -q -c -n %{name}-%{version}
- %{?source1:%setup -q -D -T -n %{name}-%{version} -a1}
- cd gcc-%{gcc_version}
- %{?patch0:%patch0 %{?patch0_opts:%{patch0_opts}}%{!?patch0_opts:-p1}}
- %{?patch1:%patch1 %{?patch1_opts:%{patch1_opts}}%{!?patch1_opts:-p1}}
- %{?patch2:%patch2 %{?patch2_opts:%{patch2_opts}}%{!?patch2_opts:-p1}}
- %{?patch3:%patch3 %{?patch3_opts:%{patch3_opts}}%{!?patch3_opts:-p1}}
- %{?patch4:%patch4 %{?patch4_opts:%{patch4_opts}}%{!?patch4_opts:-p1}}
- %{?patch5:%patch5 %{?patch5_opts:%{patch5_opts}}%{!?patch5_opts:-p1}}
- %{?patch6:%patch6 %{?patch6_opts:%{patch6_opts}}%{!?patch6_opts:-p1}}
- %{?patch7:%patch7 %{?patch7_opts:%{patch7_opts}}%{!?patch7_opts:-p1}}
- %{?patch8:%patch8 %{?patch8_opts:%{patch8_opts}}%{!?patch8_opts:-p1}}
- %{?patch9:%patch9 %{?patch9_opts:%{patch9_opts}}%{!?patch9_opts:-p1}}
- cd ..
-
- # newlib
- %setup -q -D -T -n %{name}-%{version} -a10
- cd newlib-%{newlib_version}
- %{?patch10:%patch10 %{?patch10_opts:%{patch10_opts}}%{!?patch10_opts:-p1}}
- %{?patch11:%patch11 %{?patch11_opts:%{patch11_opts}}%{!?patch11_opts:-p1}}
- %{?patch12:%patch12 %{?patch12_opts:%{patch12_opts}}%{!?patch12_opts:-p1}}
- %{?patch13:%patch13 %{?patch13_opts:%{patch13_opts}}%{!?patch13_opts:-p1}}
- %{?patch14:%patch14 %{?patch14_opts:%{patch14_opts}}%{!?patch14_opts:-p1}}
- %{?patch15:%patch15 %{?patch15_opts:%{patch15_opts}}%{!?patch15_opts:-p1}}
- %{?patch16:%patch16 %{?patch16_opts:%{patch16_opts}}%{!?patch16_opts:-p1}}
- %{?patch17:%patch17 %{?patch17_opts:%{patch17_opts}}%{!?patch17_opts:-p1}}
- %{?patch18:%patch18 %{?patch18_opts:%{patch18_opts}}%{!?patch18_opts:-p1}}
- %{?patch19:%patch19 %{?patch19_opts:%{patch19_opts}}%{!?patch19_opts:-p1}}
- cd ..
-
- # Link newlib into the gcc source tree
- ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
-
- # MPFR
- %setup -q -D -T -n %{name}-%{version} -a20
- cd mpfr-%{mpfr_version}
- %{?patch20:%patch20 -p1}
- cd ..
- # Build MPFR one-tree style
- ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_version}/mpfr
-
- # MPC
- %setup -q -D -T -n %{name}-%{version} -a21
- cd mpc-%{mpc_version}
- %{?patch21:%patch21 -p1}
- cd ..
- # Build MPC one-tree style
- ln -s ../mpc-%{mpc_version} gcc-%{gcc_version}/mpc
-
- # GMP
- %setup -q -D -T -n %{name}-%{version} -a22
- cd gmp-%{gmp_version}
- %{?patch22:%patch22 -p1}
- cd ..
- # Build GMP one-tree style
- ln -s ../gmp-%{gmp_version} gcc-%{gcc_version}/gmp
-
- echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE
-
- # Fix timestamps
- cd gcc-%{gcc_version}
- contrib/gcc_update --touch
- cd ..
-
-%build
- export PATH="%{_bindir}:${PATH}"
- mkdir -p build
- cd build
- languages="c"
-%if %{enable_cxx}
- languages="$languages,c++"
-%endif
-%if "%{_build}" != "%{_host}"
- CFLAGS_FOR_BUILD="-g -O2 -Wall" \
- CXXFLAGS_FOR_BUILD="-g -O2 -Wall" \
- CC="%{_host}-gcc ${SB_OPT_FLAGS}" \
- CXX="%{_host}-g++ ${SB_OPT_FLAGS}" \
-%else
- # gcc is not ready to be compiled with -std=gnu99
- CC=$(echo "%{__cc} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \
- CXX=$(echo "%{__cxx} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,') \
-%endif
- ../gcc-%{gcc_version}/configure \
- --prefix=%{_prefix} \
- --bindir=%{_bindir} \
- --exec_prefix=%{_exec_prefix} \
- --includedir=%{_includedir} \
- --libdir=%{_gcclibdir} \
- --libexecdir=%{_libexecdir} \
- --mandir=%{_mandir} \
- --infodir=%{_infodir} \
- --datadir=%{_datadir} \
- --build=%_build --host=%_host \
- --target=%{_target} \
- --disable-libstdcxx-pch \
- --with-gnu-as --with-gnu-ld --verbose \
- --with-newlib \
- --with-system-zlib \
- --disable-nls --without-included-gettext \
- --disable-win32-registry \
- --enable-version-specific-runtime-libs \
- %{?with_lto:--enable-lto}%{!?with_lto:--disable-lto} \
- %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
- %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
- --enable-newlib-io-c99-formats \
- %{?with_iconv:--enable-newlib-iconv} \
-%if %{enable_obsolete}
- --enable-obsolete \
-%endif
- --enable-languages="$languages"
-
-%if "%_host" != "%_build"
- # Bug in gcc-3.2.1:
- # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
- mkdir -p gcc/include
- cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
-%endif
-
- %{__make} %{?_smp_mflags} all
- cd ..
-
-%install
- export PATH="%{_bindir}:${PATH}"
- rm -rf $SB_BUILD_ROOT
-
- cd build
- %{__make} DESTDIR=$SB_BUILD_ROOT install
- cd ..
-
- # libiberty doesn't honor --libdir, but always installs to a
- # magically guessed _libdir
- rm -f ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
-
- # We use the version from binutils
- rm -f $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
-
- # We don't ship info/dir
- rm -f $SB_BUILD_ROOT%{_infodir}/dir
+%include %{_configdir}/gcc-common.cfg
- # Don't want libffi's man-pages
- rm -f $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
diff --git a/source-builder/config/gcc-common-1.cfg b/source-builder/config/gcc-common-1.cfg
new file mode 100644
index 0000000..c6297ed
--- /dev/null
+++ b/source-builder/config/gcc-common-1.cfg
@@ -0,0 +1,166 @@
+#
+# GCC Common Support.
+#
+# This configuration file configure's, make's and install's gcc. It uses
+# newlib, MPFR, MPC, and GMP in a one-tree build configuration.
+#
+
+%include %{_configdir}/checks.cfg
+
+%ifn %{defined gcc_version_message}
+%error No GCC Version message defined.
+%endif
+
+Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
+Summary: GCC v%{gcc_version} and Newlib v%{newlib_version} for target %{_target} on host %{_host}
+Version: %{gcc_version}
+Release: %{release}
+URL: http://gcc.gnu.org/
+BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
+
+#
+# Supports Candian Cross (Cxc).
+#
+%define allow_cxc
+
+#
+# The GCC library directory
+#
+%global _gcclibdir %{_prefix}/lib
+
+#
+# Prepare the source code.
+#
+%prep
+ # gcc core
+ %setup -q -c -n %{name}-%{version}
+ cd gcc-%{gcc_version}
+ %{?patch0:%patch0 -p1}
+ cd ..
+
+ # g++
+ %{?source1:%setup -q -D -T -n %{name}-%{version} -a1}
+ cd gcc-%{gcc_version}
+ %{?patch1:%patch1 -p1}
+ cd ..
+
+ # newlib
+ %setup -q -D -T -n %{name}-%{version} -a10
+ cd newlib-%{newlib_version}
+ %{?patch10:%patch10 -p1}
+ cd ..
+ # Link newlib into the gcc source tree
+ ln -s ../newlib-%{newlib_version}/newlib gcc-%{gcc_version}
+
+ # MPFR
+ %setup -q -D -T -n %{name}-%{version} -a20
+ cd mpfr-%{mpfr_version}
+ %{?patch20:%patch20 -p1}
+ cd ..
+ # Build MPFR one-tree style
+ ln -s ../mpfr-%{mpfr_version} gcc-%{gcc_version}/mpfr
+
+ # MPC
+ %setup -q -D -T -n %{name}-%{version} -a21
+ cd mpc-%{mpc_version}
+ %{?patch21:%patch21 -p1}
+ cd ..
+ # Build MPC one-tree style
+ ln -s ../mpc-%{mpc_version} gcc-%{gcc_version}/mpc
+
+ # GMP
+ %setup -q -D -T -n %{name}-%{version} -a22
+ cd gmp-%{gmp_version}
+ %{?patch22:%patch22 -p1}
+ cd ..
+ # Build GMP one-tree style
+ ln -s ../gmp-%{gmp_version} gcc-%{gcc_version}/gmp
+
+ echo "%{gcc_version_message}" > gcc-%{gcc_version}/gcc/DEV-PHASE
+
+ # Fix timestamps
+ cd gcc-%{gcc_version}
+ contrib/gcc_update --touch
+ cd ..
+
+%build
+ if test "%{_build}" != "%{_host}" ; then
+ build_dir="build-cxc"
+ else
+ build_dir="build"
+ fi
+ mkdir -p ${build_dir}
+ cd ${build_dir}
+ languages="c"
+%if %{enable_cxx}
+ languages="$languages,c++"
+%endif
+ if test "%{_build}" != "%{_host}" ; then
+ CFLAGS_FOR_BUILD="-g -O2 -Wall"
+ CC="%{_host}-gcc ${SB_OPT_FLAGS}"
+ CXXFLAGS_FOR_BUILD="-g -O2 -Wall"
+ CXX="%{_host}-g++ ${SB_OPT_FLAGS}"
+ else
+ # gcc is not ready to be compiled with -std=gnu99
+ CC=$(echo "%{__cc} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,')
+ CXX=$(echo "%{__cxx} ${SB_OPT_FLAGS}" | sed -e 's,-std=gnu99 ,,')
+ fi
+ export CFLAGS CFLAGS_FOR_BUILD CC CXXFLAGS_FOR_BUILD CXX
+ ../gcc-%{gcc_version}/configure \
+ --prefix=%{_prefix} \
+ --bindir=%{_bindir} \
+ --exec_prefix=%{_exec_prefix} \
+ --includedir=%{_includedir} \
+ --libdir=%{_gcclibdir} \
+ --libexecdir=%{_libexecdir} \
+ --mandir=%{_mandir} \
+ --infodir=%{_infodir} \
+ --datadir=%{_datadir} \
+ --build=%{_build} --host=%{_host} \
+ --target=%{_target} \
+ --disable-libstdcxx-pch \
+ --with-gnu-as --with-gnu-ld --verbose \
+ --with-newlib \
+ --with-system-zlib \
+ --disable-nls --without-included-gettext \
+ --disable-win32-registry \
+ --enable-version-specific-runtime-libs \
+ --disable-lto \
+ --enable-newlib-io-c99-formats \
+ %{?with_iconv:--enable-newlib-iconv} \
+ %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \
+ %{?with_plugin:--enable-plugin}%{!?with_plugin:--disable-plugin} \
+ %{?enable_obsolete:--enable-obsolete} \
+ --enable-languages="$languages"
+
+ unset CFLAGS CFLAGS_FOR_BUILD CC CXXFLAGS_FOR_BUILD CXX
+
+ if test "%_host" != "%_build" ; then
+ # Bug in gcc-3.2.1:
+ # Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
+ mkdir -p gcc/include
+ cp ../gcc-%{gcc_version}/gcc/gsyslimits.h gcc/include/syslimits.h
+ fi
+
+ %{__make} %{?_smp_mflags} all
+ cd ..
+
+%install
+ %{__rmdir} $SB_BUILD_ROOT
+
+ cd ${build_dir}
+ %{__make} DESTDIR=$SB_BUILD_ROOT install
+ cd ..
+
+ # libiberty doesn't honor --libdir, but always installs to a
+ # magically guessed _libdir
+ %{__rmfile} ${SB_BUILD_ROOT}%{_libdir}/libiberty.a
+
+ # We use the version from binutils
+ %{__rmfile} $SB_BUILD_ROOT%{_bindir}/%{_target}-c++filt%{_exeext}
+
+ # We don't ship info/dir
+ %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
+
+ # Don't want libffi's man-pages
+ %{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
diff --git a/source-builder/config/gdb-7-1.cfg b/source-builder/config/gdb-7-1.cfg
index 48fd553..53bcd3a 100644
--- a/source-builder/config/gdb-7-1.cfg
+++ b/source-builder/config/gdb-7-1.cfg
@@ -22,6 +22,14 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%endif
#
+# Disable Python on Cxc builds for now.
+#
+%if "%{_build}" != "%{_host}"
+ %define without_python
+%endif
+
+#
+#
# Prepare the source code.
#
%prep
@@ -40,12 +48,16 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
cd ..
%build
- export PATH="%{_bindir}:${PATH}"
- mkdir -p build
- cd build
-%if "%{_build}" != "%{_host}"
- CFLAGS_FOR_BUILD="-g -O2 -Wall" \
-%endif
+ if test "%{_build}" != "%{_host}" ; then
+ build_dir="build-cxc"
+ else
+ build_dir="build"
+ fi
+ mkdir -p ${build_dir}
+ cd ${build_dir}
+ if test "%{_build}" != "%{_host}" ; then
+ CFLAGS_FOR_BUILD="-g -O2 -Wall"
+ fi
CFLAGS="$SB_OPT_FLAGS" \
../gdb-%{gdb_version}/configure \
--build=%{_build} --host=%{_host} \
@@ -66,16 +78,15 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
cd ..
%install
- export PATH="%{_bindir}:${PATH}"
- rm -rf $SB_BUILD_ROOT
+ %{__rmdir} $SB_BUILD_ROOT
- cd build
+ cd ${build_dir}
%{__make} DESTDIR=$SB_BUILD_ROOT install
# Dropped in FSF-binutils-2.9.5, but Cygwin still ships it.
- rm -rf $SB_BUILD_ROOT%{_infodir}/configure.info*
+ %{__rmdir} $SB_BUILD_ROOT%{_infodir}/configure.info*
- rm -f $SB_BUILD_ROOT%{_infodir}/dir
+ %{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
touch $SB_BUILD_ROOT%{_infodir}/dir
cd ..
diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py
index 3c2d507..b3ecebc 100644
--- a/source-builder/sb/build.py
+++ b/source-builder/sb/build.py
@@ -279,6 +279,13 @@ class build:
patch['script'] += ' | %{__patch} ' + ' '.join(args[1:])
self.script.append(self.config.expand(patch['script']))
+ def canadian_cross(self):
+ _host = self.config.expand('%{_host}')
+ _build = self.config.expand('%{_build}')
+ _target = self.config.expand('%{_target}')
+ return self.config.defined('%{allow_cxc}') and \
+ _host != _build and _host != _target
+
def setup(self, package, args):
self._output('prep: %s: %s' % (package.name(), ' '.join(args)))
opts, args = getopt.getopt(args[1:], 'qDcTn:b:a:')
@@ -367,6 +374,11 @@ class build:
self.script.append(' '.join(args))
def build(self, package):
+ self.script.append('echo "==> clean %{buildroot}: ${SB_BUILD_ROOT}"')
+ self.script.append('%s ${SB_BUILD_ROOT}' %
+ (self.config.expand('%{__rmdir}')))
+ self.script.append('%s ${SB_BUILD_ROOT}' %
+ (self.config.expand('%{__mkdir_p}')))
self.script.append('echo "==> %build:"')
_build = package.build()
for l in _build:
@@ -389,7 +401,7 @@ class build:
inpath = path.join('%{buildroot}', prefixbase)
tardir = path.abspath(self.config.expand('%{_tardir}'))
self.script.append(self.config.expand('if test -d %s; then' % (inpath)))
- self.script.append(' mkdir -p %s' % tardir)
+ self.script.append(self.config.expand(' %%{__mkdir_p} %s' % tardir))
self.script.append(self.config.expand(' cd ' + inpath))
tar = path.join(tardir, package.long_name() + '.tar.bz2')
cmd = self.config.expand(' %{__tar} -cf - . ' + '| %{__bzip2} > ' + tar)
@@ -405,10 +417,23 @@ class build:
args = l.split()
self.script.append(' '.join(args))
+ def build_package(self, package):
+ if self.canadian_cross():
+ self.script.append('echo "==> Candian-cross build/target:"')
+ self.script.append('SB_CXC="yes"')
+ else:
+ self.script.append('SB_CXC="no"')
+ self.build(package)
+ self.install(package)
+ self.files(package)
+ if not self.opts.no_clean():
+ self.clean(package)
+
def cleanup(self):
if not self.opts.no_clean():
buildroot = self.config.abspath('buildroot')
builddir = self.config.abspath('_builddir')
+ buildcxcdir = self.config.abspath('_buildcxcdir')
tmproot = self.config.abspath('_tmproot')
if self.opts.trace():
_notice(self.opts, 'cleanup: %s' % (buildroot))
@@ -416,6 +441,10 @@ class build:
if self.opts.trace():
_notice(self.opts, 'cleanup: %s' % (builddir))
self.rmdir(builddir)
+ if self.canadian_cross():
+ if self.opts.trace():
+ _notice(self.opts, 'cleanup: %s' % (buildcxcdir))
+ self.rmdir(buildcxcdir)
if self.opts.trace():
_notice(self.opts, 'cleanup: %s' % (tmproot))
self.rmdir(tmproot)
@@ -427,22 +456,24 @@ class build:
def make(self):
package = self.main_package()
name = package.name()
- _notice(self.opts, 'package: %s' % (name))
+ if self.canadian_cross():
+ _notice(self.opts, 'package: (Cxc) %s' % (name))
+ else:
+ _notice(self.opts, 'package: %s' % (name))
self.script.reset()
self.script.append(self.config.expand('%{___build_template}'))
self.script.append('echo "=> ' + name + ':"')
self.prep(package)
- self.build(package)
- self.install(package)
- self.files(package)
- if not self.opts.no_clean():
- self.clean(package)
+ self.build_package(package)
if not self.opts.dry_run():
self.builddir()
sn = path.join(self.config.expand('%{_builddir}'), 'doit')
self._output('write script: ' + sn)
self.script.write(sn)
- _notice(self.opts, 'building: ' + name)
+ if self.canadian_cross():
+ _notice(self.opts, 'building: (Cxc) %s' % (name))
+ else:
+ _notice(self.opts, 'building: %s' % (name))
self.run(sn)
def name(self):
@@ -490,7 +521,8 @@ def run(args):
_notice(opts, 'RTEMS Source Builder, Package Builder v%s' % (version))
if not check.host_setup(opts, _defaults):
if not opts.force():
- raise error.general('host build environment is not set up correctly (use --force to proceed)')
+ raise error.general('host build environment is not set up' +
+ ' correctly (use --force to proceed)')
_notice(opts, 'warning: forcing build with known host setup problems')
if opts.get_arg('--list-configs'):
configs = get_configs(opts, _defaults)
diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py
index 2a4850d..3ebc6ee 100644
--- a/source-builder/sb/config.py
+++ b/source-builder/sb/config.py
@@ -25,6 +25,7 @@
# other software modules.
#
+import copy
import os
import re
import sys
@@ -54,9 +55,10 @@ def _check_bool(value):
class package:
- def __init__(self, name, arch):
+ def __init__(self, name, arch, config):
self._name = name
self._arch = arch
+ self.config = config
self.directives = {}
self.infos = {}
@@ -91,12 +93,15 @@ class package:
self.infos[info] = []
self.infos[info].append(data)
- def get_info(self, info):
+ def get_info(self, info, expand = True):
if info in self.infos:
- return self.infos[info]
+ if expand:
+ return self.config.expand(self.infos[info])
+ else:
+ return self.infos[info]
return None
- def extract_info(self, label):
+ def extract_info(self, label, expand = True):
infos = {}
for i in self.infos:
il = i.lower()
@@ -105,19 +110,25 @@ class package:
il = label + '0'
elif not il[len(label):].isdigit():
continue
- infos[il] = self.infos[i]
+ infos[il] = self.config.expand(self.infos[i])
return infos
- def find_info(self, label):
+ def find_info(self, label, expand = True):
for i in self.infos:
if i.lower() == label:
- return self.infos[i]
+ if expand:
+ return self.config.expand(self.infos[i])
+ else:
+ return self.infos[i]
return None
- def find_directive(self, label):
+ def find_directive(self, label, expand = True):
for d in self.directives:
if d.lower() == label:
- return self.directives[d]
+ if expand:
+ return self.config.expand(self.directives[d])
+ else:
+ return self.directives[d]
return None
def name(self):
@@ -261,6 +272,8 @@ class file:
'''Split the string (s) up by macros. Only split on the
outter level. Nested levels will need to split with futher calls.'''
trace_me = False
+ if trace_me:
+ print '------------------------------------------------------'
macros = []
nesting = []
has_braces = False
@@ -316,6 +329,8 @@ class file:
c += 1
if trace_me:
print 'ms:', macros
+ if trace_me:
+ print '-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='
return macros
def _shell(self, line):
@@ -331,8 +346,12 @@ class file:
return line
def _expand(self, s):
+ expand_count = 0
expanded = True
while expanded:
+ expand_count += 1
+ if expand_count > 500:
+ raise error.general('macro expand looping: %s' % (s))
expanded = False
ms = self._macro_split(s)
for m in ms:
@@ -580,20 +599,20 @@ class file:
isos = False
if isvalid:
os = self.define('_os')
- if ls[0].find(os) >= 0 or ls[1].find(os) >= 0:
- isos = True
- else:
- isos = False
+ for l in ls:
+ if l in os:
+ isos = True
+ break
return self._ifs(config, ls, '%ifos', isos, isvalid)
def _ifarch(self, config, positive, ls, isvalid):
isarch = False
if isvalid:
arch = self.define('_arch')
- if ls[0].find(arch) >= 0 or ls[1].find(arch) >= 0:
- isarch = True
- else:
- isarch = False
+ for l in ls:
+ if l in arch:
+ isarch = True
+ break
if not positive:
isarch = not isarch
return self._ifs(config, ls, '%ifarch', isarch, isvalid)
@@ -621,12 +640,14 @@ class file:
continue
if self.opts.trace():
print '%03d: %d %s' % (self.lc, isvalid, l)
+ lo = l
if isvalid:
l = self._expand(l)
if len(l) == 0:
continue
if l[0] == '%':
ls = self.wss.split(l, 2)
+ los = self.wss.split(lo, 2)
if ls[0] == '%package':
if isvalid:
if ls[1] == '-n':
@@ -668,11 +689,11 @@ class file:
return ('data', d)
elif ls[0] == '%endif':
if roc:
- return ('control', '%endif')
+ return ('control', '%endif', '%endif')
self._warning("unexpected '" + ls[0] + "'")
elif ls[0] == '%else':
if roc:
- return ('control', '%else')
+ return ('control', '%else', '%else')
self._warning("unexpected '" + ls[0] + "'")
elif ls[0].startswith('%defattr'):
return ('data', [l])
@@ -697,10 +718,10 @@ class file:
if ls[0].strip() == d:
return ('directive', ls[0].strip(), ls[1:])
self._warning("unknown directive: '" + ls[0] + "'")
- return ('data', [l])
+ return ('data', [lo])
else:
- return ('data', [l])
- return ('control', '%end')
+ return ('data', [lo])
+ return ('control', '%end', '%end')
def _set_package(self, _package):
if self.package == 'main' and \
@@ -734,12 +755,13 @@ class file:
self.in_error = False
self.lc = 0
self.name = name
- self.defines = self.default_defines
+ self.defines = copy.deepcopy(self.default_defines)
self.conditionals = {}
self._packages = {}
self.package = 'main'
self._packages[self.package] = package(self.package,
- self.define('%{_arch}'))
+ self.define('%{_arch}'),
+ self)
self.load_depth += 1
@@ -832,13 +854,15 @@ class file:
data = new_data
elif r[0] == 'data':
for l in r[1]:
- l = self._expand(l)
if l.startswith('%error'):
+ l = self._expand(l)
raise error.general('config error: %s' % (l[7:]))
elif l.startswith('%warning'):
+ l = self._expand(l)
print >> sys.stderr, 'warning: %s' % (l[9:])
self._warning(l[9:])
if not dir:
+ l = self._expand(l)
ls = self.tags.split(l, 1)
if self.opts.trace():
print '_tag: ', l, ls
@@ -873,6 +897,9 @@ class file:
self.load_depth -= 1
+ def defined(self, name):
+ return name.lower() in self.defines
+
def define(self, name):
if name.lower() in self.defines:
d = self.defines[name.lower()]
@@ -888,8 +915,18 @@ class file:
self.defines[name.lower()] = value
def expand(self, line):
+ if type(line) == list:
+ el = []
+ for l in line:
+ el += [self._expand(l)]
+ return el
return self._expand(line)
+ def default(self, name):
+ if name.lower() in self.defines:
+ return self.defines[name.lower()]
+ raise error.general('macro "%s" not found' % (name))
+
def directive(self, _package, name):
if _package not in self._packages:
raise error.general('package "' + _package + '" not found')
diff --git a/source-builder/sb/defaults.py b/source-builder/sb/defaults.py
index 6f1f9b3..27ecbd2 100644
--- a/source-builder/sb/defaults.py
+++ b/source-builder/sb/defaults.py
@@ -58,7 +58,6 @@ defaults = {
# Paths
'_host_platform': ('none', 'none', '%{_host_cpu}-%{_host_vendor}-%{_host_os}%{?_gnu}'),
-'_build': ('none', 'none', '%{_host}'),
'_arch': ('none', 'none', '%{_host_arch}'),
'_sbdir': ('none', 'none', ''),
'_topdir': ('dir', 'required', path.shell(os.getcwd())),
@@ -67,10 +66,13 @@ defaults = {
'_sourcedir': ('dir', 'optional', '%{_topdir}/sources'),
'_patchdir': ('dir', 'optional', '%{_topdir}/patches:%{_sbdir}/patches'),
'_builddir': ('dir', 'optional', '%{_topdir}/build/%{name}-%{version}-%{release}'),
+'_buildcxcdir': ('dir', 'optional', '%{_topdir}/build/%{name}-%{version}-%{release}-cxc'),
'_docdir': ('dir', 'none', '%{_defaultdocdir}'),
'_tmppath': ('dir', 'none', '%{_topdir}/build/tmp'),
'_tmproot': ('dir', 'none', '%{_tmppath}/source-build-%(%{__id_u} -n)/%{_bset}'),
-'buildroot:': ('dir', 'none', '%{_tmppath}/%{name}-root-%(%{__id_u} -n)'),
+'_tmpcxcroot': ('dir', 'none', '%{_tmppath}/source-build-%(%{__id_u} -n)-cxc/%{_bset}'),
+'buildroot': ('dir', 'none', '%{_tmppath}/%{name}-root-%(%{__id_u} -n)'),
+'buildcxcroot': ('dir', 'none', '%{_tmppath}/%{name}-root-%(%{__id_u} -n)-cxc'),
'_datadir': ('dir', 'none', '%{_prefix}/share'),
'_defaultdocdir': ('dir', 'none', '%{_prefix}/share/doc'),
'_exeext': ('none', 'none', ''),
@@ -144,11 +146,14 @@ defaults = {
'__perl': ('exe', 'optional', 'perl'),
'__ranlib': ('exe', 'required', 'ranlib'),
'__rm': ('exe', 'required', '/bin/rm'),
+'__rmfile': ('exe', 'none', '%{__rm} -f'),
+'__rmdir': ('exe', 'none', '%{__rm} -rf'),
'__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'),
+'__touch': ('exe', 'required', '/usr/bin/touch'),
'__unzip': ('exe', 'required', '/usr/bin/unzip'),
'__xz': ('exe', 'required', '/usr/bin/xz'),
@@ -160,9 +165,11 @@ defaults = {
# Prebuild set up script.
'___build_pre': ('none', 'none', '''# ___build_pre in as set up in defaults.py
# Directories
+%{?_prefix:SB_PREFIX="%{_prefix}"}
+%{?_prefix:SB_PREFIX_CLEAN=$(echo "%{_prefix}" | %{__sed} -e \'s/^\///\')}
SB_SOURCE_DIR="%{_sourcedir}"
SB_BUILD_DIR="%{_builddir}"
-SB_OPT_FLAGS="%{?_tmproot:-I%{_tmproot}/%{_prefix}/include -L%{_tmproot}/%{_prefix}/lib} %{optflags}"
+SB_OPT_FLAGS="%{?_tmproot:-I%{_tmproot}/${SB_PREFIX_CLEAN}/include -L%{_tmproot}/${SB_PREFIX_CLEAN}/lib} %{optflags}"
SB_ARCH="%{_arch}"
SB_OS="%{_os}"
export SB_SOURCE_DIR SB_BUILD_DIR SB_OPT_FLAGS SB_ARCH SB_OS
@@ -173,15 +180,38 @@ export SB_DOC_DIR
SB_PACKAGE_NAME="%{name}"
SB_PACKAGE_VERSION="%{version}"
SB_PACKAGE_RELEASE="%{release}"
-export SBPACKAGE_NAME SB_PACKAGE_VERSION SB_PACKAGE_RELEASE
-# Build root directory
+export SB_PACKAGE_NAME SB_PACKAGE_VERSION SB_PACKAGE_RELEASE
+# Build directories
+export SB_PREFIX
+%{?_builddir:SB_BUILD_DIR="%{_builddir}"}
%{?buildroot:SB_BUILD_ROOT="%{buildroot}"}
-export SB_BUILD_ROOT
+%{?buildroot:%{?_prefix:SB_BUILD_ROOT_BINDIR="%{buildroot}/${SB_PREFIX_CLEAN}/bin"}}
+export SB_BUILD_ROOT SB_BUILD_DIR SB_BUILD_ROOT_BINDIR
+%{?_buildcxcdir:SB_BUILD_CXC_DIR="%{_buildcxcdir}"}
+%{?buildcxcroot:SB_BUILD_CXC_ROOT="%{buildcxcroot}"}
+%{?buildcxcroot:%{?_prefix:SB_BUILD_CXC_ROOT_BINDIR="%{buildcxcroot}/${SB_PREFIX_CLEAN}/bin"}}
+export SB_BUILD_CXC_ROOT SB_BUILD_CXC_DIR SB_BUILD_CXC_ROOT_BINDIR
+%{?_tmproot:SB_TMPROOT="%{_tmproot}"}
+%{?_tmproot:%{?_prefix:SB_TMPPREFIX="%{_tmproot}/${SB_PREFIX_CLEAN}"}}
+%{?_tmproot:%{?_prefix:SB_TMPBINDIR="%{_tmproot}/${SB_PREFIX_CLEAN}/bin"}}
+export SB_TMPROOT SB_TMPPREFIX SB_TMPBINDIR
+%{?_tmpcxcroot:SB_TMPCXCROOT="%{_tmproot}"}
+%{?_tmpcxcroot:%{?_prefix:SB_TMPCXCPREFIX="%{_tmpcxcroot}/${SB_PREFIX_CLEAN}"}}
+%{?_tmpcxcroot:%{?_prefix:SB_TMPCXCBINDIR="%{_tmpcxcroot}/${SB_PREFIX_CLEAN}/bin"}}
+export SB_TMPCXCROOT SB_TMPCXCPREFIX SB_TMPCXCBINDIR
# The compiler flags
%{?_targetcflags:CFLAGS_FOR_TARGET="%{_targetcflags}"}
%{?_targetcxxflags:CXXFLAGS_FOR_TARGET="%{_targetcxxflags}"}
export CFLAGS_FOR_TARGET
export CXXFLAGS_FOR_TARGET
+# Set up the path. Put the CXC path first.
+if test -n "${SB_TMPBINDIR}" ; then
+ PATH="${SB_TMPBINDIR}:$PATH"
+fi
+if test -n "${SB_TMPCXCBINDIR}" ; then
+ PATH="${SB_TMPCXCBINDIR}:$PATH"
+fi
+export PATH
# Default environment set up.
LANG=C
export LANG
@@ -449,7 +479,8 @@ class command_line:
s = s.replace(m, _defaults[name][2])
expanded = True
else:
- raise error.general('cannot process default macro: ' + m)
+ raise error.general('cannot expand default macro: %s in "%s"' %
+ (m, s))
return s
def command(self):
@@ -555,10 +586,13 @@ def load(args, optargs = None):
if os.name == 'nt':
import windows
overrides = windows.load()
- else:
+ elif os.name == 'posix':
uname = os.uname()
try:
- if uname[0] == 'Darwin':
+ if uname[0].startswith('CYGWIN_NT'):
+ import windows
+ overrides = windows.load()
+ elif uname[0] == 'Darwin':
import darwin
overrides = darwin.load()
elif uname[0] == 'FreeBSD':
@@ -569,6 +603,8 @@ def load(args, optargs = None):
overrides = linux.load()
except:
pass
+ else:
+ raise error.general('unsupported host type; please add')
if overrides is None:
raise error.general('no hosts defaults found; please add')
for k in overrides:
diff --git a/source-builder/sb/execute.py b/source-builder/sb/execute.py
index ad4ffde..fda4974 100755
--- a/source-builder/sb/execute.py
+++ b/source-builder/sb/execute.py
@@ -102,14 +102,20 @@ class execute:
def _readthread(fh, out, prefix = ''):
"""Read from a file handle and write to the output handler
until the file closes."""
+ count = 0
while True:
line = fh.readline()
+ count += 1
if len(line) == 0:
break
if out:
out(prefix + line)
else:
log.output(prefix + line)
+ if count > 10:
+ log.flush()
+ count = 0
+
def _timerthread(proc, timer):
"""Timer thread calls the timer handler if one
is present once a second. The user provides a handler
diff --git a/source-builder/sb/setbuilder.py b/source-builder/sb/setbuilder.py
index 5e5cfea..b692c66 100644
--- a/source-builder/sb/setbuilder.py
+++ b/source-builder/sb/setbuilder.py
@@ -122,48 +122,58 @@ class buildset:
r.make(_config, outname)
del r
- def first_package(self, _build):
- tmproot = path.abspath(_build.config.expand('%{_tmproot}'))
- _build.rmdir(tmproot)
- _build.mkdir(tmproot)
- prefix = _build.config.expand('%{_prefix}')
- if prefix[0] == os.sep:
- prefix = prefix[1:]
- tmpprefix = path.join(tmproot, prefix)
- tmpbindir = path.join(tmpprefix, 'bin')
- # exporting to the environment
- os.environ['SB_TMPPREFIX'] = tmpprefix
- os.environ['SB_TMPBINDIR'] = tmpbindir
- os.environ['SB_ORIG_PATH'] = os.environ['PATH']
- os.environ['PATH'] = path.host(tmpbindir) + os.pathsep + os.environ['PATH']
- self._output('path: ' + os.environ['PATH'])
- # shell format
- return tmproot
-
- def every_package(self, _build, tmproot):
- src = _build.config.abspath('%{buildroot}')
- dst = tmproot
- if self.opts.get_arg('--bset-tar-file'):
- what = '%s -> %s' % \
- (os.path.relpath(path.host(src)), os.path.relpath(path.host(dst)))
- if self.opts.trace():
- _notice(self.opts, 'collecting: %s' % (what))
- if not self.opts.dry_run():
- self.copy(src, dst)
- if not self.opts.get_arg('--no-install'):
- dst = _build.config.expand('%{_prefix}')
- src = path.join(src, dst)
- _notice(self.opts, 'installing: %s -> %s' % (_build.name(), path.host(dst)))
- if not self.opts.dry_run():
- self.copy(src, dst)
+ def root_copy(self, src, dst):
+ what = '%s -> %s' % \
+ (os.path.relpath(path.host(src)), os.path.relpath(path.host(dst)))
+ if self.opts.trace():
+ _notice(self.opts, 'collecting: %s' % (what))
+ if not self.opts.dry_run():
+ self.copy(src, dst)
- def last_package(self, _build, tmproot):
+ def install(self, name, buildroot, prefix):
+ dst = prefix
+ src = path.join(buildroot, prefix)
+ _notice(self.opts, 'installing: %s -> %s' % (name, path.host(dst)))
+ if not self.opts.dry_run():
+ self.copy(src, dst)
+
+ def canadian_cross(self, _build):
+ defaults_to_save = ['%{_prefix}',
+ '%{_tmproot}',
+ '%{buildroot}',
+ '%{_builddir}',
+ '%{_host}']
+ defaults_to_copy = [('%{_host}', '%{_build}'),
+ ('%{_tmproot}', '%{_tmpcxcroot}'),
+ ('%{buildroot}', '%{buildcxcroot}'),
+ ('%{_builddir}', '%{_buildcxcdir}')]
+ orig_defaults = {}
+ for d in defaults_to_save:
+ orig_defaults[d] = _build.config.default(d)
+ for d in defaults_to_copy:
+ _build.config.set_define(d[0], _build.config.default(d[1]))
+ _build.make()
+ for d in defaults_to_save:
+ _build.config.set_define(d, orig_defaults[d])
+ 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}'))
+
+ def bset_tar(self, _build):
+ tardir = _build.config.expand('%{_tardir}')
if self.opts.get_arg('--bset-tar-file'):
- tardir = _build.config.expand('%{_tardir}')
path.mkdir(tardir)
tar = path.join(tardir, _build.config.expand('%s.tar.bz2' % (self.bset_pkg)))
_notice(self.opts, 'tarball: %s' % (os.path.relpath(path.host(tar))))
if not self.opts.dry_run():
+ tmproot = _build.config.expand('%{_tmproot}')
cmd = _build.config.expand("'cd " + tmproot + \
" && %{__tar} -cf - . | %{__bzip2} > " + tar + "'")
_build.run(cmd, shell_opts = '-c', cwd = tmproot)
@@ -265,7 +275,7 @@ class buildset:
_trace(self.opts, '_bset:%s: configs: %s' % (self.bset, ','.join(configs)))
current_path = os.environ['PATH']
-
+
start = datetime.datetime.now()
try:
@@ -291,14 +301,10 @@ class buildset:
self.opts.get_arg('--pkg-tar-files'),
_defaults = _defaults,
opts = _opts)
- if s == 0:
- tmproot = self.first_package(b)
if deps is None:
- b.make()
- self.report(configs[s], b)
- self.every_package(b, tmproot)
+ self.build_package(configs[s], b)
if s == len(configs) - 1:
- self.last_package(b, tmproot)
+ self.bset_tar(b)
else:
deps += b.config.includes()
builds += [b]
@@ -309,7 +315,13 @@ class buildset:
print gerr
else:
raise
- if deps is None and (not self.opts.no_clean() or self.opts.get_arg('--keep-going')):
+ if deps is None and not self.opts.get_arg('--no-install'):
+ for b in builds:
+ 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.get_arg('--keep-going')):
for b in builds:
_notice(self.opts, 'cleaning: %s' % (b.name()))
b.cleanup()
diff --git a/source-builder/sb/windows.py b/source-builder/sb/windows.py
index d6e7f6b..50241dd 100644
--- a/source-builder/sb/windows.py
+++ b/source-builder/sb/windows.py
@@ -21,13 +21,42 @@
# Windows specific support and overrides.
#
+import error
import pprint
import os
import execute
def load():
+ # Default to the native Windows Python.
uname = 'win32'
+ system = 'mingw32'
+ if os.environ.has_key('HOSTTYPE'):
+ hosttype = os.environ['HOSTTYPE']
+ else:
+ hosttype = 'i686'
+ host_triple = hosttype + '-pc-' + system
+ build_triple = hosttype + '-pc-' + system
+
+ # See if this is actually Cygwin Python
+ if os.name == 'posix':
+ try:
+ uname = os.uname()
+ hosttype = uname[4]
+ uname = uname[0]
+ if uname.startswith('CYGWIN'):
+ if uname.endswith('WOW64'):
+ uname = 'cygwin'
+ build_triple = hosttype + '-pc-' + uname
+ hosttype = 'x86_64'
+ host_triple = hosttype + '-w64-' + system
+ else:
+ raise error.general('invalid uname for Windows')
+ else:
+ raise error.general('invalid POSIX python')
+ except:
+ pass
+
if os.environ.has_key('NUMBER_OF_PROCESSORS'):
ncpus = int(os.environ['NUMBER_OF_PROCESSORS'])
else:
@@ -36,14 +65,11 @@ def load():
smp_mflags = '-j' + str(ncpus)
else:
smp_mflags = ''
- if os.environ.has_key('HOSTTYPE'):
- hosttype = os.environ['HOSTTYPE']
- else:
- hosttype = 'i686'
- system = 'mingw32'
+
defines = {
'_os': ('none', 'none', 'win32'),
- '_host': ('triplet', 'required', hosttype + '-pc-' + system),
+ '_build': ('triplet', 'required', build_triple),
+ '_host': ('triplet', 'required', host_triple),
'_host_vendor': ('none', 'none', 'microsoft'),
'_host_os': ('none', 'none', 'win32'),
'_host_cpu': ('none', 'none', hosttype),