summaryrefslogtreecommitdiff
path: root/elements/gnu-toolchain/stage1-gcc.bst
diff options
context:
space:
mode:
Diffstat (limited to 'elements/gnu-toolchain/stage1-gcc.bst')
-rw-r--r--elements/gnu-toolchain/stage1-gcc.bst57
1 files changed, 36 insertions, 21 deletions
diff --git a/elements/gnu-toolchain/stage1-gcc.bst b/elements/gnu-toolchain/stage1-gcc.bst
index 4df5fde7..75c65990 100644
--- a/elements/gnu-toolchain/stage1-gcc.bst
+++ b/elements/gnu-toolchain/stage1-gcc.bst
@@ -1,5 +1,8 @@
kind: autotools
+description:
+ Simple cross compiler which is used to build all of stage2.
+
sources:
- kind: git
url: upstream:gcc-tarball
@@ -12,10 +15,26 @@ depends:
variables:
prefix: /tools
+ gcc-arch-flags: ''
+
+ (?):
+ # 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
environment:
PATH: /tools/bin:/tools/sbin:/usr/bin:/bin:/usr/sbin:/sbin
+
config:
configure-commands:
# Workaround from LFS due GCC not detecting stack protection correctly
@@ -42,17 +61,8 @@ config:
# without an existing libc, and generally try to keep this build as
# simple as possible.
- |
- 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
- cd o && ../configure \
- $ARCH_FLAGS \
+ cd o && ../configure %{gcc-arch-flags} \
--build=$(sh ../config.guess) \
--host=$(sh ../config.guess) \
--target=%{target-stage1} \
@@ -81,20 +91,25 @@ config:
--enable-languages=c,c++
build-commands:
- - |
+ - cd o && make
+
+ install-commands:
+ - cd o && make DESTDIR="%{install-root}" install
+
+ (?):
# 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.
- 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
- cd o && make
-
- install-commands:
- - cd o && make DESTDIR="%{install-root}" install
+ - 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