mirror of
https://github.com/pygos/build.git
synced 2024-11-22 11:09:46 +01:00
David Oberhollenzer
c8d01f966a
Been working on this for too long, don't remember the specifics, will add documentation. Signed-off-by: David Oberhollenzer <goliath@infraroot.at>
72 lines
1.6 KiB
Text
Executable file
72 lines
1.6 KiB
Text
Executable file
VERSION="1.1.20"
|
|
SRCDIR="musl-$VERSION"
|
|
TARBALL="$SRCDIR.tar.gz"
|
|
URL="https://www.musl-libc.org/releases"
|
|
SHA256SUM="44be8771d0e6c6b5f82dd15662eb2957c9a3173a19a8b49966ac0542bbd40d61"
|
|
DEPENDS="tc-gcc1 linux-dev fortify-headers tc-pkgtool"
|
|
SUBPKG="libc libc-dev"
|
|
|
|
prepare() {
|
|
return
|
|
}
|
|
|
|
build() {
|
|
local cflags="-O2 -Os"
|
|
local ldflags=""
|
|
|
|
if [ "x$TC_HARDENING" = "xyes" ]; then
|
|
cflags="$cflags -fPIE -fPIC -fstack-protector-all"
|
|
ldflags="$ldflags -z noexecstack -z relro -z now"
|
|
fi
|
|
|
|
${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
|
|
|
|
CFLAGS="$cflags" LDFLAGS="$ldflags" \
|
|
CROSS_COMPILE="${TARGET}-" $1/configure --prefix=/ --target="$TARGET"
|
|
CROSS_COMPILE="${TARGET}-" make -j $NUMJOBS
|
|
}
|
|
|
|
deploy() {
|
|
local INPUT="$1"
|
|
local DEPLOY="$2"
|
|
local MUSL_CPU=""
|
|
|
|
case "$TARGET" in
|
|
i*86-*)
|
|
MUSL_CPU="i386"
|
|
;;
|
|
x86_64-*)
|
|
MUSL_CPU="x86_64"
|
|
;;
|
|
arm-*)
|
|
MUSL_CPU="arm"
|
|
;;
|
|
*)
|
|
echo "don't know how to map $TARGET to Musl arch"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
DESTDIR="$DEPLOY" make install-headers
|
|
DESTDIR="$DEPLOY" make install-libs
|
|
|
|
cat_file_merge "LDPATH" > "$DEPLOY/LDPATH"
|
|
cp libssp_nonshared.a "$DEPLOY/lib"
|
|
|
|
cp $SCRIPTDIR/pkg/$PKGNAME/*.{desc,files} "$DEPLOY"
|
|
|
|
cat > "$DEPLOY/libc.files" <<_EOF
|
|
dir lib 0755 0 0
|
|
dir etc 0755 0 0
|
|
file lib/libc.so 0755 0 0 $DEPLOY/lib/libc.so
|
|
slink lib/ld-musl-${MUSL_CPU}.so.1 0777 0 0 libc.so
|
|
file etc/ld-musl-${MUSL_CPU}.path 0644 0 0 $DEPLOY/LDPATH
|
|
_EOF
|
|
}
|
|
|
|
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"
|
|
}
|