From 30ae09bb76ab48615d0b23ca780be9e60638ccc5 Mon Sep 17 00:00:00 2001 From: Xi Ruoyao Date: Fri, 17 Dec 2021 20:09:06 +0800 Subject: [PATCH] cross-ng: gcc: don't rely on "uname -m" --- chapter05/gcc-pass1.xml | 14 ++++++-------- chapter06/gcc-pass2.xml | 14 +++++++------- chapter08/gcc.xml | 14 ++++++-------- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml index 32ace456a..d060ade5f 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -62,15 +62,13 @@ mv -v gmp-&gmp-version; gmp tar -xf ../mpc-&mpc-version;.tar.gz mv -v mpc-&mpc-version; mpc - On x86_64 hosts, set the default directory name for - 64-bit libraries to lib: + For x86_64 target, set the default directory name for + 64-bit libraries to lib. The command is unnecessary, + but harmless for 32-bit x86. If you are building for another target, + you may need to adjust the command for your target. -case $(uname -m) in - x86_64) - sed -e '/m64=/s/lib64/lib/' \ - -i.orig gcc/config/i386/t-linux64 - ;; -esac +sed -e '/m64=/s/lib64/lib/' \ + -i.orig gcc/config/i386/t-linux64 The GCC documentation recommends building GCC in a dedicated build directory: diff --git a/chapter06/gcc-pass2.xml b/chapter06/gcc-pass2.xml index bf3007848..abe055e3f 100644 --- a/chapter06/gcc-pass2.xml +++ b/chapter06/gcc-pass2.xml @@ -54,14 +54,14 @@ mv -v gmp-&gmp-version; gmp tar -xf ../mpc-&mpc-version;.tar.gz mv -v mpc-&mpc-version; mpc - If building on x86_64, change the default directory name for 64-bit - libraries to lib: + For x86_64 target, set the default directory name for + 64-bit libraries to lib. The command is unnecessary, + but harmless for 32-bit x86. If you are building for another target, + you may need to adjust the command for your target. + +sed -e '/m64=/s/lib64/lib/' \ + -i.orig gcc/config/i386/t-linux64 -case $(uname -m) in - x86_64) - sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 - ;; -esac