summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2017-10-27 13:49:38 +0000
committerJavier Jardón <jjardon@gnome.org>2017-11-05 12:14:48 +0000
commit4203865325c33d752f814850f43d2ecb16c8fa16 (patch)
tree8bf81042a356db74fad2905b46ea369a316e4309
parentb917c363cc13b13ed553051844095469e1d6fc82 (diff)
downloaddefinitions-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.
-rw-r--r--elements/bsp-generic.bst14
-rw-r--r--elements/gnu-toolchain/base.bst14
-rw-r--r--elements/gnu-toolchain/fhs-dirs.bst37
-rw-r--r--elements/gnu-toolchain/gcc.bst59
-rw-r--r--elements/gnu-toolchain/glibc.bst15
-rw-r--r--elements/gnu-toolchain/linux-api-headers.bst45
-rw-r--r--elements/gnu-toolchain/stage1-gcc.bst57
-rw-r--r--elements/gnu-toolchain/stage2-fhs-dirs.bst37
-rw-r--r--elements/gnu-toolchain/stage2-gcc.bst74
-rw-r--r--elements/gnu-toolchain/stage2-glibc.bst78
-rw-r--r--elements/gnu-toolchain/stage2-linux-api-headers.bst46
-rw-r--r--project.conf112
12 files changed, 284 insertions, 304 deletions
diff --git a/elements/bsp-generic.bst b/elements/bsp-generic.bst
index 7c16a328..47eb1871 100644
--- a/elements/bsp-generic.bst
+++ b/elements/bsp-generic.bst
@@ -5,12 +5,8 @@ description: |
depends:
- bsp-generic/linux.bst
-arches:
- x86_32:
- depends:
- - bsp-x86_64-generic/nasm.bst
- - bsp-x86_64-generic/syslinux.bst
- x86_64:
- depends:
- - bsp-x86_64-generic/nasm.bst
- - bsp-x86_64-generic/syslinux.bst
+(?):
+ - arch in ["x86_32", "x86_64"]:
+ depends:
+ - bsp-x86_64-generic/nasm.bst
+ - bsp-x86_64-generic/syslinux.bst
diff --git a/elements/gnu-toolchain/base.bst b/elements/gnu-toolchain/base.bst
index 9b364fca..50f01240 100644
--- a/elements/gnu-toolchain/base.bst
+++ b/elements/gnu-toolchain/base.bst
@@ -6,10 +6,10 @@ public:
bst:
integration-commands:
- /usr/bin/ldconfig
-host-arches:
- x86_64:
- sources:
- - kind: ostree
- url: https://ostree.baserock.org/releases/
- track: stage3-sysroot/x86_64
- ref: a9a66b162cb158078cb67e1ba94a8947d1076463f2e5e429caa416f311ac0a01
+(?):
+ - build_arch == "x86_64":
+ sources:
+ - kind: ostree
+ url: https://ostree.baserock.org/releases/
+ track: stage3-sysroot/x86_64
+ ref: a9a66b162cb158078cb67e1ba94a8947d1076463f2e5e429caa416f311ac0a01
diff --git a/elements/gnu-toolchain/fhs-dirs.bst b/elements/gnu-toolchain/fhs-dirs.bst
index 7d9702db..260351b9 100644
--- a/elements/gnu-toolchain/fhs-dirs.bst
+++ b/elements/gnu-toolchain/fhs-dirs.bst
@@ -25,39 +25,14 @@ config:
- install -m 644 protocols "%{install-root}/etc/protocols"
- echo baserock > "%{install-root}/etc/hostname"
-arches:
# Most 64 bit architectures need a /lib64 symlink as well as /lib.
# FIXME: the create-fhs-dirs script should probably handle this...
- armv8b64:
- config:
- install-commands:
- (>):
- - mkdir -p "%{install-root}/usr/lib64"
- - ln -s "./usr/lib64" "%{install-root}/lib64"
- armv8l64:
- config:
- install-commands:
- (>):
- - mkdir -p "%{install-root}/usr/lib64"
- - ln -s "./usr/lib64" "%{install-root}/lib64"
- x86_64:
- config:
- install-commands:
- (>):
- - mkdir -p "%{install-root}/usr/lib64"
- - ln -s "./usr/lib64" "%{install-root}/lib64"
- ppc64l:
- config:
- install-commands:
- (>):
- - mkdir -p "%{install-root}/usr/lib64"
- - ln -s "./usr/lib64" "%{install-root}/lib64"
- ppc64b:
- config:
- install-commands:
- (>):
- - mkdir -p "%{install-root}/usr/lib64"
- - ln -s "./usr/lib64" "%{install-root}/lib64"
+ (?):
+ - arch in ["armv8b64", "armv8l64", "ppc64l", "ppc64b", "x86_64"]:
+ install-commands:
+ (>):
+ - mkdir -p "%{install-root}/usr/lib64"
+ - ln -s "./usr/lib64" "%{install-root}/lib64"
strip-commands:
- |
diff --git a/elements/gnu-toolchain/gcc.bst b/elements/gnu-toolchain/gcc.bst
index 5c43ca24..6bf6e639 100644
--- a/elements/gnu-toolchain/gcc.bst
+++ b/elements/gnu-toolchain/gcc.bst
@@ -1,5 +1,8 @@
kind: manual
+description:
+ Full featured native compiler which builds everything after gnu-toolchain.bst
+
sources:
- kind: git
url: upstream:gcc-tarball
@@ -15,6 +18,23 @@ depends:
- gnu-toolchain/zlib.bst
- gnu-toolchain/m4-tarball.bst
+variables:
+ 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: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
@@ -30,17 +50,7 @@ config:
# 2. Avoid having more than one copy of ZLib in use on the system
# 3. Multilib does not make sense in Baserock.
- |
- 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} \
--prefix="%{prefix}" \
`# [1]` --libdir=%{prefix}/lib \
--disable-bootstrap \
@@ -49,14 +59,7 @@ config:
--enable-languages=c,c++,fortran
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
- cd o && make
+ - cd o && make
install-commands:
- cd o && make DESTDIR="%{install-root}" install
@@ -69,3 +72,21 @@ config:
strip-commands:
- |
%{stage3-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
diff --git a/elements/gnu-toolchain/glibc.bst b/elements/gnu-toolchain/glibc.bst
index a541a771..01c1971f 100644
--- a/elements/gnu-toolchain/glibc.bst
+++ b/elements/gnu-toolchain/glibc.bst
@@ -12,6 +12,13 @@ depends:
- gnu-toolchain/fhs-dirs.bst
- gnu-toolchain/linux-api-headers.bst
+variables:
+ glibc-arch-flags: ''
+
+ (?):
+ - arch.startswith("armv7"):
+ glibc-arch-flags: --without-fp
+
environment:
PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
@@ -21,14 +28,8 @@ config:
- mkdir o
- |
- case "%{bst-arch}" in
- armv7*)
- ARCH_FLAGS="--without-fp" ;;
- esac
-
export CFLAGS="-O2 $CFLAGS";
- cd o && ../configure \
- $ARCH_FLAGS \
+ cd o && ../configure %{glibc-arch-flags} \
--prefix="%{prefix}" \
--disable-profile \
--enable-kernel=3.0.0 \
diff --git a/elements/gnu-toolchain/linux-api-headers.bst b/elements/gnu-toolchain/linux-api-headers.bst
index a8096b31..aefe8a5b 100644
--- a/elements/gnu-toolchain/linux-api-headers.bst
+++ b/elements/gnu-toolchain/linux-api-headers.bst
@@ -13,38 +13,17 @@ depends:
variables:
kernel-arch: unsupported
-
-arches:
- armv5:
- variables:
- kernel-arch: arm
- armv7b:
- variables:
- kernel-arch: arm
- armv7l:
- variables:
- kernel-arch: arm
- armv7lhf:
- variables:
- kernel-arch: arm
- armv8l64:
- variables:
- kernel-arch: arm64
- armv8b64:
- variables:
- kernel-arch: arm64
- ppc64b:
- variables:
- kernel-arch: powerpc
- ppc64l:
- variables:
- kernel-arch: powerpc
- x86_32:
- variables:
- kernel-arch: i386
- x86_64:
- variables:
- kernel-arch: x86_64
+ (?):
+ - arch in ["armv5", "armv7b", "armv7l", "armv7lhf"]:
+ kernel-arch: arm
+ - arch in ["armv8b64", "armv8l64"]:
+ kernel-arch: arm64
+ - arch in ["ppc64b", "ppc64l"]:
+ kernel-arch: powerpc
+ - arch == "x86_32":
+ kernel-arch: i386
+ - arch == "x86_64":
+ kernel-arch: x86_64
environment:
PATH: /usr/bin:/bin:/usr/sbin:/sbin:/tools/bin:/tools/sbin
@@ -53,7 +32,7 @@ config:
install-commands:
- |
if [ '%{kernel-arch}' == 'unsupported' ]; then
- echo "Error: unsupported architecture: %{bst-target-arch}" >&2
+ echo "Error: unsupported architecture: %{arch}" >&2
exit 1
fi
ARCH=%{kernel-arch} make INSTALL_HDR_PATH=dest headers_install
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
diff --git a/elements/gnu-toolchain/stage2-fhs-dirs.bst b/elements/gnu-toolchain/stage2-fhs-dirs.bst
index ba420cb0..128f2f6c 100644
--- a/elements/gnu-toolchain/stage2-fhs-dirs.bst
+++ b/elements/gnu-toolchain/stage2-fhs-dirs.bst
@@ -30,36 +30,11 @@ config:
- install -m 644 protocols "%{install-root}/etc/protocols"
- echo baserock > "%{install-root}/etc/hostname"
-arches:
# Most 64 bit architectures need a /lib64 symlink as well as /lib.
# FIXME: the create-fhs-dirs script should probably handle this...
- armv8b64:
- config:
- install-commands:
- (>):
- - mkdir -p "%{install-root}/usr/lib64"
- - ln -s "./usr/lib64" "%{install-root}/lib64"
- armv8l64:
- config:
- install-commands:
- (>):
- - mkdir -p "%{install-root}/usr/lib64"
- - ln -s "./usr/lib64" "%{install-root}/lib64"
- x86_64:
- config:
- install-commands:
- (>):
- - mkdir -p "%{install-root}/usr/lib64"
- - ln -s "./usr/lib64" "%{install-root}/lib64"
- ppc64l:
- config:
- install-commands:
- (>):
- - mkdir -p "%{install-root}/usr/lib64"
- - ln -s "./usr/lib64" "%{install-root}/lib64"
- ppc64b:
- config:
- install-commands:
- (>):
- - mkdir -p "%{install-root}/usr/lib64"
- - ln -s "./usr/lib64" "%{install-root}/lib64"
+ (?):
+ - arch in ["armv8b64", "armv8l64", "ppc64l", "ppc64b", "x86_64"]:
+ install-commands:
+ (>):
+ - mkdir -p "%{install-root}/usr/lib64"
+ - ln -s "./usr/lib64" "%{install-root}/lib64"
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
diff --git a/elements/gnu-toolchain/stage2-glibc.bst b/elements/gnu-toolchain/stage2-glibc.bst
index e3f13c35..296fdcf6 100644
--- a/elements/gnu-toolchain/stage2-glibc.bst
+++ b/elements/gnu-toolchain/stage2-glibc.bst
@@ -16,6 +16,29 @@ depends:
variables:
prefix: /tools
+ glibc-arch-flags: ''
+ glibc-ld-so-name: 'autodetect'
+ glibc-ld-so-libdir: 'lib'
+
+ (?):
+ - arch.startswith("armv7"):
+ glibc-arch-flags: --without-fp
+
+ - arch in ["armv8b64", "armv8l64"]:
+ glibc-ld-so-name: ld-linux-aarch64.so.1
+
+ - arch == "ppc64b":
+ glibc-ld-so-name: ld64.so.1
+ glibc-ld-so-libdir: lib64
+
+ - arch == "ppc64l":
+ glibc-ld-so-name: ld64.so.2
+ glibc-ld-so-libdir: lib64
+
+ - arch == "x86_64":
+ glibc-ld-so-name: ld-linux-x86-64.so.2
+ glibc-ld-so-libdir: lib64
+
environment:
PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
@@ -33,14 +56,8 @@ config:
# 5. Force configuration values of certain things that can't be detected
# in a cross-compile.
- |
- case "%{bst-target-arch}" in
- armv7*)
- ARCH_FLAGS="--without-fp" ;;
- esac
-
export CFLAGS="-O2 $CFLAGS"; export CXX=false; \
- cd o && ../configure \
- $ARCH_FLAGS \
+ cd o && ../configure %{glibc-arch-flags} \
--build=$(../scripts/config.guess) --host=%{target-stage1} \
--prefix="%{prefix}" \
`# [1]` --libdir="%{prefix}/lib" \
@@ -104,42 +121,25 @@ config:
# like all other bootstrap only components.
ln -s specs-for-sysroot "$target_specs_dir/specs"
- # Install a symlink for the program interpreter (ld.so) so that binaries
- # built in stage 3 before the stage 3 glibc is built can use it.
- #
- # The name of the dynamic loader is hardcoded in GCC during its 'configure'
- # stage, but the file is actually provided by the libc (usually GLIBC). It
- # would be better if we could ask GCC or GLIBC what the expected name of the
- # ld.so is for the given platform rather than figuring it out
- - install -d %{install-root}/lib
- |
- case "%{bst-target-arch}" in
- x86_64)
- install -d "%{install-root}/usr/lib64"
- ln -s "/usr/lib64" "%{install-root}/lib64"
- ln -s "%{prefix}/lib/ld-linux-x86-64.so.2" \
- "%{install-root}/usr/lib64/ld-linux-x86-64.so.2" ;;
- armv8*64)
- install -d "%{install-root}/usr/lib"
- ln -s "/usr/lib64" "%{install-root}/lib64"
- ln -s "%{prefix}/lib/ld-linux-aarch64.so.1" \
- "%{install-root}/usr/lib/ld-linux-aarch64.so.1" ;;
- ppc64l)
- install -d "%{install-root}/usr/lib64"
- ln -s "/usr/lib64" "%{install-root}/lib64"
- ln -s "%{prefix}/lib/ld64.so.2" \
- "%{install-root}/usr/lib64/ld64.so.2" ;;
- ppc64b)
- install -d "%{install-root}/usr/lib64"
- ln -s "/usr/lib64" "%{install-root}/lib64"
- ln -s "%{prefix}/lib/ld64.so.1" \
- "%{install-root}/usr/lib64/ld64.so.1" ;;
- *)
+ # Install a symlink for the program interpreter (ld.so) so that binaries
+ # built in stage 3 before the stage 3 glibc is built can use it.
+ #
+ # The name of the dynamic loader is hardcoded in GCC during its 'configure'
+ # stage, but the file is actually provided by the libc (usually GLIBC). It
+ # would be better if we could ask GCC or GLIBC what the expected name of the
+ # ld.so is for the given platform rather than hardcoding it again here.
+ loader="%{glibc-ld-so-name}"
+
+ if [ "$loader" == "autodetect" ]; then
loader=$(basename $(ls "%{install-root}%{prefix}"/lib/ld-linux*))
[ -z $loader ] && loader=$(basename $(ls "%{install-root}%{prefix}"/lib/ld.so*))
[ -z $loader ] && ( echo "Bug in stage2-glibc ld.so symlinks" ; exit 1 )
- ln -s "%{prefix}/lib/$loader" "%{install-root}/lib/$loader"
- esac
+ fi
+
+ install -d "%{install-root}/usr/%{glibc-ld-so-libdir}"
+ ln -s "/usr/%{glibc-ld-so-libdir}" "%{install-root}/%{glibc-ld-so-libdir}"
+ ln -s "%{prefix}/lib/$loader" "%{install-root}/usr/%{glibc-ld-so-libdir}/$loader"
strip-commands:
- |
diff --git a/elements/gnu-toolchain/stage2-linux-api-headers.bst b/elements/gnu-toolchain/stage2-linux-api-headers.bst
index 67596871..0016cef8 100644
--- a/elements/gnu-toolchain/stage2-linux-api-headers.bst
+++ b/elements/gnu-toolchain/stage2-linux-api-headers.bst
@@ -12,39 +12,19 @@ depends:
variables:
prefix: /tools
- kernel-arch: unsupported
-arches:
- armv5:
- variables:
- kernel-arch: arm
- armv7b:
- variables:
- kernel-arch: arm
- armv7l:
- variables:
- kernel-arch: arm
- armv7lhf:
- variables:
- kernel-arch: arm
- armv8l64:
- variables:
- kernel-arch: arm64
- armv8b64:
- variables:
- kernel-arch: arm64
- ppc64b:
- variables:
- kernel-arch: powerpc
- ppc64l:
- variables:
- kernel-arch: powerpc
- x86_32:
- variables:
- kernel-arch: i386
- x86_64:
- variables:
- kernel-arch: x86_64
+ kernel-arch: unsupported
+ (?):
+ - arch in ["armv5", "armv7b", "armv7l", "armv7lhf"]:
+ kernel-arch: arm
+ - arch in ["armv8b64", "armv8l64"]:
+ kernel-arch: arm64
+ - arch in ["ppc64b", "ppc64l"]:
+ kernel-arch: powerpc
+ - arch == "x86_32":
+ kernel-arch: i386
+ - arch == "x86_64":
+ kernel-arch: x86_64
environment:
PATH: /tools/bin:/usr/bin:/bin:/usr/sbin:/sbin
@@ -53,7 +33,7 @@ config:
install-commands:
- |
if [ '%{kernel-arch}' == 'unsupported' ]; then
- echo "Error: unsupported architecture: %{bst-target-arch}" >&2
+ echo "Error: unsupported architecture: %{arch}" >&2
exit 1
fi
ARCH=%{kernel-arch} make INSTALL_HDR_PATH=dest headers_install
diff --git a/project.conf b/project.conf
index bbccf5e6..6200daa1 100644
--- a/project.conf
+++ b/project.conf
@@ -8,9 +8,75 @@ aliases:
# All the elements go here
element-path: ./elements
+# We list a lot of architectures here and Baserock has supported each of these
+# at some point in the past, however for the list of *currently* supported
+# architectures look in `elements/gnu-toolchain/base.bst`.
+
+options:
+ build_arch:
+ description: |
+ Specifies architecture of the build sandbox.
+
+ This defaults to $(uname -a). On platforms where the Baserock architecture
+ name doesn't match the Linux architecture name, you need to manually
+ specify the Baserock architecture name.
+
+ You can also use this to build for a different architecture provided your
+ host can execute binaries for that architecture. For example, you could
+ run an x86_32 build on an x86_64 machine by setting `build_arch=x86_32`
+ and `arch=x86_32`.
+ type: arch
+ variable: build_arch
+ values: [
+ armv5l, armv7b, armv7l, armv7lhf, armv8l64, armv8b64, mips64b, mips64l,
+ mips32b, mips32l, ppc64b, ppc64l, x86_32, x86_64
+ ]
+
+ arch:
+ description: |
+ Specifies host and target architecture for output binaries.
+
+ Usually this should match build_arch. If it differs, a cross compile
+ will happen up to the gnu-toolchain/stage2.bst stack. Beyond this,
+ cross compilation isn't supported.
+
+ For instructions on how to bootstrap a new architecture, see:
+ http://wiki.baserock.org/guides/how-to-cross-bootstrap/
+ type: arch
+ variable: arch
+ values: [
+ armv5l, armv7b, armv7l, armv7lhf, armv8l64, armv8b64, mips64b, mips64l,
+ mips32b, mips32l, ppc64b, ppc64l, x86_32, x86_64
+ ]
+
variables:
- cpu: "%{bst-target-arch}"
+ cpu: "%{arch}"
abi: gnu
+
+ (?):
+ - arch == "x86_32":
+ cpu: i686
+ - arch in ["armv5l", "armv7b", "armv7l", "armv7lhf"]:
+ cpu: "%{arch}"
+ abi: gnueabi
+ - arch == "armv8l64":
+ cpu: aarch64
+ - arch == "armv8b64":
+ cpu: aarch64_be
+ - arch == "mips64b":
+ cpu: mips64
+ abi: gnuabi64
+ - arch == "mips64l":
+ cpu: mips64el
+ - arch == "mips32b":
+ cpu: mips
+ - arch == "mips32l":
+ cpu: mipsel
+ - arch == "ppc64b":
+ cpu: powerpc64
+ - arch == "ppc64l":
+ cpu: powerpc64le
+
target-stage1: "%{cpu}-bootstrap-linux-%{abi}"
target: "%{cpu}-baserock-linux-%{abi}"
@@ -63,50 +129,6 @@ variables:
artifacts:
pull-url: https://ostree.baserock.org/cache/
-# Resolve the cpu and ABI portions of the host triple based
-# on architecture names.
-arches:
- x86_32:
- variables:
- cpu: i686
- armv5l:
- variables:
- abi: gnueabi
- armv7b:
- variables:
- abi: gnueabi
- armv7l:
- variables:
- abi: gnueabi
- armv7lhf:
- variables:
- abi: gnueabi
- armv8l64:
- variables:
- cpu: aarch64
- armv8b64:
- variables:
- cpu: aarch64_be
- mips64b:
- variables:
- cpu: mips64
- abi: gnuabi64
- mips64l:
- variables:
- cpu: mips64el
- mips32b:
- variables:
- cpu: mips
- mips32l:
- variables:
- cpu: mipsel
- ppc64b:
- variables:
- cpu: powerpc64
- ppc64l:
- variables:
- cpu: powerpc64le
-
split-rules:
locale:
(>):