diff options
author | Chris Johns <chrisj@rtems.org> | 2013-09-10 16:19:20 +1000 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2013-09-10 16:19:20 +1000 |
commit | b8b0f4452f8775bfbcb19cb82da22673f1b74ab1 (patch) | |
tree | 9a37f35c7290e22d43c0e4f291a145190e4f2f2a /source-builder/config/gcc-common-1.cfg | |
parent | doc: Add NetBSD. (diff) | |
download | rtems-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.
Diffstat (limited to 'source-builder/config/gcc-common-1.cfg')
-rw-r--r-- | source-builder/config/gcc-common-1.cfg | 43 |
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 |