slackbuilds/d/ghcup/SlackBuild
2022-01-22 19:52:02 +01:00

53 lines
1.8 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:-1}
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/bin
cp $REPOSITORY/${PRGNAM}-${VERSION} $PKG/bin/$PRGNAM
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 -l y -c n ${OUTPUT}/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.txz