slackbuilds/d/bun-bin/SlackBuild
2023-08-16 12:23:26 +02:00

61 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
set -e
CWD=$(pwd)
PRGNAM=$(basename $CWD)
ARCH=$(uname -m)
BUILD=2 # add completions
TAG=gwh
OUTPUT=/tmp
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
PREFIX=/usr
VERSION=${VERSION:-$(curl -s https://api.github.com/repos/Jarred-Sumner/bun/tags | jq -r '.[0].name')}
REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/_repositories/$PRGNAM}
BINARCH=x64
mkdir -p $REPOSITORY
# cleaning
rm -fr $PKG
# download
[ ! -e $REPOSITORY/bun-linux-${BINARCH}-${VERSION}.zip ] && wget -c https://github.com/Jarred-Sumner/bun/releases/download/bun-${VERSION}/bun-linux-${BINARCH}.zip -O $REPOSITORY/bun-linux-${BINARCH}-${VERSION}.zip
# installation
mkdir -p $PKG/usr
cd $PKG/usr/
unzip $REPOSITORY/bun-linux-${BINARCH}-${VERSION}.zip
mv bun-linux-${BINARCH} bin
chmod +x bin/bun
mkdir -p $PKG/usr/share/zsh/site-functions
$PKG/usr/bin/bun completions > $PKG/usr/share/zsh/site-functions/_bun
# packaging
cd $PKG
chown -R root:root *
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (Incredibly fast JavaScript runtime, bundler, transpiler and package manager)
$PRGNAM:
$PRGNAM: Bun is a fast all-in-one JavaScript runtime
$PRGNAM:
$PRGNAM: Bundle, transpile, install and run JavaScript & TypeScript projects — all in Bun.
$PRGNAM: Bun is a new JavaScript runtime with a native bundler, transpiler, task runner and
$PRGNAM: npm client built-in.
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://bun.sh/
EOF
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz