aboutsummaryrefslogtreecommitdiff
path: root/core/musl/build
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-12-30 22:59:26 +0300
committerCem Keylan <cem@ckyln.com>2020-12-30 22:59:26 +0300
commit217e152268e7895a8a78693621305b9412e255d1 (patch)
tree05570b6306a38eacff8654ca5da523d6757a833c /core/musl/build
parent404cc97c9318b7491dd20b7af501146310372e97 (diff)
downloadrepository-217e152268e7895a8a78693621305b9412e255d1.tar.gz
musl: fix cross-compilation
Diffstat (limited to 'core/musl/build')
-rwxr-xr-xcore/musl/build20
1 files changed, 11 insertions, 9 deletions
diff --git a/core/musl/build b/core/musl/build
index efa221f6..f54009cd 100755
--- a/core/musl/build
+++ b/core/musl/build
@@ -3,7 +3,7 @@
# 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)"
+sys_arch="${3:-$(uname -m)}"
kinstall_t() {
# install -Dm* -t alternative
@@ -20,16 +20,20 @@ patch -p0 < CVE-2020-28928.patch
[ "$CPT_CROSS_TRIPLET" ] && CC=$CPT_CROSS_TRIPLET-cc AR=$CPT_CROSS_TRIPLET-ar
-cpt-configure
+cpt-configure \
+ --syslibdir=/usr/lib
make
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)
+case "${CPT_CROSS_TRIPLET:-$sys_arch}" in
+ x86_64*)
+ ln -sf libc.so "$1/usr/lib/ld-musl-x86_64.so.1"
+ ln -s ../lib/ld-musl-x86_64.so.1 "$1/usr/bin/ldd" ;;
+ i?86*)
+ ln -sf libc.so "$1/usr/lib/ld-musl-i686.so.1"
ln -s libc.so "$1/usr/lib/libc.musl-x86.so"
ln -s ../lib/ld-musl-i386.so.1 "$1/usr/bin/ldd"
;;
@@ -41,10 +45,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