slackbuilds/d/factor/SlackBuild
Gwenhael Le Moine 14b478de9b
use bash
2021-06-15 10:26:26 +02:00

59 lines
1.5 KiB
Bash
Executable file

#!/bin/bash
set -x -e
CWD=$(pwd)
PRGNAM=$(basename $CWD)
ARCH=$(uname -m)
VERSION=$(curl -s https://api.github.com/repos/factor/factor/releases/latest | grep tag_name | grep -o "[0-9.]*")
BUILD=1
TAG=gwh
OUTPUT=/tmp
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
PREFIX=/usr
# cleaning
rm -fr $PKG
# unpacking
[ ! -e $CWD/${PRGNAM}-${VERSION}.tar.gz ] && wget -c http://downloads.factorcode.org/releases/$VERSION/factor-linux-x86-64-$VERSION.tar.gz -O $CWD/${PRGNAM}-${VERSION}.tar.gz
mkdir -p $PKG$PREFIX/libexec/
( cd $PKG$PREFIX/libexec/
tar xf $CWD/${PRGNAM}-${VERSION}.tar.gz
)
# installation
mkdir -p $PKG$PREFIX/{bin,doc/$PRGNAM-$VERSION}
cat <<EOF > $PKG$PREFIX/bin/$PRGNAM
#!/bin/bash
cd $PREFIX/libexec/$PRGNAM
./$PRGNAM \$@
EOF
chmod +x $PKG$PREFIX/bin/$PRGNAM
( cd $PKG$PREFIX/doc/$PRGNAM-$VERSION
ln -s ../libexec/$PRGNAM/readme.html
ln -s ../libexec/$PRGNAM/license.txt
)
# packaging
cd $PKG
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (A practical stack language)
$PRGNAM:
$PRGNAM: Factor is expressive, fast, supports interactive development and has a
$PRGNAM: full-featured library. Factor runs on all common platforms and Factor
$PRGNAM: applications are portable between them. Factor can deploy stand-alone
$PRGNAM: applications on all platforms.
$PRGNAM:
$PRGNAM: see $PREFIX/doc/$PRGNAM-$VERSION
$PRGNAM:
$PRGNAM: http://factorcode.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