diff options
author | Techcable | 2017-03-26 12:32:31 -0700 |
---|---|---|
committer | Techcable | 2017-03-26 13:02:27 -0700 |
commit | 47008e797c6d7c0ff61e5c673f82c81c81f5b1d6 (patch) | |
tree | d38f54502fedd3efdb2414dfe515f73010e3dd21 | |
download | aur-47008e797c6d7c0ff61e5c673f82c81c81f5b1d6.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 18 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | PKGBUILD | 83 |
3 files changed, 105 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..4641a97d97f9 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,18 @@ +pkgbase = ripgrep-simd + pkgdesc = SIMD-accelerated ripgrep - A search tool that combines the usability of ag with the raw speed of grep + pkgver = 0.5.0 + pkgrel = 1 + url = https://github.com/BurntSushi/ripgrep + arch = i686 + arch = x86_64 + license = MIT + license = UNLICENSE + makedepends = rustup + provides = ripgrep=0.5.0 + conflicts = ripgrep + conflicts = ripgrep-git + source = https://github.com/BurntSushi/ripgrep/archive/0.5.0.tar.gz + sha512sums = 924e7907daf719732f888c296ea8b110db77e144cd3f7858070aca44fba93d09731d9097dd7201a851f0581ced0f0d58a7ffef6aa7c998298834170661d80256 + +pkgname = ripgrep-simd + diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..52003c53dd0a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.tar.gz +*.tar.xz +src +pkg diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..1b01a82fb976 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,83 @@ +# Maintainer: Nicholas Schlabach <Techcable@techcable.net> +pkgname=ripgrep-simd +pkgver=0.5.0 +pkgrel=1 +pkgdesc="SIMD-accelerated ripgrep - A search tool that combines the usability of ag with the raw speed of grep" +arch=('i686' 'x86_64') +url="https://github.com/BurntSushi/ripgrep" +license=('MIT' 'UNLICENSE') +makedepends=('rustup') # We must use rustup for proper nightly support +provides=("ripgrep=$pkgver") +conflicts=('ripgrep' 'ripgrep-git') +source=("https://github.com/BurntSushi/ripgrep/archive/$pkgver.tar.gz") +sha512sums=('924e7907daf719732f888c296ea8b110db77e144cd3f7858070aca44fba93d09731d9097dd7201a851f0581ced0f0d58a7ffef6aa7c998298834170661d80256') + +checkCpu() { + feature="$1" + if [ ! -f /proc/cpuinfo ]; then + echo "Couldn't find /proc/cpuinfo"; + exit 1; + fi; + echo "Checking for $feature" + grep -q "$feature" /proc/cpuinfo; + # NOTE: Bash violates tradition and uses 0 for true and 1 for false + case $? in + 0) + return 0; # grep found the feature + ;; + 1) + return 1; # grep didn't find the feature + ;; + *) + echo "Error checking for $feature in /proc/cpuinfo"; + exit 1; + ;; + esac; + echo "Unreachable"; + exit 1; +} + +build() { + cd "ripgrep-$pkgver" + if checkCpu sse2; then + echo "SIMD support found" + if checkCpu avx; then + echo "AVX support found" + FEATURES="simd-accel avx-accel" + else + echo "AVX support missing!" + FEATURES="simd-accel" + fi; + else + echo "SIMD support missing" + FEATURES="" + fi; + + ARGS=( + "--release" # Compile an optimized build + "--features" "$FEATURES" # Use SIMD and AVX if possible + "--" "-C" "lto" # Enable LTO, which is disabled by default (see ripgrep#325) + ) + + # Tell all crates to compile for the native CPU, to both improve performance, + # and to allow the compiler to emit AVX and SIMD instructions if possible + RUSTFLAGS="-C target-cpu=native" \ + rustup run nightly cargo rustc "${ARGS[@]}" +} + +package() { + cd "ripgrep-$pkgver" + + install -Dm755 "target/release/rg" "$pkgdir/usr/bin/rg" + + install -Dm644 "target/release/build/ripgrep-"*/out/rg.bash-completion "$pkgdir/usr/share/bash-completion/completions/rg" + install -Dm644 "target/release/build/ripgrep-"*/out/_rg "$pkgdir/usr/share/zsh/site-functions/_rg" + install -Dm644 "target/release/build/ripgrep-"*/out/rg.fish "$pkgdir/usr/share/fish/completions/rg.fish" + + install -Dm644 "doc/rg.1" "$pkgdir/usr/share/man/man1/rg.1" + install -Dm644 "README.md" "$pkgdir/usr/share/doc/ripgrep/README.md" + + install -Dm644 "COPYING" "$pkgdir/usr/share/licenses/ripgrep/COPYING" + install -Dm644 "LICENSE-MIT" "$pkgdir/usr/share/licenses/ripgrep/LICENSE-MIT" + install -Dm644 "UNLICENSE" "$pkgdir/usr/share/licenses/ripgrep/UNLICENSE" +} |