Files

72 lines
2.5 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 build function is executed in the source directory
# This function is used to compile the source code
build() {
mkdir build
cd build
../configure --prefix=/usr \
--sysconfdir=/etc \
--with-lib-path=/usr/lib:/usr/local/lib \
--enable-cet \
--enable-colored-disassembly \
--enable-default-execstack=no \
--enable-deterministic-archives \
--enable-gold \
--enable-install-libiberty \
--enable-jansson \
--enable-ld=default \
--enable-new-dtags \
--enable-pgo-build=lto \
--enable-plugins \
--enable-relro \
--enable-shared \
--enable-targets=x86_64-pep,bpf-unknown-none \
--enable-threads \
--disable-gdb \
--disable-gdbserver \
--disable-libdecnumber \
--disable-readline \
--disable-sim \
--disable-werror \
--with-debuginfod \
--with-pic \
--with-system-zlib
make tooldir=/usr
}
# 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() {
cd build
make -O CFLAGS_FOR_TARGET="-O2 -g" \
CXXFLAGS="-O2 -no-pie -fno-PIC" \
CFLAGS="-O2 -no-pie" \
LDFLAGS="" \
check || true
}
# 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" tooldir=/usr install
# Install PIC version of libiberty
install -m644 libiberty/pic/libiberty.a "$BPM_OUTPUT"/usr/lib
# Remove unwanted files
rm -f "$BPM_OUTPUT"/usr/share/man/man1/{dlltool,windres,windmc}*
# Remove static libraries
rm -f "$BPM_OUTPUT"/usr/lib/lib{bfd,ctf,ctf-nobfd,gprofng,opcodes,sframe}.a
# Install package license
install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/binutils/COPYING
}