summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2013-09-10 16:19:20 +1000
committerChris Johns <chrisj@rtems.org>2013-09-10 16:19:20 +1000
commitb8b0f4452f8775bfbcb19cb82da22673f1b74ab1 (patch)
tree9a37f35c7290e22d43c0e4f291a145190e4f2f2a
parentdoc: Add NetBSD. (diff)
downloadrtems-source-builder-b8b0f4452f8775bfbcb19cb82da22673f1b74ab1.tar.bz2
config: Use ${build_top} to change dir to parent.
On NetBSD with ksh changing into a symlink made PWD the link's target path so a 'cd ..' returned you to that parent and not the parent you started from. Record the build top and then change back to that path. Change the package names to the actual packages and remove the extra directory in the build tree. This makes the paths simpler.
-rw-r--r--source-builder/config/autoconf-2-1.cfg16
-rw-r--r--source-builder/config/automake-1-1.cfg16
-rw-r--r--source-builder/config/binutils-2-1.cfg17
-rw-r--r--source-builder/config/dtc-1-1.cfg16
-rw-r--r--source-builder/config/expat-2-1.cfg16
-rw-r--r--source-builder/config/gcc-common-1.cfg43
-rw-r--r--source-builder/config/gdb-7-1.cfg17
7 files changed, 92 insertions, 49 deletions
diff --git a/source-builder/config/autoconf-2-1.cfg b/source-builder/config/autoconf-2-1.cfg
index b187c4c..e322c70 100644
--- a/source-builder/config/autoconf-2-1.cfg
+++ b/source-builder/config/autoconf-2-1.cfg
@@ -25,12 +25,16 @@ VersionControl0: git clone git://git.sv.gnu.org/autoconf
# Prepare the source code.
#
%prep
- %setup -q -c -n %{name}-%{version}
- cd autoconf-%{autoconf_version}
+ build_top=$(pwd)
+
+ %setup -q -n autoconf-%{autoconf_version}
%{?patch0:%patch0 -p1}
- cd ..
+
+ cd ${build_top}
%build
+ build_top=$(pwd)
+
%if %{defined _internal_autotools_path}
export PATH="%{_internal_autotools_path}/bin:${PATH}"
%endif
@@ -59,9 +63,11 @@ VersionControl0: git clone git://git.sv.gnu.org/autoconf
unset CFLAGS_FOR_BUILD
- cd ..
+ cd ${build_top}
%install
+ build_top=$(pwd)
+
export PATH="%{_bindir}:${PATH}"
%{__rmdir} $SB_BUILD_ROOT
@@ -73,4 +79,4 @@ VersionControl0: git clone git://git.sv.gnu.org/autoconf
%{__make} DESTDIR=$SB_BUILD_ROOT install
fi
- cd ..
+ cd ${build_top}
diff --git a/source-builder/config/automake-1-1.cfg b/source-builder/config/automake-1-1.cfg
index 55b8801..f3ba272 100644
--- a/source-builder/config/automake-1-1.cfg
+++ b/source-builder/config/automake-1-1.cfg
@@ -25,12 +25,16 @@ 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}
+ build_top=$(pwd)
+
+ %setup -q -n automake-%{automake_version}
%{?patch0:%patch0 -p1}
- cd ..
+
+ cd ${build_top}
%build
+ build_top=$(pwd)
+
%if %{defined _internal_autotools_path}
export PATH="%{_internal_autotools_path}/bin:${PATH}"
%endif
@@ -58,9 +62,11 @@ VersionControl0: git clone git://git.savannah.gnu.org/automake.git
unset CFLAGS_FOR_BUILD
- cd ..
+ cd ${build_top}
%install
+ build_top=$(pwd)
+
export PATH="%{_bindir}:${PATH}"
%{__rmdir} $SB_BUILD_ROOT
@@ -72,4 +78,4 @@ VersionControl0: git clone git://git.savannah.gnu.org/automake.git
%{__make} DESTDIR=$SB_BUILD_ROOT install
fi
- cd ..
+ cd ${build_top}
diff --git a/source-builder/config/binutils-2-1.cfg b/source-builder/config/binutils-2-1.cfg
index 460536e..28238f3 100644
--- a/source-builder/config/binutils-2-1.cfg
+++ b/source-builder/config/binutils-2-1.cfg
@@ -38,9 +38,10 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
# Prepare the source code.
#
%prep
+ build_top=$(pwd)
+
source_dir_0="binutils-%{binutils_version}"
- %setup -q -c -n %{name}-%{version}
- cd ${source_dir_0}
+ %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}}
@@ -51,9 +52,12 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{?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 ..
+
+ cd ${build_top}
%build
+ build_top=$(pwd)
+
%{build_directory}
mkdir -p ${build_dir}
@@ -75,9 +79,12 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
--mandir=%{_mandir} --infodir=%{_infodir}
%{__make} %{?_smp_mflags} all
- cd ..
+
+ cd ${build_top}
%install
+ cd ${build_top}
+
%{__rmdir} $SB_BUILD_ROOT
cd ${build_dir}
@@ -109,4 +116,4 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{__rmfile} ${SB_BUILD_ROOT}%{_mandir}/man1/%{_target}-windmc*
fi
- cd ..
+ cd ${build_top}
diff --git a/source-builder/config/dtc-1-1.cfg b/source-builder/config/dtc-1-1.cfg
index 2ca99cf..14d9639 100644
--- a/source-builder/config/dtc-1-1.cfg
+++ b/source-builder/config/dtc-1-1.cfg
@@ -24,8 +24,9 @@ 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}
+ build_top=$(pwd)
+
+ %setup -q -n dtc-v%{dtc_version}
%{?patch0:%patch0 -p1}
%{?patch1:%patch1 -p1}
%{?patch2:%patch2 -p1}
@@ -34,21 +35,26 @@ Source0: http://www.jdl.com/software/dtc-v%{dtc_version}.tgz
%{?patch5:%patch5 -p1}
%{?patch6:%patch6 -p1}
%{?patch7:%patch7 -p1}
- cd ..
+
+ cd ${build_top}
%build
+ build_top=$(pwd)
+
cd dtc-v%{dtc_version}
%{build_build_flags}
%{__make} PREFIX=%{_prefix}
- cd ..
+ cd ${build_top}
%install
+ build_top=$(pwd)
+
rm -rf $SB_BUILD_ROOT
cd dtc-v%{dtc_version}
%{__make} DESTDIR=$SB_BUILD_ROOT PREFIX=%{_prefix} install
- cd ..
+ cd ${build_top}
diff --git a/source-builder/config/expat-2-1.cfg b/source-builder/config/expat-2-1.cfg
index 91dc245..cd91012 100644
--- a/source-builder/config/expat-2-1.cfg
+++ b/source-builder/config/expat-2-1.cfg
@@ -24,12 +24,16 @@ 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}
+ build_top=$(pwd)
+
+ %setup -q -n expat-%{expat_version}
%{?patch0:%patch0 -p1}
- cd ..
+
+ cd ${build_top}
%build
+ build_top=$(pwd)
+
cd expat-%{expat_version}
%{host_build_flags}
@@ -44,12 +48,14 @@ Source0: http://downloads.sourceforge.net/project/expat/expat/%{expat_version}/e
%{__make} %{?_smp_mflags} all
- cd ..
+ cd ${build_top}
%install
+ build_top=$(pwd)
+
rm -rf $SB_BUILD_ROOT
cd expat-%{expat_version}
%{__make} DESTDIR=$SB_BUILD_ROOT install
- cd ..
+ cd ${build_top}
diff --git a/source-builder/config/gcc-common-1.cfg b/source-builder/config/gcc-common-1.cfg
index cb2670c..017971b 100644
--- a/source-builder/config/gcc-common-1.cfg
+++ b/source-builder/config/gcc-common-1.cfg
@@ -35,11 +35,15 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
# Prepare the source code.
#
%prep
+ # save the build top directory and cd back to it rather than
+ # using 'cd ..' because some shells change $PWD to a symlink's
+ # target location and 'cd ..' fails.
+ build_top=$(pwd)
+
# gcc and optional the g++ core if separate packages
source_dir_0="gcc-%{gcc_version}"
- %setup -q -c -n %{name}-%{version}
- %{?source1:%setup -q -D -T -n %{name}-%{version} -a1}
- cd ${source_dir_0}
+ %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}}
@@ -50,12 +54,11 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{?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 ..
+ cd ${build_top}
# newlib
source_dir_10="newlib-%{newlib_version}"
- %setup -q -D -T -n %{name}-%{version} -a10
- cd ${source_dir_10}
+ %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}}
@@ -66,7 +69,7 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{?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 ..
+ cd ${build_top}
# Link newlib into the gcc source tree
%{__rmfile} ${source_dir_0}/newlib
@@ -74,30 +77,27 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
# MPFR
source_dir_20="mpfr-%{mpfr_version}"
- %setup -q -D -T -n %{name}-%{version} -a20
- cd ${source_dir_20}
+ %setup -q -D -T -n mpfr-%{mpfr_version} -b20
%{?patch20:%patch20 -p1}
- cd ..
+ cd ${build_top}
# Build MPFR one-tree style
%{__rmfile} ${source_dir_0}/mpfr
%{__ln_s} $PWD/${source_dir_20} ${source_dir_0}/mpfr
# MPC
source_dir_21="mpc-%{mpc_version}"
- %setup -q -D -T -n %{name}-%{version} -a21
- cd ${source_dir_21}
+ %setup -q -D -T -n mpc-%{mpc_version} -b21
%{?patch21:%patch21 -p1}
- cd ..
+ cd ${build_top}
# Build MPC one-tree style
%{__rmfile} ${source_dir_0}/mpc
%{__ln_s} $PWD/${source_dir_21} ${source_dir_0}/mpc
# GMP
source_dir_22="gmp-%{gmp_version}"
- %setup -q -D -T -n %{name}-%{version} -a22
- cd ${source_dir_22}
+ %setup -q -D -T -n gmp-%{gmp_version} -b22
%{?patch22:%patch22 -p1}
- cd ..
+ cd ${build_top}
# Build GMP one-tree style
%{__rmfile} ${source_dir_0}/gmp
%{__ln_s} $PWD/${source_dir_22} ${source_dir_0}/gmp
@@ -107,9 +107,11 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
# Fix timestamps
cd ${source_dir_0}
contrib/gcc_update --touch
- cd ..
+ cd ${build_top}
%build
+ build_top=$(pwd)
+
%{build_directory}
mkdir -p ${build_dir}
@@ -175,14 +177,17 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
fi
%{__make} %{?_smp_mflags} all
- cd ..
+
+ cd ${build_top}
%install
+ build_top=$(pwd)
+
%{__rmdir} $SB_BUILD_ROOT
cd ${build_dir}
%{__make} DESTDIR=$SB_BUILD_ROOT install
- cd ..
+ cd ${build_top}
# libiberty doesn't honor --libdir, but always installs to a
# magically guessed _libdir
diff --git a/source-builder/config/gdb-7-1.cfg b/source-builder/config/gdb-7-1.cfg
index 2e41ab4..12cb52e 100644
--- a/source-builder/config/gdb-7-1.cfg
+++ b/source-builder/config/gdb-7-1.cfg
@@ -42,9 +42,10 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
# Prepare the source code.
#
%prep
+ build_top=$(pwd)
+
source_dir_0="gdb-%{gdb_version}"
- %setup -q -c -n %{name}-%{version}
- cd ${source_dir_0}
+ %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}}
@@ -55,9 +56,12 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{?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 ..
+
+ cd ${build_top}
%build
+ build_top=$(pwd)
+
%{build_directory}
mkdir -p ${build_dir}
@@ -90,9 +94,12 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
--mandir=%{_mandir} --infodir=%{_infodir}
%{__make} %{?_smp_mflags} all
- cd ..
+
+ cd ${build_top}
%install
+ build_top=$(pwd)
+
%{__rmdir} $SB_BUILD_ROOT
cd ${build_dir}
@@ -104,4 +111,4 @@ BuildRoot: %{_tmppath}/%{name}-root-%(%{__id_u} -n)
%{__rmfile} $SB_BUILD_ROOT%{_infodir}/dir
touch $SB_BUILD_ROOT%{_infodir}/dir
- cd ..
+ cd ${build_top}