28 lines
617 B
Bash
Executable File
28 lines
617 B
Bash
Executable File
#!/bin/sh -e
|
|
|
|
TARGET=x86_64-elf
|
|
SYSROOT=/opt/sysroot
|
|
|
|
# Pull or update musl libc
|
|
mkdir -p /opt/external && cd /opt/external
|
|
[ -d musl ] || git clone --depth=1 git://git.musl-libc.org/musl
|
|
cd musl
|
|
git reset --hard
|
|
git pull
|
|
|
|
# Apply patches
|
|
[ -d /opt/src/patch-musl ] && rsync -a /opt/src/patch-musl/ /opt/external/musl/
|
|
|
|
# Build and install
|
|
mkdir -p /opt/external/build-musl && cd /opt/external/build-musl
|
|
rm -r *
|
|
../musl/configure \
|
|
--target=${TARGET} \
|
|
--prefix=${SYSROOT}/usr \
|
|
--disable-shared \
|
|
--enable-debug \
|
|
CFLAGS="-O0 -mcmodel=large -mno-red-zone"
|
|
|
|
make
|
|
make install-headers
|
|
make install |