Files
awww/recipe.sh

47 lines
1.9 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"
cargo fetch --locked --target "$(rustc --print host-tuple)"
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
cargo build --frozen --release --all-features
# Generate manpages
./doc/gen.sh
}
# 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() {
cargo test --frozen --all-features
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package() {
install -Dm755 target/release/awww target/release/awww-daemon -t "$BPM_OUTPUT"/usr/bin/
# Install shell completion
install -Dm644 completions/awww.bash "$BPM_OUTPUT"/usr/share/bash-completion/completions/awww
install -Dm644 completions/awww.fish "$BPM_OUTPUT"/usr/share/fish/vendor_completions.d/awww.fish
install -Dm644 completions/_awww "$BPM_OUTPUT"/usr/share/zsh/site-functions/_awww
install -Dm644 completions/awww.elv "$BPM_OUTPUT"/usr/share/elvish/lib/awww.elv
# Install documentation
install -Dm644 ./*.md -t "$BPM_OUTPUT"/usr/share/doc/awww
# Install man pages
install -Dm644 ./doc/generated/*.1 -t "$BPM_OUTPUT"/usr/share/man/man1
# Install package license
install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/awww/LICENSE
}