187 lines
6.0 KiB
Bash
187 lines
6.0 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() {
|
|
./configure --prefix=/usr --sysconfdir=/etc --without-gtk-doc
|
|
|
|
# prevent excessive overlinking due to libtool
|
|
sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
|
|
|
|
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
|
|
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_libblockdev() {
|
|
make DESTDIR="$BPM_OUTPUT" install
|
|
|
|
cd "$BPM_OUTPUT"
|
|
|
|
# Move btrfs files into split package
|
|
_pick libblockdev-btrfs usr/include/blockdev/btrfs.h
|
|
_pick libblockdev-btrfs usr/lib/libbd_btrfs.*
|
|
|
|
# Move crypto files into split package
|
|
_pick libblockdev-crypto usr/include/blockdev/crypto.h
|
|
_pick libblockdev-crypto usr/lib/libbd_crypto.*
|
|
|
|
# Move device-mapper files into split package
|
|
_pick libblockdev-dm usr/include/blockdev/dm.h
|
|
_pick libblockdev-dm usr/lib/libbd_dm.*
|
|
|
|
# Move filesystem files into split package
|
|
_pick libblockdev-fs usr/bin/vfat-resize
|
|
_pick libblockdev-fs usr/include/blockdev/fs.h
|
|
_pick libblockdev-fs usr/include/blockdev/fs/*.h
|
|
_pick libblockdev-fs usr/lib/libbd_fs.*
|
|
|
|
# Move loop device files into split package
|
|
_pick libblockdev-loop usr/include/blockdev/loop.h
|
|
_pick libblockdev-loop usr/lib/libbd_loop.*
|
|
|
|
# Move lvm files into split package
|
|
_pick libblockdev-lvm etc/libblockdev/3/conf.d/10-lvm-dbus.cfg
|
|
_pick libblockdev-lvm usr/bin/lvm-cache-stats
|
|
_pick libblockdev-lvm usr/include/blockdev/lvm.h
|
|
_pick libblockdev-lvm usr/lib/libbd_lvm.*
|
|
_pick libblockdev-lvm usr/lib/libbd_lvm-dbus.*
|
|
|
|
# Move mdraid files into split package
|
|
_pick libblockdev-mdraid usr/include/blockdev/mdraid.h
|
|
_pick libblockdev-mdraid usr/lib/libbd_mdraid.*
|
|
|
|
# Move mpath files into split package
|
|
_pick libblockdev-mpath usr/include/blockdev/mpath.h
|
|
_pick libblockdev-mpath usr/lib/libbd_mpath.*
|
|
|
|
# Move nvdimm files into split package
|
|
_pick libblockdev-nvdimm usr/include/blockdev/nvdimm.h
|
|
_pick libblockdev-nvdimm usr/lib/libbd_nvdimm.*
|
|
|
|
# Move nvme files into split package
|
|
_pick libblockdev-nvme usr/include/blockdev/nvme.h
|
|
_pick libblockdev-nvme usr/lib/libbd_nvme.*
|
|
|
|
# Move part files into split package
|
|
_pick libblockdev-part usr/include/blockdev/part.h
|
|
_pick libblockdev-part usr/lib/libbd_part.*
|
|
|
|
# Move smart files into split package
|
|
_pick libblockdev-smart usr/include/blockdev/smart.h
|
|
_pick libblockdev-smart usr/lib/libbd_smart*
|
|
|
|
# Move swap files into split package
|
|
_pick libblockdev-swap usr/include/blockdev/swap.h
|
|
_pick libblockdev-swap usr/lib/libbd_swap.*
|
|
|
|
# Move python files into split package
|
|
_pick python-libblockdev usr/lib/python*
|
|
|
|
# Install package license
|
|
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/libblockdev/LICENSE
|
|
}
|
|
|
|
package_libblockdev-btrfs() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-btrfs
|
|
}
|
|
|
|
package_libblockdev-crypto() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-crypto
|
|
}
|
|
|
|
package_libblockdev-dm() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-dm
|
|
}
|
|
|
|
package_libblockdev-fs() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-fs
|
|
}
|
|
|
|
package_libblockdev-loop() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-loop
|
|
}
|
|
|
|
package_libblockdev-lvm() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-lvm
|
|
}
|
|
|
|
package_libblockdev-mdraid() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-mdraid
|
|
}
|
|
|
|
package_libblockdev-mpath() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-mpath
|
|
}
|
|
|
|
package_libblockdev-nvdimm() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-nvdimm
|
|
}
|
|
|
|
package_libblockdev-nvme() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-nvme
|
|
}
|
|
|
|
package_libblockdev-part() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-part
|
|
}
|
|
|
|
package_libblockdev-smart() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-smart
|
|
}
|
|
|
|
package_libblockdev-swap() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/libblockdev-swap
|
|
}
|
|
|
|
package_python-libblockdev() {
|
|
# Install package license
|
|
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
|
ln -sf libblockdev "$BPM_OUTPUT"/usr/share/licenses/python-libblockdev
|
|
}
|