Initial Commit

This commit is contained in:
2025-05-09 14:06:02 +03:00
commit 26ef8332e2
3 changed files with 69 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
#!/bin/bash
# Github repository
REPO="BurntSushi/ripgrep"
# Get tag name using Github Rest API
TAG_NAME=$(curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/"$REPO"/releases/latest | jq -r '.tag_name')
# Get version number from tag name
VERSION=$(echo "$TAG_NAME" | rev | cut -d'-' -f1 | rev)
echo "$VERSION"
+9
View File
@@ -0,0 +1,9 @@
name: ripgrep
description: Tool that recursively searches directories for a regex pattern while respecting your gitignore
version: 14.1.1
url: https://github.com/BurntSushi/ripgrep
license: MIT,Unlicense
architecture: any
depends: ["gcc","pcre2"]
make_depends: ["rustc"]
type: source
+48
View File
@@ -0,0 +1,48 @@
# This is the source.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
DOWNLOAD="https://github.com/BurntSushi/ripgrep/archive/refs/tags/${BPM_PKG_VERSION}.tar.gz"
FILENAME="${DOWNLOAD##*/}"
# The prepare function is executed in the root of the temp directory
# This function is used for downloading files and putting them into the correct location
prepare() {
wget "$DOWNLOAD"
tar -xvf "$FILENAME" --strip-components=1 -C "$BPM_SOURCE"
}
# 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
}