Files
elfutils/recipe.sh
T

76 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 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"
autoreconf -fi
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
# Remove failing test
sed -e 's/run-backtrace-native.sh//g' -i tests/Makefile.am
export CFLAGS="${CFLAGS} -ffat-lto-objects -g"
./configure --prefix=/usr \
--sysconfdir=/etc \
--program-prefix="eu-" \
--enable-deterministic-archives \
--enable-maintainer-mode
make
}
# The check function is executed in the source directory
# This function is used to run tests to verify the package has been compiled correctly
# Temporarily disabled due to failing test
check() {
make check
}
_pick() {
local p="$1" f d; shift
for f; do
[ -d "$BPM_WORKDIR"/output_"$p" ] || { echo "Split package $p not found"; exit 1; }
d="$BPM_WORKDIR"/output_"$p"/"${f#$BPM_OUTPUT}"
mkdir -p "$(dirname "$d")"
mv "$f" "$d"
rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
done
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package_elfutils() {
make DESTDIR="$BPM_OUTPUT" install
cd "$BPM_OUTPUT"
# Move libelf files into split package
_pick libelf etc/debuginfod
_pick libelf etc/profile.d/*
_pick libelf usr/{include,lib}
_pick libelf usr/share/man/*/{,lib}elf*
# Move debuginfod files into split package
_pick debuginfod usr/bin/debuginfod*
_pick debuginfod usr/share/fish/vendor_conf.d/debuginfod.fish
_pick debuginfod usr/share/man/*/debuginfod*
# Install package licenses
install -Dm644 "$BPM_SOURCE"/COPYING* -t "$BPM_OUTPUT"/usr/share/licenses/elfutils
}
package_libelf() {
# Install package licenses
install -Dm644 "$BPM_SOURCE"/COPYING* -t "$BPM_OUTPUT"/usr/share/licenses/libelf
}
package_debuginfod() {
# Install package licenses
install -Dm644 "$BPM_SOURCE"/COPYING* -t "$BPM_OUTPUT"/usr/share/licenses/debuginfod
}