[l/tree-sitter-module] add independantly

This commit is contained in:
Gwenhael Le Moine 2024-02-07 16:04:47 +01:00
parent 052a4b8a1c
commit 5b63bd8767
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

82
l/tree-sitter-module/SlackBuild Executable file
View file

@ -0,0 +1,82 @@
#!/bin/bash
CWD=$(pwd)
PRGNAM=$(basename "$CWD")
GITHUB_REPO=casouri/tree-sitter-module
VERSION=${VERSION:-trunk}
BUILD=${BUILD:-1}
TAG=${TAG:-gwh}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) ARCH=i486 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
fi
TMP=${TMP:-/tmp/$TAG}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
REPOSITORY=/home/installs/SlackBuilds/_repositories/$PRGNAM
set -e
rm -rf "$PKG"
mkdir -p "$TMP" "$PKG" "$OUTPUT"
cd "$TMP"
rm -rf "$PRGNAM"
[ ! -e "$REPOSITORY" ] && git clone https://github.com/${GITHUB_REPO} "$REPOSITORY"
cd "$REPOSITORY" || exit 1
git pull --all
cp -R "$REPOSITORY" "$TMP/$PRGNAM"
cd "$TMP/$PRGNAM"
[ "$VERSION" == "latest" ] && VERSION=$(git tag --sort=-taggerdate | head -n1)
[ "$VERSION" == "" ] && VERSION=trunk
[ "$VERSION" == "trunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
sed -i 's|cc -c -I. parser.c|cc -fPIC -c -I. parser.c|' build.sh
bash ./batch.sh
mkdir -p "$PKG${PREFIX}/lib$(uname -m | grep -o 64)/"
cp dist/*.so "$PKG${PREFIX}/lib$(uname -m | grep -o 64)/"
mkdir -p "$PKG/usr/doc/$PRGNAM"
cp README "$PKG/usr/doc/$PRGNAM/"
mkdir -p "$PKG/install"
cat <<EOF > "$PKG/install/slack-desc"
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':' except on otherwise blank lines.
|-----handy-ruler------------------------------------------------------|
$PRGNAM: $PRGNAM (Tree-sitter grammers)
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://github.com/${GITHUB_REPO}
EOF
cd "$PKG" || exit 1
/sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}"