Files
cdrtools/recipe.sh
T
2026-07-15 08:42:39 +03:00

58 lines
2.3 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"
sed -i 's|/opt/schily|/usr|g' DEFAULTS/Defaults.linux
sed -i 's|DEFINSGRP=.*|DEFINSGRP=root|' DEFAULTS/Defaults.linux
sed -i 's|INSDIR=\s*sbin|INSDIR=bin|' rscsi/Makefile
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
export GMAKE_NOWARN=true
export CFLAGS="$CFLAGS -std=gnu89 -fno-strict-aliasing"
make -j1 INS_BASE=/usr INS_RBASE=/ VERSION_OS="TideLinux" LDOPTX="$LDFLAGS"
}
# 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() {
make tests
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
make DESTDIR="$BPM_OUTPUT" install
export GMAKE_NOWARN=true
make INS_BASE=/usr INS_RBASE=/ DESTDIR="$BPM_OUTPUT" install
# Remove static libraries, headers & conflicting man pages
rm "$BPM_OUTPUT"/usr/lib/*.a
rm -r "$BPM_OUTPUT"/usr/lib/profiled
rm -r "$BPM_OUTPUT"/usr/include
rm -r "$BPM_OUTPUT"/usr/share/man/man3
# Autoload 'sg' module needed by cdrecord
echo sg | install -vDm644 /dev/stdin "$BPM_OUTPUT"/usr/lib/modules-load.d/cdrecord.conf
# Patch binary permissions, by default it's swx--x--x
chmod a+rx "$BPM_OUTPUT"/usr/bin/*
# Create symlinks for cdrkit compatibility
ln -s /usr/bin/cdrecord "$BPM_OUTPUT"/usr/bin/wodim
ln -s /usr/bin/readcd "$BPM_OUTPUT"/usr/bin/readom
ln -s /usr/bin/mkisofs "$BPM_OUTPUT"/usr/bin/genisoimage
ln -s /usr/bin/cdda2wav "$BPM_OUTPUT"/usr/bin/icedax
# Install package license
install -Dm644 "$BPM_SOURCE"/{COPYING,CDDL.Schily.txt,GPL-2.0.txt,LGPL-2.1.txt} -t "$BPM_OUTPUT"/usr/share/licenses/cdrtools
}