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

58 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
set -x -e
CWD=$(pwd)
PRGNAM=$(basename $CWD)
ARCH=$(uname -m)
GITHUB_REPO=racket/racket
VERSION=${VERSION:-$(curl -s https://api.github.com/repos/${GITHUB_REPO}/releases/latest | jq -r .tag_name | sed 's|^v||')}
BUILD=3
TAG=gwh
OUTPUT=/tmp
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
PREFIX=/usr
REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/_repositories/$PRGNAM}
# cleaning
rm -fr $PKG
mkdir -p $PKG
# getting
mkdir -p $REPOSITORY
[ ! -e $REPOSITORY/racket-${VERSION}-${ARCH}-linux-cs.sh ] && wget -c https://download.racket-lang.org/installers/${VERSION}/racket-${VERSION}-${ARCH}-linux-cs.sh -O $REPOSITORY/racket-${VERSION}-${ARCH}-linux-cs.sh
# installing
chmod +x $REPOSITORY/racket-${VERSION}-${ARCH}-linux-cs.sh
$REPOSITORY/racket-${VERSION}-${ARCH}-linux-cs.sh --unix-style --create-dir --dest $PKG$PREFIX
# post-install
rm $PKG$PREFIX/bin/racket-uninstall
mv $PKG$PREFIX/lib/racket/compiled$PKG$PREFIX $PKG$PREFIX/lib/racket/compiled/
rm -r $PKG$PREFIX/lib/racket/compiled/tmp/
mv $PKG$PREFIX/share/man $PKG$PREFIX
[ -d $PKG$PREFIX/man ] && find $PKG$PREFIX/man -type f -not -name \*.gz -exec gzip -9 {} \;
# packaging
cd $PKG
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (the Language-Oriented Programming Language)
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://racket-lang.org/
$PRGNAM:
EOF
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d '-')-$ARCH-$BUILD$TAG.txz