2018-09-08 14:03:28 +02:00
|
|
|
VERSION="1.1.20"
|
2017-12-09 21:51:48 +01:00
|
|
|
SRCDIR="musl-$VERSION"
|
|
|
|
TARBALL="$SRCDIR.tar.gz"
|
2018-02-10 10:48:03 +01:00
|
|
|
URL="https://www.musl-libc.org/releases"
|
2018-09-08 14:03:28 +02:00
|
|
|
SHA256SUM="44be8771d0e6c6b5f82dd15662eb2957c9a3173a19a8b49966ac0542bbd40d61"
|
2019-02-27 14:22:03 +01:00
|
|
|
DEPENDS="tc-gcc1 linux-dev fortify-headers tc-pkgtool"
|
|
|
|
SUBPKG="libc libc-dev"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
|
|
|
prepare() {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
2018-10-20 19:27:23 +02:00
|
|
|
local cflags="-O2 -Os"
|
2018-10-19 13:02:06 +02:00
|
|
|
local ldflags=""
|
|
|
|
|
|
|
|
if [ "x$TC_HARDENING" = "xyes" ]; then
|
2018-10-20 19:27:23 +02:00
|
|
|
cflags="$cflags -fPIE -fPIC -fstack-protector-all"
|
|
|
|
ldflags="$ldflags -z noexecstack -z relro -z now"
|
2018-10-19 13:02:06 +02:00
|
|
|
fi
|
2018-10-14 18:47:20 +02:00
|
|
|
|
2018-10-20 21:59:14 +02:00
|
|
|
${TARGET}-gcc -c "$SCRIPTDIR/pkg/$PKGNAME/__stack_chk_fail_local.c" -o __stack_chk_fail_local.o
|
|
|
|
${TARGET}-ar r libssp_nonshared.a __stack_chk_fail_local.o
|
|
|
|
|
2018-10-14 18:47:20 +02:00
|
|
|
CFLAGS="$cflags" LDFLAGS="$ldflags" \
|
2018-10-17 00:06:59 +02:00
|
|
|
CROSS_COMPILE="${TARGET}-" $1/configure --prefix=/ --target="$TARGET"
|
|
|
|
CROSS_COMPILE="${TARGET}-" make -j $NUMJOBS
|
2017-12-09 21:51:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
deploy() {
|
|
|
|
local INPUT="$1"
|
2018-10-19 18:54:16 +02:00
|
|
|
local MUSL_CPU=""
|
|
|
|
|
|
|
|
case "$TARGET" in
|
|
|
|
i*86-*)
|
|
|
|
MUSL_CPU="i386"
|
|
|
|
;;
|
|
|
|
x86_64-*)
|
|
|
|
MUSL_CPU="x86_64"
|
|
|
|
;;
|
2019-03-03 23:54:24 +01:00
|
|
|
arm-*-*hf)
|
|
|
|
MUSL_CPU="armhf"
|
|
|
|
;;
|
2018-10-19 18:54:16 +02:00
|
|
|
arm-*)
|
|
|
|
MUSL_CPU="arm"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "don't know how to map $TARGET to Musl arch"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
2017-12-09 21:51:48 +01:00
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
DESTDIR="$PKGDEPLOYDIR" make install-headers
|
|
|
|
DESTDIR="$PKGDEPLOYDIR" make install-libs
|
2017-12-09 21:51:48 +01:00
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
cat_file_merge "LDPATH" > "$PKGDEPLOYDIR/LDPATH"
|
|
|
|
cp libssp_nonshared.a "$PKGDEPLOYDIR/lib"
|
2018-06-16 17:46:17 +02:00
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
cp $SCRIPTDIR/pkg/$PKGNAME/*.{desc,files} "$PKGDEPLOYDIR"
|
2018-10-20 12:52:06 +02:00
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
cat > "$PKGDEPLOYDIR/libc.files" <<_EOF
|
2019-02-27 14:22:03 +01:00
|
|
|
dir lib 0755 0 0
|
|
|
|
dir etc 0755 0 0
|
2019-03-06 10:03:12 +01:00
|
|
|
file lib/libc.so 0755 0 0 $PKGDEPLOYDIR/lib/libc.so
|
2019-02-03 17:13:28 +01:00
|
|
|
slink lib/ld-musl-${MUSL_CPU}.so.1 0777 0 0 libc.so
|
2019-03-06 10:03:12 +01:00
|
|
|
file etc/ld-musl-${MUSL_CPU}.path 0644 0 0 $PKGDEPLOYDIR/LDPATH
|
2019-02-03 17:13:28 +01:00
|
|
|
_EOF
|
2017-12-09 21:51:48 +01:00
|
|
|
}
|
2018-05-06 17:23:31 +02:00
|
|
|
|
|
|
|
check_update() {
|
|
|
|
curl --silent -L "$URL" | grep -o ">musl-[0-9.]*tar.gz<" | \
|
|
|
|
sed 's/>musl-//g' | sed 's/.tar.gz<//g' | \
|
|
|
|
verson_find_greatest "$VERSION"
|
2018-06-16 17:46:17 +02:00
|
|
|
}
|