aboutsummaryrefslogtreecommitdiff
path: root/core/musl/build
diff options
context:
space:
mode:
Diffstat (limited to 'core/musl/build')
-rwxr-xr-xcore/musl/build26
1 files changed, 8 insertions, 18 deletions
diff --git a/core/musl/build b/core/musl/build
index 44b80ec1..93396adc 100755
--- a/core/musl/build
+++ b/core/musl/build
@@ -1,10 +1,5 @@
#!/bin/sh -e
-# Set the variable sys_arch so that we can change the
-# build procedure depending on the host arch. Currently,
-# we are only supporting i686 and x86_64.
-sys_arch="$(uname -m)"
-
kinstall_t() {
# install -Dm* -t alternative
# usage: kinstall_t 755 /usr/bin file file2 file3
@@ -18,8 +13,9 @@ kinstall_t() {
patch -p0 < CVE-2020-28928.patch
-./configure \
- --prefix=/usr \
+[ "$CPT_CROSS_TRIPLET" ] && CC=$CPT_CROSS_TRIPLET-cc AR=$CPT_CROSS_TRIPLET-ar
+
+cpt-configure \
--syslibdir=/usr/lib
make
@@ -27,13 +23,9 @@ make DESTDIR="$1" install
mkdir -p "$1/usr/bin"
-case "$sys_arch" in
- x86_64) ln -s /usr/lib/ld-musl-x86_64.so.1 "$1/usr/bin/ldd" ;;
- i*86)
- ln -s libc.so "$1/usr/lib/libc.musl-x86.so"
- ln -s ../lib/ld-musl-i386.so.1 "$1/usr/bin/ldd"
- ;;
-esac
+ARCH=$(sed -n '/^ARCH =/s/.* //p' config.mak)
+ln -sf libc.so "$1/usr/lib/ld-musl-$ARCH.so.1"
+ln -s "../lib/ld-musl-$ARCH.so.1" "$1/usr/bin/ldd"
# Install BSD compatibility headers.
kinstall_t 755 "$1/usr/include/sys" cdefs.h queue.h tree.h
@@ -41,10 +33,8 @@ kinstall_t 755 "$1/usr/include/sys" cdefs.h queue.h tree.h
# Install getconf.
"${CC:=cc}" --static getconf.c -o "$1/usr/bin/getconf"
-case $sys_arch in i*86)
- "$CC" -c __stack_chk_fail_local.c -o __stack_chk_fail_local.o
- ar r "$1/usr/lib/libssp_nonshared.a" __stack_chk_fail_local.o
-esac
+"$CC" -c __stack_chk_fail_local.c -o __stack_chk_fail_local.o
+"${AR:-ar}" r "$1/usr/lib/libssp_nonshared.a" __stack_chk_fail_local.o
# Install getent
kinstall_t 755 "$1/usr/bin" getent