summaryrefslogtreecommitdiff
path: root/elements/gnu-toolchain/stage2-glibc.bst
diff options
context:
space:
mode:
Diffstat (limited to 'elements/gnu-toolchain/stage2-glibc.bst')
-rw-r--r--elements/gnu-toolchain/stage2-glibc.bst78
1 files changed, 39 insertions, 39 deletions
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:
- |