Switch to new package format
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
# 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() {
|
||||
# Copy rust build config to source directory
|
||||
cp "$BPM_WORKDIR"/config.toml "$BPM_SOURCE"/config.toml
|
||||
}
|
||||
|
||||
# The build function is executed in the source directory
|
||||
# This function is used to compile the source code
|
||||
build() {
|
||||
export LIBSSH2_SYS_USE_PKG_CONFIG=1
|
||||
export LIBSQLITE3_SYS_USE_PKG_CONFIG=1
|
||||
|
||||
python3 x.py build -j$(nproc)
|
||||
}
|
||||
|
||||
_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_rustc() {
|
||||
DESTDIR="$BPM_OUTPUT" python3 x.py install
|
||||
|
||||
# Remove unnecessary files
|
||||
rm "$BPM_OUTPUT"/usr/lib/rustlib/{components,install.log,rust-installer-version,uninstall.sh}
|
||||
rm "$BPM_OUTPUT"/usr/lib/rustlib/manifest-*
|
||||
|
||||
cd "$BPM_OUTPUT"
|
||||
|
||||
# Move src subdirectory to rust-src package
|
||||
_pick rust-src usr/lib/rustlib/src
|
||||
|
||||
# Install package licences
|
||||
install -Dm644 "$BPM_SOURCE"/COPYRIGHT "$BPM_OUTPUT"/usr/share/licenses/rustc/COPYRIGHT
|
||||
install -Dm644 "$BPM_SOURCE"/LICENSE-MIT "$BPM_OUTPUT"/usr/share/licenses/rustc/LICENSE-MIT
|
||||
install -Dm644 "$BPM_SOURCE"/LICENSE-APACHE "$BPM_OUTPUT"/usr/share/licenses/rustc/LICENSE-APACHE
|
||||
}
|
||||
|
||||
package_rust-src() {
|
||||
# Install package license
|
||||
install -d "$BPM_OUTPUT"/usr/share/licenses/
|
||||
ln -sf rustc "$BPM_OUTPUT"/usr/share/licenses/rust-src
|
||||
}
|
||||
Reference in New Issue
Block a user