summaryrefslogtreecommitdiffstats
path: root/source-builder/config/gcc-common-1.cfg
diff options
context:
space:
mode:
Diffstat (limited to 'source-builder/config/gcc-common-1.cfg')
-rw-r--r--source-builder/config/gcc-common-1.cfg43
1 files changed, 24 insertions, 19 deletions
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