diff options
Diffstat (limited to 'system/ripgrep/ripgrep.SlackBuild')
-rw-r--r-- | system/ripgrep/ripgrep.SlackBuild | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/system/ripgrep/ripgrep.SlackBuild b/system/ripgrep/ripgrep.SlackBuild index 3e469f5fd7..387a36fa8d 100644 --- a/system/ripgrep/ripgrep.SlackBuild +++ b/system/ripgrep/ripgrep.SlackBuild @@ -1,8 +1,9 @@ -#!/bin/sh +#!/bin/bash # Slackware build script for ripgrep -# Copyright 2017-2020 Andrew Clemons, Wellington New Zealand +# Copyright 2017-2021 Andrew Clemons, Wellington New Zealand +# Copyright 2023-2024 Andrew Clemons, Toyko Japan # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -22,10 +23,14 @@ # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +cd $(dirname $0) ; CWD=$(pwd) + PRGNAM=ripgrep -VERSION=${VERSION:-12.1.1} +BINNAM=rg +VERSION=${VERSION:-14.1.0} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then case "$( uname -m )" in @@ -41,27 +46,35 @@ if [ -z "$ARCH" ]; then fi fi -CWD=$(pwd) +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" + CARGOTARGET="--target $ARCH-unknown-linux-gnu" LIBDIRSUFFIX="" - CARGOTARGET="--target i586-unknown-linux-gnu" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" + CARGOTARGET="--target $ARCH-unknown-linux-gnu" LIBDIRSUFFIX="" - CARGOTARGET="--target i686-unknown-linux-gnu" -elif [ "$ARCH" = "x86_64" ]; then +elif [ "$ARCH" = "x86_64" ] ; then SLKCFLAGS="-O2 -fPIC" + CARGOTARGET="--target $ARCH-unknown-linux-gnu" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "aarch64" ] ; then + SLKCFLAGS="-O2 -fPIC" + CARGOTARGET="--target $ARCH-unknown-linux-gnu" LIBDIRSUFFIX="64" - CARGOTARGET="--target x86_64-unknown-linux-gnu" else SLKCFLAGS="-O2" - LIBDIRSUFFIX="" CARGOTARGET="" + LIBDIRSUFFIX="" fi set -e @@ -75,9 +88,8 @@ cd $PRGNAM-$VERSION # build offline # configuration tells cargo to use the configured directory -# for dependencies intead of downloading from crates.io -mkdir .cargo -cat << EOF >> .cargo/config +# for dependencies instead of downloading from crates.io +cat << EOF > .cargo/config [source.crates-io] registry = 'https://github.com/rust-lang/crates.io-index' replace-with = 'vendored-sources' @@ -130,22 +142,34 @@ find -L . \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; +export PATH="/opt/rust16/bin:$PATH" +if [ -z "$LD_LIBRARY_PATH" ]; then + export LD_LIBRARY_PATH="/opt/rust16/lib$LIBDIRSUFFIX" +else + export LD_LIBRARY_PATH="/opt/rust16/lib$LIBDIRSUFFIX:$LD_LIBRARY_PATH" +fi + +rm -f .cargo/config.toml +sed -i 's/debug = "none"/debug = 0/g' Cargo.toml + +CARGO_HOME=.cargo \ +PCRE2_SYS_STATIC=0 \ CFLAGS="$SLKCFLAGS" \ CXXFLAGS="$SLKCFLAGS" \ -cargo build --release $CARGOTARGET +cargo build --features 'pcre2' --release $CARGOTARGET mkdir -p $PKG/usr/bin/ -find target -name rg -exec install -m 755 {} $PKG/usr/bin/rg \; +find target -name $BINNAM -exec install -m 755 {} $PKG/usr/bin/$BINNAM \; mkdir -p $PKG/usr/share/bash-completion/completions/ -find target -name rg.bash -exec install -m644 {} $PKG/usr/share/bash-completion/completions/rg \; +$PKG/usr/bin/$BINNAM --generate complete-bash > $PKG/usr/share/bash-completion/completions/$BINNAM mkdir -p $PKG/usr/share/zsh/site-functions/ -find target -name _rg.ps1 -exec install -m644 {} $PKG/usr/share/zsh/site-functions/_rg \; +$PKG/usr/bin/$BINNAM --generate complete-zsh > $PKG/usr/share/zsh/site-functions/_$BINNAM mkdir -p $PKG/usr/man/man1 -find target -name rg.1 -exec install -m644 {} $PKG/usr/man/man1/rg.1 \; +$PKG/usr/bin/$BINNAM --generate man > $PKG/usr/man/man1/$BINNAM.1 find $PKG/usr/man -type f -exec gzip -9 {} \; for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done @@ -154,11 +178,11 @@ find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | gr | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION -cp -a CHANGELOG.md COPYING FAQ.md GUIDE.md LICENSE-MIT README.md RELEASE-CHECKLIST.md UNLICENSE $PKG/usr/doc/$PRGNAM-$VERSION +cp -a CHANGELOG.md COPYING FAQ.md GUIDE.md LICENSE-MIT README.md UNLICENSE $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG -/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE |