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

54 lines
1.9 KiB
Bash
Executable file

#!/bin/bash
set -e
CWD=$(pwd)
PRGNAM=$(basename $CWD)
VERSION=${VERSION:-$(curl -s "https://gitlab.haskell.org/haskell/ghcup-hs/-/tags?format=atom" | grep "title>v" | head -n1 | grep -o "[0-9rc.-]*")}
ARCH=$(uname -m)
BUILD=${BUILD:-2}
TAG=${TAG:-gwh}
TMP=${TMP:-/tmp/$TAG}
PKG=$TMP/pkg-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/_repositories/$PRGNAM}
mkdir -p $REPOSITORY
[ ! -e $REPOSITORY/${PRGNAM}-${VERSION} ] && wget -c -O $REPOSITORY/${PRGNAM}-${VERSION} https://downloads.haskell.org/~ghcup/$VERSION/${ARCH}-linux-ghcup-$VERSION
rm -fr $PKG
mkdir -p $PKG/usr/bin
cp $REPOSITORY/${PRGNAM}-${VERSION} $PKG/usr/bin/ghcup
chmod 0755 $PKG/usr/bin/ghcup
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 ':'.
|-----handy-ruler------------------------------------------------------|
${PRGNAM}: ${PRGNAM} ( installer for Haskell )
${PRGNAM}:
${PRGNAM}: ghcup makes it easy to install specific versions of ghc on GNU/Linux,
${PRGNAM}: macOS (aka Darwin) and FreeBSD and can also bootstrap a fresh Haskell
${PRGNAM}: developer environment from scratch. It follows the unix UNIX
${PRGNAM}: philosophy of do one thing and do it well.
${PRGNAM}:
${PRGNAM}: Similar in scope to rustup, pyenv and jenv.
${PRGNAM}:
${PRGNAM}: https://www.haskell.org/ghcup/
${PRGNAM}: https://gitlab.haskell.org/haskell/ghcup-hs
EOF
cd $PKG
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