| git.druid.rocks | index | druid520 | ports | ports/ | libcs/ | musl/ | add.sh |
ports/libcs/musl/add.sh
set -e
# musl's own Makefile uses target-specific variable assignment ("target:
# VAR += value"), a real GNU make extension (not POSIX make, and not
# something pdpmake/bmake implement) - documented upstream as a genuine
# GNU make requirement, not a bug in either build system. called by name
# rather than declared as a formal pkg_deps dependency: gmake's own build
# needs autotools, which (via GLOBAL_DEPS) needs %libc, which resolves
# back to musl itself - a real bootstrap cycle for a from-scratch libc,
# same shape as gnu-m4/pkg.conf's bison/curl cycle already documented
# elsewhere. gmake is instead a host/bootstrap-assumed tool here, same
# precedent as m4's own curl use - install it once with a plain
# "mp install build-tools/gmake" before updating/rebuilding musl.
# --enable-static-pie: builds the extra rcrt1.o (self-relocating static
# startup object) musl needs to actually produce a working static-PIE
# executable -- plain CFLAGS/LDFLAGS="-static-pie" on some OTHER port's
# own build is not enough on its own; without this, libc.a itself has no
# PIE-compatible relocations and every static-pie link against it fails
# (found for real: "relocation R_X86_64_32 ... can not be used when
# making a PIE object", from libc.a's own __libc_start_main.o).
git clone git://git.musl-libc.org/musl
cd musl
./configure --prefix=$MP_PREFIX --syslibdir=$MP_PREFIX/lib --enable-static-pie $CONFIGURE_FLAGS
gmake -j$MP_JOBS
gmake install