mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-14 07:15:24 +01:00
The motivations for this are complicated, but on musl systems, musl will use its own libssp implementation, so GCC's libssp is not required. Not to mention that GCC's libssp implementation is questionable at best. This is the approach taken by the two major musl distributions - Alpine Linux and Void Linux.
59 lines
1.9 KiB
Bash
Executable file
59 lines
1.9 KiB
Bash
Executable file
# SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
|
|
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
|
|
# SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
src_configure() {
|
|
./configure \
|
|
--host=i386-unknown-linux-musl \
|
|
--prefix="${PREFIX}" \
|
|
--libdir="${LIBDIR}" \
|
|
--includedir="${PREFIX}/include/"
|
|
}
|
|
|
|
src_compile() {
|
|
make "${MAKEJOBS}" CROSS_COMPILE=
|
|
|
|
# Provide libssp_nonshared.a to avoid GCC's messy libssp
|
|
# (Taken from Alpine Linux)
|
|
gcc -c __stack_chk_fail_local.c -o __stack_chk_fail_local.o
|
|
ar r libssp_nonshared.a __stack_chk_fail_local.o
|
|
}
|
|
|
|
src_install() {
|
|
default
|
|
|
|
# Install libssp_nonshared.a
|
|
install -m 644 libssp_nonshared.a "${DESTDIR}${PREFIX}/lib/"
|
|
|
|
# Make dynamic linker symlink relative in ${PREFIX}/lib
|
|
rm "${DESTDIR}/lib/ld-musl-i386.so.1"
|
|
rmdir "${DESTDIR}/lib"
|
|
mkdir -p "${DESTDIR}${PREFIX}/lib"
|
|
ln -sr "${DESTDIR}${LIBDIR}/libc.so" "${DESTDIR}${PREFIX}/lib/ld-musl-i386.so.1"
|
|
|
|
# Make startup objects available in /usr/lib
|
|
# Expected by GCC 10+
|
|
for i in crt1.o crti.o crtn.o Scrt1.o rcrt1.o; do
|
|
ln -sr "${DESTDIR}${LIBDIR}/${i}" "${DESTDIR}${PREFIX}/lib/${i}"
|
|
done
|
|
|
|
# Add symlink for ldd
|
|
mkdir -p "${DESTDIR}${PREFIX}/bin"
|
|
ln -s ../lib/ld-musl-i386.so.1 "${DESTDIR}${PREFIX}/bin/ldd"
|
|
|
|
# Add library search path configurtion
|
|
mkdir -p "${DESTDIR}/etc"
|
|
cp ld-musl-i386.path "${DESTDIR}/etc"
|
|
|
|
# Re-add /bin and /lib symlinks here so that binary package
|
|
# is self-contained and usable outside live-bootstrap
|
|
ln --symbolic --relative "${DESTDIR}/${PREFIX}/lib" "${DESTDIR}/lib"
|
|
ln --symbolic --relative "${DESTDIR}/${PREFIX}/bin" "${DESTDIR}/bin"
|
|
}
|
|
|
|
src_postprocess() {
|
|
# Stripping libc can cause some strange brokenness
|
|
:
|
|
}
|