summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2017-06-14 22:58:52 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2017-07-07 11:44:36 +0000
commit23a3a3c746261c3ecb2aa961d91f988f0602a032 (patch)
treea98e6f2d5451025f6ebd0c660c03db1bf306d19e
parentaaefeb1e22579deef6a7829d055eee70c8a7a4f0 (diff)
downloaddefinitions-23a3a3c746261c3ecb2aa961d91f988f0602a032.tar.gz
Support cross-building the stage1 and stage2 components
This requires a feature recently added to BuildStream (in commit 03906221) that adds a framework for elements to support being cross-compiled. To build an armv8l64 native toolchain and sysroot on an x86_64 build machine, for example, you can do this: bst build --target-arch=armv8l64 gnu-toolchain/stage2.bst You can then run `bst checkout` to get at the resulting binaries and copy them onto an armv8l64 machine where they can be executed.
-rw-r--r--elements/gnu-toolchain/base-platform.bst2
-rw-r--r--elements/gnu-toolchain/base-sdk.bst2
-rw-r--r--elements/gnu-toolchain/gcc.bst4
-rw-r--r--elements/gnu-toolchain/linux-api-headers.bst4
-rw-r--r--elements/gnu-toolchain/stage1-gcc.bst4
-rw-r--r--elements/gnu-toolchain/stage2-gcc.bst4
-rw-r--r--elements/gnu-toolchain/stage2-glibc.bst6
-rw-r--r--elements/gnu-toolchain/stage2-linux-api-headers.bst6
-rw-r--r--project.conf2
9 files changed, 17 insertions, 17 deletions
diff --git a/elements/gnu-toolchain/base-platform.bst b/elements/gnu-toolchain/base-platform.bst
index 09c95acb..ce9cdc0a 100644
--- a/elements/gnu-toolchain/base-platform.bst
+++ b/elements/gnu-toolchain/base-platform.bst
@@ -6,7 +6,7 @@ public:
bst:
integration-commands:
- ldconfig
-arches:
+host-arches:
x86_64:
sources:
- kind: ostree
diff --git a/elements/gnu-toolchain/base-sdk.bst b/elements/gnu-toolchain/base-sdk.bst
index cd191fd1..61c29f64 100644
--- a/elements/gnu-toolchain/base-sdk.bst
+++ b/elements/gnu-toolchain/base-sdk.bst
@@ -3,7 +3,7 @@ description: Import the base freedesktop SDK
config:
source: files
target: usr
-arches:
+host-arches:
x86_64:
sources:
- kind: ostree
diff --git a/elements/gnu-toolchain/gcc.bst b/elements/gnu-toolchain/gcc.bst
index 5815cf01..e9a54834 100644
--- a/elements/gnu-toolchain/gcc.bst
+++ b/elements/gnu-toolchain/gcc.bst
@@ -30,7 +30,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-arch}" in
+ case "%{bst-target-arch}" in
armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \
--with-cpu=cortex-a9 \
--with-tune=cortex-a9 \
@@ -50,7 +50,7 @@ config:
build-commands:
- |
- case "%{bst-arch}" in
+ 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
diff --git a/elements/gnu-toolchain/linux-api-headers.bst b/elements/gnu-toolchain/linux-api-headers.bst
index 0020d2ae..db89f18d 100644
--- a/elements/gnu-toolchain/linux-api-headers.bst
+++ b/elements/gnu-toolchain/linux-api-headers.bst
@@ -17,7 +17,7 @@ environment:
config:
install-commands:
- |
- case "%{bst-arch}" in
+ case "%{bst-target-arch}" in
armv5l)
ARCH="arm" ;;
armv7b|armv7l|armv7lhf)
@@ -31,7 +31,7 @@ config:
ppc64)
ARCH="powerpc" ;;
*)
- echo "Error: unsupported Morph architecture: %{bst-arch}" >&2
+ echo "Error: unsupported architecture: %{bst-target-arch}" >&2
exit 1
esac
ARCH=$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 8e9eadfd..bcf30bc3 100644
--- a/elements/gnu-toolchain/stage1-gcc.bst
+++ b/elements/gnu-toolchain/stage1-gcc.bst
@@ -43,7 +43,7 @@ config:
# without an existing libc, and generally try to keep this build as
# simple as possible.
- |
- case "%{bst-arch}" in
+ case "%{bst-target-arch}" in
armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \
--with-cpu=cortex-a9 \
--with-tune=cortex-a9 \
@@ -89,7 +89,7 @@ config:
# 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-arch}" in
+ 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
diff --git a/elements/gnu-toolchain/stage2-gcc.bst b/elements/gnu-toolchain/stage2-gcc.bst
index 2f13723a..beaff58f 100644
--- a/elements/gnu-toolchain/stage2-gcc.bst
+++ b/elements/gnu-toolchain/stage2-gcc.bst
@@ -40,7 +40,7 @@ config:
# 4. This flag causes the correct --sysroot flag to be passed when
# calling stage 1 GCC.
- |
- case "%{bst-arch}" in
+ case "%{bst-target-arch}" in
armv7lhf) ARCH_FLAGS="--with-arch=armv7-a \
--with-cpu=cortex-a9 \
--with-tune=cortex-a9 \
@@ -71,7 +71,7 @@ config:
build-commands:
- |
- case "%{bst-arch}" in
+ 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
diff --git a/elements/gnu-toolchain/stage2-glibc.bst b/elements/gnu-toolchain/stage2-glibc.bst
index 63740088..a5153c5b 100644
--- a/elements/gnu-toolchain/stage2-glibc.bst
+++ b/elements/gnu-toolchain/stage2-glibc.bst
@@ -31,7 +31,7 @@ config:
# 4. Force configuration values of certain things that can't be detected
# in a cross-compile.
- |
- case "%{bst-arch}" in
+ case "%{bst-target-arch}" in
armv7*)
ARCH_FLAGS="--without-fp" ;;
esac
@@ -105,12 +105,12 @@ config:
# sysdeps/unix/sysv/linux/configure.
- install -d %{install-root}/lib
- |
- case "%{bst-arch}" in
+ case "%{bst-target-arch}" in
x86_64)
install -d "%{install-root}/lib64"
ln -s "%{prefix}/lib/ld-linux-x86-64.so.2" \
"%{install-root}/lib64/ld-linux-x86-64.so.2" ;;
- ppc64)
+ ppc64l|ppc64b)
install -d "%{install-root}/lib64"
ln -s "%{prefix}/lib/ld64.so.1" \
"%{install-root}/lib64/ld64.so.1" ;;
diff --git a/elements/gnu-toolchain/stage2-linux-api-headers.bst b/elements/gnu-toolchain/stage2-linux-api-headers.bst
index e5869bf1..10ec224a 100644
--- a/elements/gnu-toolchain/stage2-linux-api-headers.bst
+++ b/elements/gnu-toolchain/stage2-linux-api-headers.bst
@@ -19,7 +19,7 @@ environment:
config:
install-commands:
- |
- case "%{bst-arch}" in
+ case "%{bst-target-arch}" in
armv5l)
ARCH="arm" ;;
armv7b|armv7l|armv7lhf)
@@ -30,10 +30,10 @@ config:
ARCH="i386" ;;
x86_64)
ARCH="x86_64" ;;
- ppc64)
+ ppc64b|ppc64l)
ARCH="powerpc" ;;
*)
- echo "Error: unsupported Morph architecture: %{bst-arch}" >&2
+ echo "Error: unsupported architecture: %{bst-target-arch}" >&2
exit 1
esac
ARCH=$ARCH make INSTALL_HDR_PATH=dest headers_install
diff --git a/project.conf b/project.conf
index fcbcbd78..2e5dbebe 100644
--- a/project.conf
+++ b/project.conf
@@ -12,7 +12,7 @@ aliases:
element-path: elements
variables:
- cpu: "%{bst-arch}"
+ cpu: "%{bst-target-arch}"
abi: gnu
target-stage1: "%{cpu}-bootstrap-linux-%{abi}"
target: "%{cpu}-baserock-linux-%{abi}"