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
|
|
|
|
|
|
|
|
# cleaning
|
|
|
|
rm -fr $PKG
|
|
|
|
|
|
|
|
# unpacking
|
2021-08-08 11:44:44 +02:00
|
|
|
[ ! -e $CWD/zig-linux-${ARCH}-${VERSION}.tar.gz ] && wget -c https://ziglang.org/download/${VERSION}/zig-linux-${ARCH}-${VERSION}.tar.xz -O $CWD/zig-linux-${ARCH}-${VERSION}.tar.gz
|
2021-07-19 14:36:29 +02:00
|
|
|
|
|
|
|
mkdir -p $TMP
|
|
|
|
cd $TMP
|
2021-08-08 11:44:44 +02:00
|
|
|
tar xvf $CWD/zig-linux-${ARCH}-${VERSION}.tar.gz
|
|
|
|
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
|
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz
|