# 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() { cargo build --release --locked --features 'pcre2' } # 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 --release --locked --features 'pcre2' } # 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/rg "$BPM_OUTPUT"/usr/bin/rg # Install shell completions install -dm755 "$BPM_OUTPUT"/usr/share/zsh/site-functions target/release/rg --generate complete-zsh > "$BPM_OUTPUT"/usr/share/zsh/site-functions/_rg install -dm755 "$BPM_OUTPUT"/usr/share/bash-completion/completions target/release/rg --generate complete-bash > "$BPM_OUTPUT"/usr/share/bash-completion/completions/rg install -dm755 "$BPM_OUTPUT"/usr/share/fish/vendor_completions.d target/release/rg --generate complete-fish > "$BPM_OUTPUT"/usr/share/fish/vendor_completions.d/rg.fish # Install man pages install -dm755 "$BPM_OUTPUT"/usr/share/man/man1 target/release/rg --generate man > "$BPM_OUTPUT"/usr/share/man/man1/rg.1 # Install package licenses install -Dm644 "$BPM_SOURCE"/LICENSE-MIT "$BPM_OUTPUT"/usr/share/licenses/ripgrep/LICENSE-MIT install -Dm644 "$BPM_SOURCE"/UNLICENSE "$BPM_OUTPUT"/usr/share/licenses/ripgrep/UNLICENSE install -Dm644 "$BPM_SOURCE"/COPYING "$BPM_OUTPUT"/usr/share/licenses/ripgrep/COPYING }