slackbuilds/d/zig-lang-bin/SlackBuild

60 lines
1.5 KiB
Text
Raw Permalink Normal View History

2021-07-19 14:36:29 +02:00
#!/bin/bash
set -x -e
CWD=$(pwd)
PRGNAM=$(basename $CWD)
ARCH=$(uname -m)
VERSION=$(curl -s https://ziglang.org/download/index.json | jq 'keys' | grep -v master | grep -v \\\[ | grep -v \\\] | tr -d , | tr -d \" | tr -d \ | sort -V | tail -n1)
BUILD=1
TAG=gwh
OUTPUT=/tmp
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
PREFIX=/usr
REPOSITORY=${REPOSITORY:-/var/cache/SlackBuilds.gwh/$PRGNAM}
mkdir -p $REPOSITORY
2021-07-19 14:36:29 +02:00
# cleaning
rm -fr $PKG
# unpacking
[ ! -e $REPOSITORY/zig-linux-${ARCH}-${VERSION}.tar.gz ] && wget -c https://ziglang.org/download/${VERSION}/zig-linux-${ARCH}-${VERSION}.tar.xz -O $REPOSITORY/zig-linux-${ARCH}-${VERSION}.tar.gz
2021-07-19 14:36:29 +02:00
mkdir -p $TMP
cd $TMP
tar xvf $REPOSITORY/zig-linux-${ARCH}-${VERSION}.tar.gz
2021-08-08 11:44:44 +02:00
cd zig-linux-${ARCH}-${VERSION}
2021-07-19 14:36:29 +02:00
# installation
mkdir -p $PKG$PREFIX/bin/
install -D zig $PKG$PREFIX/bin/zig
mkdir -p $PKG$PREFIX/doc/$PRGNAM
install -D LICENSE $PKG$PREFIX/doc/zig/LICENSE
cp -r lib $PKG$PREFIX
cp -r doc/ $PKG$PREFIX/doc/zig/
# packaging
cd $PKG
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (robust, optimal, and clear programming language)
$PRGNAM:
$PRGNAM: Zig is a general-purpose programming language and toolchain for
$PRGNAM: maintaining robust, optimal, and reusable software.
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://ziglang.org/
$PRGNAM:
EOF
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
2023-08-16 12:23:26 +02:00
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz