VERSION="1.1.20" SRCDIR="musl-$VERSION" TARBALL="$SRCDIR.tar.gz" URL="https://www.musl-libc.org/releases" SHA256SUM="44be8771d0e6c6b5f82dd15662eb2957c9a3173a19a8b49966ac0542bbd40d61" DEPENDS="tc-gcc1 linux_headers fortify-headers" prepare() { return } build() { local cflags="" local ldflags="" if [ "x$TC_HARDENING" = "xyes" ]; then cflags="-fPIE -fPIC -fstack-protector-all" ldflags="-z noexecstack -z relro -z now" ${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 fi 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 mkdir -p "$DEPLOY/etc" cat_file_merge "LDPATH" > "$DEPLOY/etc/ld-musl-${MUSL_CPU}.path" find ${DEPLOY}/lib/*.so* -exec stat {} --printf="%n m %a 0 0\\n" \; | \ sed "s#^$DEPLOY/##g" | sed "s/644/444/g" | \ sed "s/755/555/g" > "$DEPLOY/rootfs_files.txt" find "$DEPLOY/etc" -exec stat {} --printf="%n m %a 0 0\\n" \; | \ sed "s#^$DEPLOY/##g" | tail -n +2 >> "$DEPLOY/rootfs_files.txt" if [ "x$TC_HARDENING" = "xyes" ]; then cp libssp_nonshared.a "$DEPLOY/lib" fi } check_update() { curl --silent -L "$URL" | grep -o ">musl-[0-9.]*tar.gz<" | \ sed 's/>musl-//g' | sed 's/.tar.gz