summaryrefslogtreecommitdiffstats
path: root/source-builder
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2014-05-13 23:26:09 +1000
committerChris Johns <chrisj@rtems.org>2014-05-13 23:26:09 +1000
commit9a15c40e1b2ac56a678e79519e1e78160009af92 (patch)
tree308f3f407a06c4073612b813d4d40ed0c5c5c60e /source-builder
parent4.11/rtems-lm32: Use gcc-4.9.0 and fix gdb simulator build on Windows. (diff)
downloadrtems-source-builder-9a15c40e1b2ac56a678e79519e1e78160009af92.tar.bz2
sb: Implement %source and %patch to manage source and patches.
Remove the numbered source and patches and automatically manage sources and patches. This removes the overhead in maintaining large collections of patches.
Diffstat (limited to 'source-builder')
-rw-r--r--source-builder/config/autoconf-2-1.cfg7
-rw-r--r--source-builder/config/automake-1-1.cfg7
-rw-r--r--source-builder/config/binutils-2-1.cfg22
-rw-r--r--source-builder/config/dtc-1-1.cfg13
-rw-r--r--source-builder/config/expat-2-1.cfg6
-rw-r--r--source-builder/config/gcc-4.3-1.cfg14
-rw-r--r--source-builder/config/gcc-4.4-1.cfg14
-rw-r--r--source-builder/config/gcc-4.5-1.cfg20
-rw-r--r--source-builder/config/gcc-4.6-1.cfg14
-rw-r--r--source-builder/config/gcc-4.7-1.cfg14
-rw-r--r--source-builder/config/gcc-4.8-1.cfg20
-rw-r--r--source-builder/config/gcc-4.9-1.cfg20
-rw-r--r--source-builder/config/gcc-common-1.cfg90
-rw-r--r--source-builder/config/gdb-6-1.cfg18
-rw-r--r--source-builder/config/gdb-7-1.cfg22
-rw-r--r--source-builder/config/gettext-0-1.cfg19
-rw-r--r--source-builder/config/glib-2-1.cfg19
-rw-r--r--source-builder/config/libffi-3-1.cfg19
-rw-r--r--source-builder/config/libiconv-1-1.cfg19
-rw-r--r--source-builder/config/libtool-2-1.cfg7
-rw-r--r--source-builder/config/libusb-1-1.cfg12
-rw-r--r--source-builder/config/m4-1-1.cfg10
-rw-r--r--source-builder/config/pixman-0-1.cfg19
-rw-r--r--source-builder/config/qemu-1-1.cfg19
-rw-r--r--source-builder/sb/build.py232
-rw-r--r--source-builder/sb/config.py12
-rw-r--r--source-builder/sb/download.py7
-rw-r--r--source-builder/sb/macros.py48
-rw-r--r--source-builder/sb/setbuilder.py8
-rw-r--r--source-builder/sb/sources.py74
-rw-r--r--source-builder/sb/version.py2
31 files changed, 402 insertions, 425 deletions
diff --git a/source-builder/config/autoconf-2-1.cfg b/source-builder/config/autoconf-2-1.cfg
index 1b01cbf..c08d062 100644
--- a/source-builder/config/autoconf-2-1.cfg
+++ b/source-builder/config/autoconf-2-1.cfg
@@ -21,8 +21,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: ftp://ftp.gnu.org/gnu/autoconf/autoconf-%{autoconf_version}.tar.gz
-VersionControl0: git clone git://git.sv.gnu.org/autoconf
+%source set autoconf ftp://ftp.gnu.org/gnu/autoconf/autoconf-%{autoconf_version}.tar.gz
#
# Prepare the source code.
@@ -30,8 +29,8 @@ VersionControl0: git clone git://git.sv.gnu.org/autoconf
%prep
build_top=$(pwd)
- %setup -q -n autoconf-%{autoconf_version}
- %{?patch0:%patch0 -p1}
+ %source setup autoconf -q -n autoconf-%{autoconf_version}
+ %patch setup autoconf -p1
cd ${build_top}
diff --git a/source-builder/config/automake-1-1.cfg b/source-builder/config/automake-1-1.cfg
index 3a5b4c1..d97c949 100644
--- a/source-builder/config/automake-1-1.cfg
+++ b/source-builder/config/automake-1-1.cfg
@@ -21,8 +21,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: ftp://ftp.gnu.org/gnu/automake/automake-%{automake_version}.tar.gz
-VersionControl0: git clone git://git.savannah.gnu.org/automake.git
+%source set automake ftp://ftp.gnu.org/gnu/automake/automake-%{automake_version}.tar.gz
#
# Prepare the source code.
@@ -30,8 +29,8 @@ VersionControl0: git clone git://git.savannah.gnu.org/automake.git
%prep
build_top=$(pwd)
- %setup -q -n automake-%{automake_version}
- %{?patch0:%patch0 -p1}
+ %source setup automake -q -n automake-%{automake_version}
+ %patch setup automake -p1
cd ${build_top}
diff --git a/source-builder/config/binutils-2-1.cfg b/source-builder/config/binutils-2-1.cfg
index 28238f3..42b45d7 100644
--- a/source-builder/config/binutils-2-1.cfg
+++ b/source-builder/config/binutils-2-1.cfg
@@ -29,10 +29,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-%ifn %{defined Source0}
- Source0: ftp://ftp.gnu.org/gnu/binutils/binutils-%{binutils_version}.tar.bz2
- VersionControl0: cvs -z 9 -d :pserver:anoncvs@sourceware.org:/cvs/src co binutils
-%endif
+%source set binutils ftp://ftp.gnu.org/gnu/binutils/binutils-%{binutils_version}.tar.bz2
#
# Prepare the source code.
@@ -40,18 +37,9 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%prep
build_top=$(pwd)
- source_dir_0="binutils-%{binutils_version}"
- %setup -q -n binutils-%{binutils_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}}
+ source_dir_binutils="binutils-%{binutils_version}"
+ %source setup binutils -q -n binutils-%{binutils_version}
+ %patch setup binutils -p1
cd ${build_top}
@@ -65,7 +53,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{host_build_flags}
- ../${source_dir_0}/configure \
+ ../${source_dir_binutils}/configure \
--build=%{_build} --host=%{_host} \
--target=%{_target} \
--verbose --disable-nls \
diff --git a/source-builder/config/dtc-1-1.cfg b/source-builder/config/dtc-1-1.cfg
index 14d9639..937c628 100644
--- a/source-builder/config/dtc-1-1.cfg
+++ b/source-builder/config/dtc-1-1.cfg
@@ -18,7 +18,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: http://www.jdl.com/software/dtc-v%{dtc_version}.tgz
+%source set dtc http://www.jdl.com/software/dtc-v%{dtc_version}.tgz
#
# Prepare the source code.
@@ -26,15 +26,8 @@ Source0: http://www.jdl.com/software/dtc-v%{dtc_version}.tgz
%prep
build_top=$(pwd)
- %setup -q -n 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}
+ %source setup dtc -q -n dtc-v%{dtc_version}
+ %patch setup dtc -p1
cd ${build_top}
diff --git a/source-builder/config/expat-2-1.cfg b/source-builder/config/expat-2-1.cfg
index cd91012..589bc86 100644
--- a/source-builder/config/expat-2-1.cfg
+++ b/source-builder/config/expat-2-1.cfg
@@ -18,7 +18,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: http://downloads.sourceforge.net/project/expat/expat/%{expat_version}/expat-%{expat_version}.tar.gz
+%source set expat http://downloads.sourceforge.net/project/expat/expat/%{expat_version}/expat-%{expat_version}.tar.gz
#
# Prepare the source code.
@@ -26,8 +26,8 @@ Source0: http://downloads.sourceforge.net/project/expat/expat/%{expat_version}/e
%prep
build_top=$(pwd)
- %setup -q -n expat-%{expat_version}
- %{?patch0:%patch0 -p1}
+ %source setup expat -q -n expat-%{expat_version}
+ %patch setup expat -p1
cd ${build_top}
diff --git a/source-builder/config/gcc-4.3-1.cfg b/source-builder/config/gcc-4.3-1.cfg
index fb1fb0b..d499a15 100644
--- a/source-builder/config/gcc-4.3-1.cfg
+++ b/source-builder/config/gcc-4.3-1.cfg
@@ -11,23 +11,19 @@
#
# GCC core and G++
#
-%ifn %{defined Source0}
- Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
- VersionContro0: git clone git://gcc.gnu.org/git/gcc.git
-%endif
+%source set gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
#
# Newlib
#
-Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
-VersionControl10: cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co newlib
+%source set newlib ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
#
# Packages GCC requires
#
-Source20: http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
-Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
-Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
+%source set mpfr http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
+%source set mpc http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
+%source set gmp ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
# GCC Common build script.
diff --git a/source-builder/config/gcc-4.4-1.cfg b/source-builder/config/gcc-4.4-1.cfg
index 8d39f0d..077792a 100644
--- a/source-builder/config/gcc-4.4-1.cfg
+++ b/source-builder/config/gcc-4.4-1.cfg
@@ -11,25 +11,23 @@
#
# GCC core and G++
#
-Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-core-%{gcc_version}.tar.bz2
-VersionContro0: git clone git://gcc.gnu.org/git/gcc.git
+%source set gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-core-%{gcc_version}.tar.bz2
%if %{enable_cxx}
-Source1: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-g++-%{gcc_version}.tar.gz
+ %source add gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-g++-%{gcc_version}.tar.gz
%endif
#
# Newlib
#
-Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
-VersionControl10: cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co newlib
+%source set newlib ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
#
# Packages GCC requires
#
-Source20: http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
-Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
-Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
+%source set mpfr http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
+%source set mpc http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
+%source set gmp ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
# GCC Common build script.
diff --git a/source-builder/config/gcc-4.5-1.cfg b/source-builder/config/gcc-4.5-1.cfg
index f688fd3..0039f68 100644
--- a/source-builder/config/gcc-4.5-1.cfg
+++ b/source-builder/config/gcc-4.5-1.cfg
@@ -11,29 +11,19 @@
#
# GCC core and G++
#
-%ifn %{defined Source0}
- Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
-%endif
+%source set gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
#
# Newlib
#
-%ifn %{defined Source10}
- Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
-%endif
+%source set newlib ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
#
# Packages GCC requires
#
-%ifn %{defined Source20}
- Source20: http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
-%endif
-%ifn %{defined Source21}
- Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
-%endif
-%ifn %{defined Source22}
- Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
-%endif
+%source set mpfr http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
+%source set mpc http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
+%source set gmp ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
# GCC Common build script.
diff --git a/source-builder/config/gcc-4.6-1.cfg b/source-builder/config/gcc-4.6-1.cfg
index 1d04f96..da5c0ab 100644
--- a/source-builder/config/gcc-4.6-1.cfg
+++ b/source-builder/config/gcc-4.6-1.cfg
@@ -11,25 +11,23 @@
#
# GCC core and G++
#
-Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-core-%{gcc_version}.tar.bz2
-VersionContro0: git clone git://gcc.gnu.org/git/gcc.git
+%source set gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-core-%{gcc_version}.tar.bz2
%if %{enable_cxx}
-Source1: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-g++-%{gcc_version}.tar.gz
+ %source add gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-g++-%{gcc_version}.tar.gz
%endif
#
# Newlib
#
-Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
-VersionControl10: cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co newlib
+%source set newlib ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
#
# Packages GCC requires
#
-Source20: http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
-Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
-Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
+%source set mpfr http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
+%source set mpc http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
+%source set gmp ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
# GCC Common build script.
diff --git a/source-builder/config/gcc-4.7-1.cfg b/source-builder/config/gcc-4.7-1.cfg
index 2b78e01..923ef12 100644
--- a/source-builder/config/gcc-4.7-1.cfg
+++ b/source-builder/config/gcc-4.7-1.cfg
@@ -20,23 +20,19 @@
#
# GCC core and G++
#
-%ifn %{defined Source0}
- Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
- VersionContro0: git clone git://gcc.gnu.org/git/gcc.git
-%endif
+%source set gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
#
# Newlib
#
-Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
-VersionControl10: cvs -z 9 -d :pserver:anoncvs@sources.redhat.com:/cvs/src co newlib
+%source set newlib ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
#
# Packages GCC requires
#
-Source20: http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
-Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
-Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
+%source set mpfr http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
+%source set mpc http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
+%source set gmp ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
# GCC Common build script.
diff --git a/source-builder/config/gcc-4.8-1.cfg b/source-builder/config/gcc-4.8-1.cfg
index 8ae6000..56074b0 100644
--- a/source-builder/config/gcc-4.8-1.cfg
+++ b/source-builder/config/gcc-4.8-1.cfg
@@ -11,29 +11,19 @@
#
# GCC core and G++
#
-%ifn %{defined Source0}
- Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
-%endif
+%source set gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
#
# Newlib
#
-%ifn %{defined Source10}
- Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
-%endif
+%source set newlib ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
#
# Packages GCC requires
#
-%ifn %{defined Source20}
- Source20: http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
-%endif
-%ifn %{defined Source21}
- Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
-%endif
-%ifn %{defined Source22}
- Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
-%endif
+%source set mpfr http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
+%source set mpc http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
+%source set gmp ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
# GCC Common build script.
diff --git a/source-builder/config/gcc-4.9-1.cfg b/source-builder/config/gcc-4.9-1.cfg
index ce2aec0..7d6a440 100644
--- a/source-builder/config/gcc-4.9-1.cfg
+++ b/source-builder/config/gcc-4.9-1.cfg
@@ -11,29 +11,19 @@
#
# GCC core and G++
#
-%ifn %{defined Source0}
- Source0: ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
-%endif
+%source set gcc ftp://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.bz2
#
# Newlib
#
-%ifn %{defined Source10}
- Source10: ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
-%endif
+%source set newlib ftp://sourceware.org/pub/newlib/newlib-%{newlib_version}.tar.gz
#
# Packages GCC requires
#
-%ifn %{defined Source20}
- Source20: http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
-%endif
-%ifn %{defined Source21}
- Source21: http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
-%endif
-%ifn %{defined Source22}
- Source22: ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
-%endif
+%source set mpfr http://www.mpfr.org/mpfr-%{mpfr_version}/mpfr-%{mpfr_version}.tar.bz2
+%source set mpc http://www.multiprecision.org/mpc/download/mpc-%{mpc_version}.tar.gz
+%source set gmp ftp://ftp.gnu.org/gnu/gmp/gmp-%{gmp_version}.tar.bz2
#
# GCC Common build script.
diff --git a/source-builder/config/gcc-common-1.cfg b/source-builder/config/gcc-common-1.cfg
index e8517d6..df24f69 100644
--- a/source-builder/config/gcc-common-1.cfg
+++ b/source-builder/config/gcc-common-1.cfg
@@ -12,15 +12,6 @@
%endif
#
-# Select Snapshot Macro Maps if they have been added.
-#
-%select gcc-snapshot
-%select newlib-snapshot
-%select mpfr-snapshot
-%select mpc-snapshot
-%select gmp-snapshot
-
-#
# The package description.
#
Name: %{_target}-gcc-%{gcc_version}-newlib-%{newlib_version}-%{release}
@@ -50,71 +41,52 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
build_top=$(pwd)
# gcc and optional the g++ core if separate packages
- source_dir_0="gcc-%{gcc_version}"
- %setup -q -n gcc-%{gcc_version}
- %{?source1:%setup -q -D -T -n gcc-%{gcc_version} -b1}
- %{?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}}
+ source_dir_gcc="gcc-%{gcc_version}"
+ %source setup gcc -q -n gcc-%{gcc_version}
+ %patch setup gcc -p1
cd ${build_top}
# newlib
- source_dir_10="newlib-%{newlib_version}"
- %setup -q -D -T -n newlib-%{newlib_version} -b10
- %{?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}}
+ source_dir_newlib="newlib-%{newlib_version}"
+ %source setup newlib -q -D -n newlib-%{newlib_version}
+ %patch setup newlib -p1
cd ${build_top}
# Link newlib into the gcc source tree
- %{__rmfile} ${source_dir_0}/newlib
- %{__ln_s} $PWD/${source_dir_10}/newlib ${source_dir_0}/newlib
+ %{__rmfile} ${source_dir_gcc}/newlib
+ %{__ln_s} $PWD/${source_dir_newlib}/newlib ${source_dir_gcc}/newlib
# MPFR
- source_dir_20="mpfr-%{mpfr_version}"
- %setup -q -D -T -n mpfr-%{mpfr_version} -b20
- %{?patch20:%patch20 -p1}
+ source_dir_mpfr="mpfr-%{mpfr_version}"
+ %source setup mpfr -q -D -n mpfr-%{mpfr_version}
+ %patch setup mpfr -p1
cd ${build_top}
# Build MPFR one-tree style
- %{__rmfile} ${source_dir_0}/mpfr
- %{__ln_s} $PWD/${source_dir_20} ${source_dir_0}/mpfr
+ %{__rmfile} ${source_dir_gcc}/mpfr
+ %{__ln_s} $PWD/${source_dir_mpfr} ${source_dir_gcc}/mpfr
# MPC
- source_dir_21="mpc-%{mpc_version}"
- %setup -q -D -T -n mpc-%{mpc_version} -b21
- %{?patch21:%patch21 -p1}
+ source_dir_mpc="mpc-%{mpc_version}"
+ %source setup mpc -q -D -n mpc-%{mpc_version}
+ %patch setup mpc -p1
cd ${build_top}
# Build MPC one-tree style
- %{__rmfile} ${source_dir_0}/mpc
- %{__ln_s} $PWD/${source_dir_21} ${source_dir_0}/mpc
+ %{__rmfile} ${source_dir_gcc}/mpc
+ %{__ln_s} $PWD/${source_dir_mpc} ${source_dir_gcc}/mpc
# GMP
- source_dir_22="gmp-%{gmp_version}"
- %setup -q -D -T -n gmp-%{gmp_version} -b22
- %{?patch22:%patch22 -p1}
+ source_dir_gmp="gmp-%{gmp_version}"
+ %source setup gmp -q -D -n gmp-%{gmp_version}
+ %patch setup gmp -p1
cd ${build_top}
# Build GMP one-tree style
- %{__rmfile} ${source_dir_0}/gmp
- %{__ln_s} $PWD/${source_dir_22} ${source_dir_0}/gmp
+ %{__rmfile} ${source_dir_gcc}/gmp
+ %{__ln_s} $PWD/${source_dir_gmp} ${source_dir_gcc}/gmp
- echo "%{gcc_version_message}" > ${source_dir_0}/gcc/DEV-PHASE
+ echo "%{gcc_version_message}" > ${source_dir_gcc}/gcc/DEV-PHASE
# Fix timestamps
- cd ${source_dir_0}
+ cd ${source_dir_gcc}
contrib/gcc_update --touch
cd ${build_top}
@@ -149,7 +121,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{host_build_flags}
- ../${source_dir_0}/configure \
+ ../${source_dir_gcc}/configure \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--exec_prefix=%{_exec_prefix} \
@@ -182,7 +154,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
# Bug in gcc-3.2.1:
# Somehow, gcc doesn't get syslimits.h right for Cdn-Xs
mkdir -p gcc/include
- cp ../${source_dir_0}/gcc/gsyslimits.h gcc/include/syslimits.h
+ cp ../${source_dir_gcc}/gcc/gsyslimits.h gcc/include/syslimits.h
fi
%{__make} %{?_smp_mflags} all
@@ -212,10 +184,10 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{__rmfile} $SB_BUILD_ROOT%{_mandir}/man3/*ffi*
# Clean the symlinks away incase the source is a repo
- %{__rmfile} ${source_dir_0}/newlib
- %{__rmfile} ${source_dir_0}/mpfr
- %{__rmfile} ${source_dir_0}/mpc
- %{__rmfile} ${source_dir_0}/gmp
+ %{__rmfile} ${source_dir_gcc}/newlib
+ %{__rmfile} ${source_dir_gcc}/mpfr
+ %{__rmfile} ${source_dir_gcc}/mpc
+ %{__rmfile} ${source_dir_gcc}/gmp
%testing
# Add testing here.
diff --git a/source-builder/config/gdb-6-1.cfg b/source-builder/config/gdb-6-1.cfg
index 678fd85..db76ca3 100644
--- a/source-builder/config/gdb-6-1.cfg
+++ b/source-builder/config/gdb-6-1.cfg
@@ -16,27 +16,15 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-%ifn %{defined Source0}
- Source0: http://ftp.gnu.org/gnu/gdb/gdb-%{gdb_version}.tar.bz2
- VersionControl0 git clone git://sourceware.org/git/gdb.git
-%endif
+%source set gdb http://ftp.gnu.org/gnu/gdb/gdb-%{gdb_version}.tar.bz2
#
# Prepare the source code.
#
%prep
- %setup -q -c -n %{name}-%{version}
+ %source setup gdb -q -c -n %{name}-%{version}
cd gdb-%{gdb_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}}
+ %patch setup gdb -p1
cd ..
%build
diff --git a/source-builder/config/gdb-7-1.cfg b/source-builder/config/gdb-7-1.cfg
index a5f9413..28f19b2 100644
--- a/source-builder/config/gdb-7-1.cfg
+++ b/source-builder/config/gdb-7-1.cfg
@@ -25,10 +25,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-%ifn %{defined Source0}
- Source0: http://ftp.gnu.org/gnu/gdb/gdb-%{gdb_version}.tar.bz2
- VersionControl0 git clone git://sourceware.org/git/gdb.git
-%endif
+%source set gdb http://ftp.gnu.org/gnu/gdb/gdb-%{gdb_version}.tar.bz2
#
# Disable Python on Cxc builds for now.
@@ -44,18 +41,9 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%prep
build_top=$(pwd)
- source_dir_0="gdb-%{gdb_version}"
- %setup -q -n gdb-%{gdb_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}}
+ source_dir_gdb="gdb-%{gdb_version}"
+ %source setup gdb -q -n gdb-%{gdb_version}
+ %patch setup gdb -p1
cd ${build_top}
@@ -78,7 +66,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
LIBS_STATIC=${GDB_LIBS_STATIC} \
LIBS=${GDB_LIBS} \
- ../${source_dir_0}/configure \
+ ../${source_dir_gdb}/configure \
--build=%{_build} --host=%{_host} \
--target=%{_target} \
--verbose --disable-nls \
diff --git a/source-builder/config/gettext-0-1.cfg b/source-builder/config/gettext-0-1.cfg
index 9e241cb..67d978d 100644
--- a/source-builder/config/gettext-0-1.cfg
+++ b/source-builder/config/gettext-0-1.cfg
@@ -19,7 +19,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.3.1.tar.gz
+%source set gettext http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.3.1.tar.gz
#
# Fix the mess iconv is on FreeBSD 10.0.
@@ -34,18 +34,9 @@ Source0: http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.3.1.tar.gz
%prep
build_top=$(pwd)
- source_dir_0="gettext-%{gettext_version}"
- %setup -q -n gettext-%{gettext_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}}
+ source_dir_gettext="gettext-%{gettext_version}"
+ %source setup gettext -q -n gettext-%{gettext_version}
+ %patch setup gettext -p1
cd ${build_top}
@@ -59,7 +50,7 @@ Source0: http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.3.1.tar.gz
%{host_build_flags}
- ../${source_dir_0}/configure \
+ ../${source_dir_gettext}/configure \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--exec_prefix=%{_exec_prefix} \
diff --git a/source-builder/config/glib-2-1.cfg b/source-builder/config/glib-2-1.cfg
index 296d24d..6c40be2 100644
--- a/source-builder/config/glib-2-1.cfg
+++ b/source-builder/config/glib-2-1.cfg
@@ -19,7 +19,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: http://ftp.gnome.org/pub/gnome/sources/glib/%{glib_version_major}/glib-%{glib_version}.tar.xz
+%source set glib http://ftp.gnome.org/pub/gnome/sources/glib/%{glib_version_major}/glib-%{glib_version}.tar.xz
#
# Prepare the source code.
@@ -27,18 +27,9 @@ Source0: http://ftp.gnome.org/pub/gnome/sources/glib/%{glib_version_major}/glib-
%prep
build_top=$(pwd)
- source_dir_0="glib-%{glib_version}"
- %setup -q -n glib-%{glib_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}}
+ source_dir_glib="glib-%{glib_version}"
+ %source setup glib -q -n glib-%{glib_version}
+ %patch setup glib -p1
cd ${build_top}
@@ -57,7 +48,7 @@ Source0: http://ftp.gnome.org/pub/gnome/sources/glib/%{glib_version_major}/glib-
PKG_CONFIG_PATH=$SYSROOT/lib/pkgconfig \
PKG_CONFIG_BUILD_TOP_DIR=$SB_TMPROOT \
%{_ld_library_path}=$SYSROOT/lib \
- ../${source_dir_0}/configure \
+ ../${source_dir_glib}/configure \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--exec_prefix=%{_exec_prefix} \
diff --git a/source-builder/config/libffi-3-1.cfg b/source-builder/config/libffi-3-1.cfg
index 7316331..d258acb 100644
--- a/source-builder/config/libffi-3-1.cfg
+++ b/source-builder/config/libffi-3-1.cfg
@@ -19,7 +19,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: ftp://sourceware.org/pub/libffi/libffi-%{libffi_version}.tar.gz
+%source set libffi ftp://sourceware.org/pub/libffi/libffi-%{libffi_version}.tar.gz
#
# Prepare the source code.
@@ -27,18 +27,9 @@ Source0: ftp://sourceware.org/pub/libffi/libffi-%{libffi_version}.tar.gz
%prep
build_top=$(pwd)
- source_dir_0="libffi-%{libffi_version}"
- %setup -q -n libffi-%{libffi_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}}
+ source_dir_libffi="libffi-%{libffi_version}"
+ %source setup libffi -q -n libffi-%{libffi_version}
+ %patch setup libffi -p1
cd ${build_top}
@@ -52,7 +43,7 @@ Source0: ftp://sourceware.org/pub/libffi/libffi-%{libffi_version}.tar.gz
%{host_build_flags}
- ../${source_dir_0}/configure \
+ ../${source_dir_libffi}/configure \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--exec_prefix=%{_exec_prefix} \
diff --git a/source-builder/config/libiconv-1-1.cfg b/source-builder/config/libiconv-1-1.cfg
index e8d5d3d..1ccecd4 100644
--- a/source-builder/config/libiconv-1-1.cfg
+++ b/source-builder/config/libiconv-1-1.cfg
@@ -20,7 +20,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: http://ftp.gnu.org/pub/gnu/libiconv/libiconv-%{libiconv_version}.tar.gz
+%source set libiconv http://ftp.gnu.org/pub/gnu/libiconv/libiconv-%{libiconv_version}.tar.gz
#
# Prepare the source code.
@@ -28,18 +28,9 @@ Source0: http://ftp.gnu.org/pub/gnu/libiconv/libiconv-%{libiconv_version}.tar.gz
%prep
build_top=$(pwd)
- source_dir_0="libiconv-%{libiconv_version}"
- %setup -q -n libiconv-%{libiconv_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}}
+ source_dir_libiconv="libiconv-%{libiconv_version}"
+ %source setup libiconv -q -n libiconv-%{libiconv_version}
+ %patch setup libiconv -p1
cd ${build_top}
@@ -53,7 +44,7 @@ Source0: http://ftp.gnu.org/pub/gnu/libiconv/libiconv-%{libiconv_version}.tar.gz
%{host_build_flags}
- ../${source_dir_0}/configure \
+ ../${source_dir_libiconv}/configure \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--exec_prefix=%{_exec_prefix} \
diff --git a/source-builder/config/libtool-2-1.cfg b/source-builder/config/libtool-2-1.cfg
index e69493b..9b5a236 100644
--- a/source-builder/config/libtool-2-1.cfg
+++ b/source-builder/config/libtool-2-1.cfg
@@ -21,8 +21,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: ftp://ftp.gnu.org/gnu/libtool/libtool-%{libtool_version}.tar.gz
-VersionControl0: git clone git://git.sv.gnu.org/libtool
+%source set libtool ftp://ftp.gnu.org/gnu/libtool/libtool-%{libtool_version}.tar.gz
#
# Prepare the source code.
@@ -30,8 +29,8 @@ VersionControl0: git clone git://git.sv.gnu.org/libtool
%prep
build_top=$(pwd)
- %setup -q -n libtool-%{libtool_version}
- %{?patch0:%patch0 -p1}
+ %source setup libtool -q -n libtool-%{libtool_version}
+ %patch setup libtool -p1
cd ${build_top}
diff --git a/source-builder/config/libusb-1-1.cfg b/source-builder/config/libusb-1-1.cfg
index 9a3ca3c..4e961ca 100644
--- a/source-builder/config/libusb-1-1.cfg
+++ b/source-builder/config/libusb-1-1.cfg
@@ -17,17 +17,17 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: http://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-%{libusb_version}/libusb-%{libusb_version}.tar.bz2
-VersionControl0: git clone git://git.libusb.org/libusb.git
+%source set libusb http://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb-%{libusb_version}/libusb-%{libusb_version}.tar.bz2
#
# Prepare the source code.
#
%prep
-%setup -q -c -n %{name}-%{version}
-cd libusb-%{libusb_version}
-%{?patch0:%patch0 -p1}
-cd ..
+
+ %source setup libusb -q -c -n %{name}-%{version}
+ cd libusb-%{libusb_version}
+ %patch setup libusb -p1
+ cd ..
%build
export PATH="%{_bindir}:${PATH}"
diff --git a/source-builder/config/m4-1-1.cfg b/source-builder/config/m4-1-1.cfg
index ddd9a7b..3aae1f4 100644
--- a/source-builder/config/m4-1-1.cfg
+++ b/source-builder/config/m4-1-1.cfg
@@ -17,16 +17,16 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: ftp://ftp.gnu.org/gnu/m4/m4-%{m4_version}.tar.gz
+%source set m4 ftp://ftp.gnu.org/gnu/m4/m4-%{m4_version}.tar.gz
#
# Prepare the source code.
#
%prep
-%setup -q -c -n %{name}-%{version}
-cd m4-%{m4_version}
-%{?patch0:%patch0 -p1}
-cd ..
+ %source setup m4 -q -c -n %{name}-%{version}
+ cd m4-%{m4_version}
+ %patch setup m4 -p1
+ cd ..
%build
export PATH="%{_bindir}:${PATH}"
diff --git a/source-builder/config/pixman-0-1.cfg b/source-builder/config/pixman-0-1.cfg
index 552df25..f02c3d6 100644
--- a/source-builder/config/pixman-0-1.cfg
+++ b/source-builder/config/pixman-0-1.cfg
@@ -20,7 +20,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: http://cairographics.org/releases/pixman-%{pixman_version}.tar.gz
+%source set pixman http://cairographics.org/releases/pixman-%{pixman_version}.tar.gz
#
# Prepare the source code.
@@ -28,18 +28,9 @@ Source0: http://cairographics.org/releases/pixman-%{pixman_version}.tar.gz
%prep
build_top=$(pwd)
- source_dir_0="pixman-%{pixman_version}"
- %setup -q -n pixman-%{pixman_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}}
+ source_dir_pixman="pixman-%{pixman_version}"
+ %source setup pixman -q -n pixman-%{pixman_version}
+ %patch setup pixman -p1
cd ${build_top}
@@ -53,7 +44,7 @@ Source0: http://cairographics.org/releases/pixman-%{pixman_version}.tar.gz
%{host_build_flags}
- ../${source_dir_0}/configure \
+ ../${source_dir_pixman}/configure \
--prefix=%{_prefix} \
--bindir=%{_bindir} \
--exec_prefix=%{_exec_prefix} \
diff --git a/source-builder/config/qemu-1-1.cfg b/source-builder/config/qemu-1-1.cfg
index 43c1069..671aa77 100644
--- a/source-builder/config/qemu-1-1.cfg
+++ b/source-builder/config/qemu-1-1.cfg
@@ -18,7 +18,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
#
# Source
#
-Source0: http://wiki.qemu-project.org/download/qemu-%{qemu_version}.tar.bz2
+%source set qemu http://wiki.qemu-project.org/download/qemu-%{qemu_version}.tar.bz2
#
# Prepare the source code.
@@ -26,18 +26,9 @@ Source0: http://wiki.qemu-project.org/download/qemu-%{qemu_version}.tar.bz2
%prep
build_top=$(pwd)
- source_dir_0="qemu-%{qemu_version}"
- %setup -q -n qemu-%{qemu_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}}
+ source_dir_qemu="qemu-%{qemu_version}"
+ %source setup qemu -q -n qemu-%{qemu_version}
+ %patch setup qemu -p1
cd ${build_top}
@@ -61,7 +52,7 @@ Source0: http://wiki.qemu-project.org/download/qemu-%{qemu_version}.tar.bz2
PKG_CONFIG_BUILD_TOP_DIR=$SB_TMPROOT \
%{_ld_library_path}=$SYSROOT/lib \
LDFLAGS="-Wl,-rpath -Wl,/$SB_PREFIX_CLEAN/lib" \
- ../${source_dir_0}/configure \
+ ../${source_dir_qemu}/configure \
--prefix=%{_prefix} \
${CROSS_PREFIX_OPTION} \
--make=%{__make} \
diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py
index eb39349..b6c6ee9 100644
--- a/source-builder/sb/build.py
+++ b/source-builder/sb/build.py
@@ -41,6 +41,7 @@ try:
import log
import options
import path
+ import sources
import version
except KeyboardInterrupt:
print 'abort: user terminated'
@@ -131,63 +132,6 @@ class build:
if not self.opts.dry_run():
path.mkdir(mkpath)
- def source(self, package, source_tag):
- #
- # Scan the sources found in the config file for the one we are
- # after. Infos or tags are lists. Merge in any macro defined
- # sources as these may be overridden by user loaded macros.
- #
- sources = package.sources()
- url = None
- for s in sources:
- tag = s[len('source'):]
- if tag.isdigit():
- if int(tag) == source_tag:
- url = sources[s][0]
- break
- if url is None:
- raise error.general('source tag not found: source%d' % (source_tag))
- source = download.parse_url(url, '_sourcedir', self.config, self.opts)
- download.get_file(source['url'], source['local'], self.opts, self.config)
- if 'symlink' in source:
- source['script'] = '%%{__ln_s} %s ${source_dir_%d}' % (source['symlink'], source_tag)
- elif 'compressed' in source:
- source['script'] = source['compressed'] + ' ' + \
- source['local'] + ' | %{__tar_extract} -'
- else:
- source['script'] = '%{__tar_extract} ' + source['local']
- return source
-
- def patch(self, package, args):
- #
- # Scan the patches found in the config file for the one we are
- # after. Infos or tags are lists.
- #
- patches = package.patches()
- url = None
- for p in patches:
- if args[0][1:].lower() == p:
- url = patches[p][0]
- break
- if url is None:
- raise error.general('patch tag not found: %s' % (args[0]))
- #
- # Parse the URL first in the source builder's patch directory.
- #
- patch = download.parse_url(url, '_patchdir', self.config, self.opts)
- #
- # If not in the source builder package check the source directory.
- #
- if not path.exists(patch['local']):
- patch = download.parse_url(url, '_patchdir', self.config, self.opts)
- download.get_file(patch['url'], patch['local'], self.opts, self.config)
- if 'compressed' in patch:
- patch['script'] = patch['compressed'] + ' ' + patch['local']
- else:
- patch['script'] = '%{__cat} ' + patch['local']
- 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}')
@@ -195,16 +139,54 @@ class build:
return self.config.defined('%{allow_cxc}') and \
_host != _build and _host != _target
- def setup(self, package, args):
- log.output('prep: %s: %s' % (package.name(), ' '.join(args)))
- opts, args = getopt.getopt(args[1:], 'qDcTn:b:a:')
- source_tag = 0
+ def source(self, name):
+ #
+ # Return the list of sources. Merge in any macro defined sources as
+ # these may be overridden by user loaded macros.
+ #
+ _map = 'source-%s' % (name)
+ src_keys = self.macros.map_keys(_map)
+ if len(src_keys) == 0:
+ raise error.general('no source set: %s (%s)' % (name, _map))
+ srcs = []
+ for s in src_keys:
+ sm = self.macros.get(s, globals = False, maps = _map)
+ if sm is None:
+ raise error.internal('source macro not found: %s in %s (%s)' % \
+ (s, name, _map))
+ url = self.config.expand(sm[2])
+ src = download.parse_url(url, '_sourcedir', self.config, self.opts)
+ download.get_file(src['url'], src['local'], self.opts, self.config)
+ if 'symlink' in src:
+ src['script'] = '%%{__ln_s} %s ${source_dir_%s}' % (src['symlink'], name)
+ elif 'compressed' in src:
+ #
+ # Zip files unpack as well so do not use tar.
+ #
+ src['script'] = '%s %s' % (src['compressed'], src['local'])
+ if src['compressed-type'] != 'zip':
+ src['script'] += ' | %{__tar_extract} -'
+ else:
+ src['script'] = '%{__tar_extract} %s' % (src['local'])
+ srcs += [src]
+ return srcs
+
+ def source_setup(self, package, args):
+ log.output('source setup: %s: %s' % (package.name(), ' '.join(args)))
+ setup_name = args[1]
+ args = args[1:]
+ try:
+ opts, args = getopt.getopt(args[1:], 'qDcn:b:a:')
+ except getopt.GetoptError, ge:
+ raise error.general('source setup error: %s' % str(ge))
quiet = False
- unpack_default_source = True
unpack_before_chdir = True
delete_before_unpack = True
create_dir = False
- name = None
+ deleted_dir = False
+ created_dir = False
+ changed_dir = False
+ opt_name = None
for o in opts:
if o[0] == '-q':
quiet = True
@@ -212,51 +194,83 @@ class build:
delete_before_unpack = False
elif o[0] == '-c':
create_dir = True
- elif o[0] == '-T':
- unpack_default_source = False
elif o[0] == '-n':
- name = o[1]
+ opt_name = o[1]
elif o[0] == '-b':
unpack_before_chdir = True
- if not o[1].isdigit():
- raise error.general('setup -b source tag is not a number: %s' % (o[1]))
- source_tag = int(o[1])
elif o[0] == '-a':
unpack_before_chdir = False
- if not o[1].isdigit():
- raise error.general('setup -a source tag is not a number: %s' % (o[1]))
- source_tag = int(o[1])
- source0 = None
- source = self.source(package, source_tag)
- if name is None:
- if source:
- name = source['name']
- else:
- raise error.general('setup source tag not found: %d' % (source_tag))
- name = self._name_(name)
- self.script.append(self.config.expand('cd %{_builddir}'))
- if delete_before_unpack:
- self.script.append(self.config.expand('%{__rm} -rf ' + name))
- if create_dir:
- self.script.append(self.config.expand('%{__mkdir_p} ' + name))
- #
- # If -a? then change directory before unpacking.
- #
- if not unpack_before_chdir or create_dir:
- self.script.append(self.config.expand('cd ' + name))
- #
- # Unpacking the source. Note, treated the same as -a0.
- #
- if unpack_default_source and source_tag != 0:
- source0 = self.source(package, 0)
- if source0 is None:
- raise error.general('no setup source0 tag found')
- self.script.append(self.config.expand(source0['script']))
- self.script.append(self.config.expand(source['script']))
- if unpack_before_chdir and not create_dir:
+ name = None
+ for source in self.source(setup_name):
+ if name is None:
+ if opt_name is None:
+ if source:
+ opt_name = source['name']
+ else:
+ raise error.general('setup source tag not found: %d' % (source_tag))
+ else:
+ name = opt_name
+ name = self._name_(name)
+ self.script.append(self.config.expand('cd %{_builddir}'))
+ if not deleted_dir and delete_before_unpack:
+ self.script.append(self.config.expand('%{__rm} -rf ' + name))
+ deleted_dir = True
+ if not created_dir and create_dir:
+ self.script.append(self.config.expand('%{__mkdir_p} ' + name))
+ created_dir = True
+ if not changed_dir and (not unpack_before_chdir or create_dir):
+ self.script.append(self.config.expand('cd ' + name))
+ changed_dir = True
+ self.script.append(self.config.expand(source['script']))
+ if not changed_dir and (unpack_before_chdir and not create_dir):
self.script.append(self.config.expand('cd ' + name))
+ changed_dir = True
self.script.append(self.config.expand('%{__setup_post}'))
+ def patch_setup(self, package, args):
+ name = args[1]
+ args = args[2:]
+ _map = 'patch-%s' % (name)
+ default_opts = ' '.join(args)
+ patch_keys = self.macros.map_keys(_map)
+ patches = []
+ for p in patch_keys:
+ pm = self.macros.get(p, globals = False, maps = _map)
+ if pm is None:
+ raise error.internal('patch macro not found: %s in %s (%s)' % \
+ (p, name, _map))
+ opts = []
+ url = []
+ for pp in pm[2].split():
+ if len(url) == 0 and pp[0] == '-':
+ opts += [pp]
+ else:
+ url += [pp]
+ if len(url) == 0:
+ raise error.general('patch URL not found: %s' % (' '.join(args)))
+ if len(opts) == 0:
+ opts = default_opts
+ else:
+ opts = ' '.join(opts)
+ opts = self.config.expand(opts)
+ url = self.config.expand(' '.join(url))
+ #
+ # Parse the URL first in the source builder's patch directory.
+ #
+ patch = download.parse_url(url, '_patchdir', self.config, self.opts)
+ #
+ # If not in the source builder package check the source directory.
+ #
+ if not path.exists(patch['local']):
+ patch = download.parse_url(url, '_patchdir', self.config, self.opts)
+ download.get_file(patch['url'], patch['local'], self.opts, self.config)
+ if 'compressed' in patch:
+ patch['script'] = patch['compressed'] + ' ' + patch['local']
+ else:
+ patch['script'] = '%{__cat} ' + patch['local']
+ patch['script'] += ' | %%{__patch} %s' % (opts)
+ self.script.append(self.config.expand(patch['script']))
+
def run(self, command, shell_opts = '', cwd = None):
e = execute.capture_execution(log = log.default, dump = self.opts.quiet())
cmd = self.config.expand('%{___build_shell} -ex ' + shell_opts + ' ' + command)
@@ -278,12 +292,18 @@ class build:
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))
+ if len(args):
+ if args[0] == '%setup':
+ if len(args) == 1:
+ raise error.general('invalid %%setup directive: %s' % (' '.join(args)))
+ if args[1] == 'source':
+ self.source_setup(package, args[1:])
+ elif args[1] == 'patch':
+ self.patch_setup(package, args[1:])
+ 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}"')
diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py
index 5a90a49..9a70155 100644
--- a/source-builder/sb/config.py
+++ b/source-builder/sb/config.py
@@ -37,6 +37,7 @@ try:
import options
import path
import pkgconfig
+ import sources
except KeyboardInterrupt:
print 'user terminated'
sys.exit(1)
@@ -580,6 +581,9 @@ class file:
log.trace('config: %s: _select: %s %s %r' % \
(self.init_name, r, ls[1], self.macros.maps()))
+ def _sources(self, ls):
+ return sources.process(ls[0][1:], ls[1:], self.macros, self._error)
+
def _define(self, config, ls):
if len(ls) <= 1:
log.warning('invalid macro definition')
@@ -796,6 +800,14 @@ class file:
elif ls[0] == '%select':
if isvalid:
self._select(config, ls)
+ elif ls[0] == '%source' or ls[0] == '%patch':
+ if isvalid:
+ d = self._sources(ls)
+ if d is not None:
+ return ('data', d)
+ elif ls[0] == '%patch':
+ if isvalid:
+ self._select(config, ls)
elif ls[0] == '%error':
if isvalid:
return ('data', ['%%error %s' % (self._name_line_msg(l[7:]))])
diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index 7457235..3386aea 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -40,12 +40,16 @@ def _http_parser(source, config, opts):
#
esl = source['ext'].split('.')
if esl[-1:][0] == 'gz':
+ source['compressed-type'] = 'gzip'
source['compressed'] = '%{__gzip} -dc'
elif esl[-1:][0] == 'bz2':
+ source['compressed-type'] = 'bzip2'
source['compressed'] = '%{__bzip2} -dc'
elif esl[-1:][0] == 'zip':
+ source['compressed-type'] = 'zip'
source['compressed'] = '%{__zip} -u'
elif esl[-1:][0] == 'xz':
+ source['compressed-type'] = 'xz'
source['compressed'] = '%{__xz} -dc'
def _patchworks_parser(source, config, opts):
@@ -138,6 +142,9 @@ def parse_url(url, pathkey, config, opts):
source['path'] = url[:colon + 3] + path.dirname(url[colon + 3:])
source['file'] = path.basename(url)
source['name'], source['ext'] = path.splitext(source['file'])
+ if source['name'].endswith('.tar'):
+ source['name'] = source['name'][:-4]
+ source['ext'] = '.tar' + source['ext']
#
# Get the file. Checks the local source directory first.
#
diff --git a/source-builder/sb/macros.py b/source-builder/sb/macros.py
index 194d4ed..1f37ae4 100644
--- a/source-builder/sb/macros.py
+++ b/source-builder/sb/macros.py
@@ -84,7 +84,10 @@ class macros:
text = ''
for f in self.files:
text += '> %s%s' % (f, os.linesep)
- for map in self.macros:
+ maps = sorted(self.macros)
+ maps.remove('global')
+ maps += ['global']
+ for map in maps:
text += '[%s]%s' % (map, os.linesep)
for k in sorted(self.macros[map].keys()):
d = self.macros[map][k]
@@ -162,8 +165,11 @@ class macros:
def __len__(self):
return len(self.keys())
- def keys(self):
- keys = self.macros['global'].keys()
+ def keys(self, globals = True):
+ if globals:
+ keys = self.macros['global'].keys()
+ else:
+ keys = []
for rm in self.get_read_maps():
for mk in self.macros[rm]:
if self.macros[rm][mk][1] == 'undefine':
@@ -180,9 +186,25 @@ class macros:
return False
return True
+ def create_map(self, _map):
+ if _map not in self.macros:
+ self.macros[_map] = {}
+
+ def delete_map(self, _map):
+ if _map in self.macros:
+ self.macros.pop(_map, None)
+
def maps(self):
return self.macros.keys()
+ def map_keys(self, _map):
+ if _map in self.macros:
+ return self.macros[_map].keys()
+ return []
+
+ def map_num_keys(self, _map):
+ return len(self.map_keys(_map))
+
def get_read_maps(self):
return [rm[5:] for rm in self.read_maps]
@@ -348,14 +370,21 @@ class macros:
raise error.general('opening macro file: %s' % \
(path.host(self.expand(name))))
- def get(self, key):
+ def get(self, key, globals = True, maps = None):
if type(key) is not str:
raise TypeError('bad key type: %s' % (type(key)))
key = self.key_filter(key)
- for rm in self.get_read_maps():
+ if maps is None:
+ maps = self.get_read_maps()
+ else:
+ if type(maps) is str:
+ maps = [maps]
+ if type(maps) != list:
+ raise TypeError('bad maps type: %s' % (type(map)))
+ for rm in maps:
if key in self.macros[rm]:
return self.macros[rm][key]
- if key in self.macros['global']:
+ if globals and key in self.macros['global']:
return self.macros['global'][key]
return None
@@ -408,10 +437,10 @@ class macros:
expanded = True
return _str
- def find(self, regex):
+ def find(self, regex, globals = True):
what = re.compile(regex)
keys = []
- for key in self.keys():
+ for key in self.keys(globals):
if what.match(key):
keys += [key]
return keys
@@ -440,6 +469,9 @@ class macros:
return True
return False
+ def unset_write_map(self):
+ self.write_map = 'global'
+
def lock_read_map(self):
self.read_map_locked = True
diff --git a/source-builder/sb/setbuilder.py b/source-builder/sb/setbuilder.py
index 690c37b..b772120 100644
--- a/source-builder/sb/setbuilder.py
+++ b/source-builder/sb/setbuilder.py
@@ -39,6 +39,7 @@ try:
import options
import path
import reports
+ import sources
import version
except KeyboardInterrupt:
print 'abort: user terminated'
@@ -248,9 +249,10 @@ class buildset:
self.macros.undefine(ls[1].strip())
elif ls[0] == '%include':
configs += self.parse(ls[1].strip())
- else:
- raise error.general('%s:%d: invalid directive in build set files: %s' % \
- (self.bset, lc, l))
+ elif ls[0] == '%patch' or ls[0] == '%source':
+ def err(msg):
+ raise error.general('%s:%d: %s' % (self.bset, lc, msg))
+ sources.process(ls[0][1:], ls[1:], self.macros, err)
else:
l = l.strip()
c = build.find_config(l, self.configs)
diff --git a/source-builder/sb/sources.py b/source-builder/sb/sources.py
new file mode 100644
index 0000000..7b4edfd
--- /dev/null
+++ b/source-builder/sb/sources.py
@@ -0,0 +1,74 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2014 Chris Johns (chrisj@rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+#
+# Manage sources and patches
+#
+
+import log
+
+def _args(args):
+ return [i for s in [ii.split() for ii in args] for i in s]
+
+def add(label, args, macros, error):
+ args = _args(args)
+ if len(args) < 2:
+ error('%%%s requires at least 2 arguments' % (label))
+ _map = '%s-%s' % (label, args[0])
+ macros.create_map(_map)
+ macros.set_write_map(_map)
+ index = macros.map_num_keys(_map)
+ macros.define('%s%d' % (label, index), ' '.join(args[1:]))
+ macros.unset_write_map()
+ return None
+
+def set(label, args, macros, error):
+ args = _args(args)
+ if len(args) < 2:
+ error('%%%s requires at least 2 arguments' % (label))
+ _map = '%s-%s' % (label, args[0])
+ macros.create_map(_map)
+ key = '%s0' % (label)
+ if key not in macros.map_keys(_map):
+ macros.set_write_map(_map)
+ macros.define(key, ' '.join(args[1:]))
+ macros.unset_write_map()
+ return None
+
+def setup(label, args, macros, error):
+ args = _args(args)
+ if len(args) < 2:
+ error('%%%s requires at least 2 arguments: %s' % (label, ' '.join(args)))
+ _map = '%s-%s' % (label, args[0])
+ return ['%%setup %s %s' % (label, ' '.join(args))]
+
+def process(label, args, macros, error):
+ if label != 'source' and label != 'patch':
+ error('invalid source type: %s' % (label))
+ args = _args(args)
+ log.output('sources: %s' % (' '.join(args)))
+ if len(args) < 3:
+ error('%%%s requires at least 3 arguments: %s' % (label, ' '.join(args)))
+ if args[0] == 'set':
+ return set(label, args[1:], macros, error)
+ elif args[0] == 'add':
+ return add(label, args[1:], macros, error)
+ elif args[0] == 'setup':
+ return setup(label, args[1:], macros, error)
+ error('invalid %%%s command: %s' % (label, args[0]))
diff --git a/source-builder/sb/version.py b/source-builder/sb/version.py
index 89c2c36..f7ebca8 100644
--- a/source-builder/sb/version.py
+++ b/source-builder/sb/version.py
@@ -24,7 +24,7 @@
#
major = 0
-minor = 2
+minor = 3
revision = 0
def str():