commit 26ef8332e29dd1b280bfa03b7903f21e26654a8b Author: EnumDev Date: Fri May 9 14:06:02 2025 +0300 Initial Commit diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..1a7b05d --- /dev/null +++ b/check-version.sh @@ -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" diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..2b0dbc5 --- /dev/null +++ b/pkg.info @@ -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 diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..8c3c506 --- /dev/null +++ b/source.sh @@ -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 +}