diff options
author | Sam Thursfield <sam.thursfield@codethink.co.uk> | 2017-10-27 13:49:38 +0000 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2017-11-05 12:14:48 +0000 |
commit | 4203865325c33d752f814850f43d2ecb16c8fa16 (patch) | |
tree | 8bf81042a356db74fad2905b46ea369a316e4309 /elements/gnu-toolchain/stage2-gcc.bst | |
parent | b917c363cc13b13ed553051844095469e1d6fc82 (diff) | |
download | definitions-4203865325c33d752f814850f43d2ecb16c8fa16.tar.gz |
Replace use of architecture conditionals with generic project conditions
The initial implementation of architecture conditionals has been
removed, as the same behaviours can be implemented using the more
generic mechanism for conditionals that is being introduced for
BuildStream 1.0.
We now have two architecture options: build_arch and arch. They are
documented in project.conf. The first one controls the build sandbox
while the second controls the host and target of the binaries we
produce.
Diffstat (limited to 'elements/gnu-toolchain/stage2-gcc.bst')
-rw-r--r-- | elements/gnu-toolchain/stage2-gcc.bst | 74 |
1 files changed, 45 insertions, 29 deletions
diff --git a/elements/gnu-toolchain/stage2-gcc.bst b/elements/gnu-toolchain/stage2-gcc.bst index 25dbc65d..a7c879e3 100644 --- a/elements/gnu-toolchain/stage2-gcc.bst +++ b/elements/gnu-toolchain/stage2-gcc.bst @@ -1,5 +1,8 @@ kind: manual +description: + Simple native compiler which is used to build all of stage 3. + sources: - kind: git url: upstream:gcc-tarball @@ -16,6 +19,27 @@ depends: variables: prefix: /tools + gcc-arch-flags: '' + gcc-libdir: lib + + (?): + # ARM platforms vary a lot even within a single architecture revision, + # and require tweaks such as this to produce a useful compiler. + # This is a default configuration that has worked for some targets. + - arch in ["armv7b", "armv7l"]: + gcc-arch-flags: --with-arch=armv7-a + - arch in ["armv7blhf", "armv7lhf"]: + gcc-arch-flags: > + --with-arch=armv7-a + --with-cpu=cortex-a9 + --with-tune=cortex-a9 + --with-fpu=vfpv3-d16 + --with-float=hard + + # GCC is hardwired to support 32-bit and 64-bit in parallel on these + # platforms, so 64-bit libraries end up in `lib64` rather than `lib`. + - arch in ["armv8b64", "armv8l64", "x86_64"]: + gcc-libdir: lib64 environment: PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin @@ -40,21 +64,12 @@ config: # 4. This flag causes the correct --sysroot flag to be passed when # calling stage 1 GCC. - | - case "%{bst-target-arch}" in - armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \ - --with-cpu=cortex-a9 \ - --with-tune=cortex-a9 \ - --with-fpu=vfpv3-d16 \ - --with-float=hard" ;; - armv7*) ARCH_FLAGS="--with-arch=armv7-a" ;; - esac export STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))" export CC="%{target-stage1}-gcc --sysroot=$STAGE2_SYSROOT" export CXX="%{target-stage1}-g++ --sysroot=$STAGE2_SYSROOT" export AR="%{target-stage1}-ar" export RANLIB="%{target-stage1}-ranlib" - cd o && ../configure \ - $ARCH_FLAGS \ + cd o && ../configure %{gcc-arch-flags} \ --build=$(sh ../config.guess) \ `# [1]` --host=%{target-stage1} \ `# [1]` --target=%{target-stage1} \ @@ -71,12 +86,6 @@ config: build-commands: - | - case "%{bst-target-arch}" in - armv5*) sed -i "s/--host=none/--host=armv5/" o/Makefile - sed -i "s/--target=none/--target=armv5/" o/Makefile ;; - armv7*) sed -i "s/--host=none/--host=armv7a/" o/Makefile - sed -i "s/--target=none/--target=armv7a/" o/Makefile ;; - esac export STAGE2_SYSROOT="$(dirname $(dirname $(pwd)))" cd o && make @@ -85,22 +94,29 @@ config: # Stage 3 builds need to link against this file in the location that # it will be in the final system, so we make a temporary link now. - # - # On x86_64 GCC resolutely installs its libraries into lib64. To fix this - # would require hobbling the MULTILIB_OSDIRNAMES field in - # gcc/config/i386/t-linux64 and this might break things, so for now we - # tolerate the inconsistency. - | - case "$(echo %{target} | cut -c -6)" in - x86_64) libdir=lib64;; - armv8*64) libdir=lib64;; - *) libdir=lib - esac - install -d "%{install-root}/usr/lib" - ln -s "%{prefix}/$libdir/libgcc_s.so" "%{install-root}/usr/lib/" - ln -s "%{prefix}/$libdir/libgcc_s.so.1" "%{install-root}/usr/lib/" + ln -s "%{prefix}/%{gcc-libdir}/libgcc_s.so" "%{install-root}/usr/lib/" + ln -s "%{prefix}/%{gcc-libdir}/libgcc_s.so.1" "%{install-root}/usr/lib/" strip-commands: - | %{stage2-strip-binaries} + + (?): + # GCC is not passing the correct host/target flags to GMP's configure + # script, which causes it to not use the machine-dependent code for + # the platform and use the generic one instead. However, the generic + # code results on an undefined reference to `__gmpn_invert_limb' in + # ARMv7. Fix the invocation of GMP's configure script so that GMP can + # use the machine-dependent code. + - arch.startswith("armv5"): + build-commands: + (<): + - sed -i "s/--host=none/--host=armv5/" o/Makefile + - sed -i "s/--target=none/--target=armv5/" o/Makefile + - arch.startswith("armv7"): + build-commands: + (<): + - sed -i "s/--host=none/--host=armv7a/" o/Makefile + - sed -i "s/--target=none/--target=armv7a/" o/Makefile |