98 lines
4.1 KiB
Bash
98 lines
4.1 KiB
Bash
# This is the recipe.sh script. It is executed by BPM in a temporary directory when compiling a source package
|
|
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
|
|
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
|
|
|
|
# The prepare function is executed in the root of the temp directory
|
|
# This function is used for putting downloaded files to the correct location or applying patches
|
|
prepare() {
|
|
cd "$BPM_SOURCE"
|
|
patch -Np1 -i "$BPM_WORKDIR"/0001-fix-tst-rseq-with-linux-7.0.patch
|
|
patch -Np1 -i "$BPM_WORKDIR"/0002-isolate-__O_CLOEXEC-flag-for-sys-mount.h-and-fcntl.h.patch
|
|
patch -Np1 -i "$BPM_WORKDIR"/0003-only-define-OPEN_TREE_-macros-in-sys-mount.h-if-undefined.patch
|
|
}
|
|
|
|
# The build function is executed in the source directory
|
|
# This function is used to compile the source code
|
|
build() {
|
|
mkdir -p build
|
|
cd build
|
|
|
|
# Install system binaries to /usr/sbin
|
|
echo "rootsbindir=/usr/sbin" > configparms
|
|
|
|
# _FORTIFY_SOURCE=3 can result in testsuite failures. It is instead enabled through --enable-fortify-source
|
|
CFLAGS=${CFLAGS/-Wp,-D_FORTIFY_SOURCE=3/}
|
|
|
|
../configure --prefix=/usr \
|
|
--with-headers=/usr/include \
|
|
--enable-bind-now \
|
|
--enable-fortify-source \
|
|
--enable-kernel=5.4 \
|
|
--enable-cet \
|
|
--enable-stack-protector=strong \
|
|
--enable-multi-arch \
|
|
--disable-nscd \
|
|
--disable-profile \
|
|
--disable-werror \
|
|
libc_cv_slibdir=/usr/lib
|
|
make
|
|
|
|
# Generate locales here because localedef does not work in fakeroot
|
|
make -C "$BPM_SOURCE"/localedata objdir="$BPM_SOURCE"/build DESTDIR="${BPM_WORKDIR}"/locales install-locale-files
|
|
}
|
|
|
|
# The check function is executed in the source directory
|
|
# This function is used to run tests to verify the package has been compiled correctly
|
|
check() {
|
|
# disable tests that take too long on most systems
|
|
sed -i "/tst-thread-affinity-pthread/d" nptl/Makefile
|
|
sed -i "/tst-thread-affinity-sched/d" nptl/Makefile
|
|
sed -i '/tst-resolv-res_init-multi/d' resolv/Makefile
|
|
|
|
cd build
|
|
|
|
# adjust/remove buildflags that cause false-positive testsuite failures
|
|
sed -i 's/-Werror=format-security/-Wformat-security/' config.make # failure to build testsuite
|
|
sed -i '/CFLAGS/s/-fno-plt//' config.make # 27 failures
|
|
sed -i '/CFLAGS/s/-fexceptions//' config.make # 1 failure
|
|
|
|
make check
|
|
}
|
|
|
|
# The package function is executed in the source directory
|
|
# This function is used to move the compiled files into the output directory
|
|
package() {
|
|
cd build
|
|
|
|
make DESTDIR="$BPM_OUTPUT" install
|
|
|
|
# Fix hardcoded path
|
|
sed '/RTLDLIST=/s@/usr@@g' -i "$BPM_OUTPUT"/usr/bin/ldd
|
|
|
|
# Install locale-gen script
|
|
install -Dm755 "$BPM_WORKDIR"/locale-gen "$BPM_OUTPUT"/usr/bin/locale-gen
|
|
|
|
# Create locale.gen file
|
|
install -dm755 "$BPM_OUTPUT"/etc
|
|
touch "$BPM_OUTPUT"/etc/locale.gen
|
|
sed -e '1,3d' -e 's|/| |g' -e 's|\\| |g' -e 's|^|#|g' "$BPM_SOURCE"/localedata/SUPPORTED >> "$BPM_OUTPUT"/etc/locale.gen
|
|
|
|
# Create SUPPORTED file
|
|
install -dm755 "$BPM_OUTPUT"/usr/share/i18n
|
|
sed -e '1,3d' -e 's|/| |g' -e 's| \\||g' "$BPM_SOURCE"/localedata/SUPPORTED > "$BPM_OUTPUT"/usr/share/i18n/SUPPORTED
|
|
|
|
# Install C.UTF-8 so that it is always available
|
|
install -dm55 "$BPM_OUTPUT"/usr/lib/locale
|
|
cp -r "$BPM_WORKDIR"/locales/usr/lib/locale/C.utf8 -t "$BPM_OUTPUT"/usr/lib/locale
|
|
sed -i '/#C\.UTF-8 /d' "$BPM_OUTPUT"/etc/locale.gen
|
|
|
|
# Symlink glibc dynamic linker to /lib64
|
|
install -dm755 "$BPM_OUTPUT"/lib64/
|
|
ln -sf ../lib/ld-linux-x86-64.so.2 "$BPM_OUTPUT"/lib64
|
|
ln -sf ../lib/ld-linux-x86-64.so.2 "$BPM_OUTPUT"/lib64/ld-lsb-x86_64.so.3
|
|
|
|
# Install package licenses
|
|
install -Dm644 "$BPM_SOURCE"/LICENSES "$BPM_OUTPUT"/usr/share/licenses/glibc/LICENSES
|
|
install -Dm644 "$BPM_SOURCE"/COPYING* -t "$BPM_OUTPUT"/usr/share/licenses/glibc
|
|
}
|