aboutsummaryrefslogtreecommitdiff
path: root/core/musl/build
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2020-05-29 19:19:08 +0300
committerCem Keylan <cem@ckyln.com>2020-05-29 19:19:08 +0300
commit7a5a9fb173076449ffda064c470be4cef0923617 (patch)
tree227f774821055e1aa1ab8ce8a6843670abe3956f /core/musl/build
parentbb1b10de29a866edd6ea16456f2a09bf75a161ce (diff)
downloadrepository-7a5a9fb173076449ffda064c470be4cef0923617.tar.gz
musl: add getent and make build compatible with i686
Diffstat (limited to 'core/musl/build')
-rwxr-xr-xcore/musl/build39
1 files changed, 34 insertions, 5 deletions
diff --git a/core/musl/build b/core/musl/build
index f2150a2f..4a062201 100755
--- a/core/musl/build
+++ b/core/musl/build
@@ -1,5 +1,21 @@
#!/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
+ mod=$1 dir=$2; mkdir -p "$dir"
+ shift 2
+ for file; do
+ cp "$file" "$dir"
+ chmod "$mod" "$dir/$file"
+ done
+}
+
./configure \
--prefix=/usr \
--syslibdir=/usr/lib
@@ -8,12 +24,25 @@ make
make DESTDIR="$1" install
mkdir -p "$1/usr/bin"
-ln -s /usr/lib/ld-musl-x86_64.so.1 "$1/usr/bin/ldd"
+
+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
# Install BSD compatibility headers.
-install -Dm 755 cdefs.h "$1/usr/include/sys/cdefs.h"
-install -Dm 755 queue.h "$1/usr/include/sys/queue.h"
-install -Dm 755 tree.h "$1/usr/include/sys/tree.h"
+kinstall_t 755 "$1/usr/include/sys" cdefs.h queue.h tree.h
# Install getconf.
-cc getconf.c -o "$1/usr/bin/getconf"
+"${CC:=cc}" 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
+
+# Install getent
+kinstall_t 755 "$1/usr/bin" getent