75 lines
1.9 KiB
Bash
Executable file
75 lines
1.9 KiB
Bash
Executable file
#!/bin/bash
|
|
set -x -e
|
|
|
|
CWD=$(pwd)
|
|
|
|
PRGNAM=$(basename $CWD)
|
|
ARCH=$(uname -m)
|
|
GITHUB_REPO=factor/factor
|
|
VERSION=${VERSION:-$(curl -s https://api.github.com/repos/${GITHUB_REPO}/releases/latest | grep tag_name | grep -o "[0-9.]*")}
|
|
BUILD=${BUILD:-3}
|
|
|
|
TAG=gwh
|
|
OUTPUT=/tmp
|
|
TMP=/tmp/$TAG
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
PREFIX=/usr
|
|
|
|
REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/_repositories/$PRGNAM}
|
|
|
|
mkdir -p $TMP
|
|
|
|
# cleaning
|
|
rm -fr $PKG $TMP/$PRGNAM
|
|
|
|
# mise en place
|
|
cd $TMP
|
|
[ ! -e $REPOSITORY ] && git clone https://github.com/${GITHUB_REPO}.git $REPOSITORY
|
|
cd $REPOSITORY
|
|
git pull --all
|
|
|
|
[ -e $TMP/$PRGNAM ] && rm -fr $TMP/$PRGNAM
|
|
cp -R $REPOSITORY $TMP/$PRGNAM
|
|
cd $TMP/$PRGNAM
|
|
[ "x$VERSION" == "xlatest" ] && VERSION=$(git describe --tags --abbrev=0)
|
|
[ "x$VERSION" == "x" ] && VERSION=trunk
|
|
[ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout $VERSION
|
|
|
|
./build.sh update
|
|
|
|
# installation
|
|
mkdir -p $PKG$PREFIX/libexec/$PRGNAM
|
|
cp -a * $PKG$PREFIX/libexec/$PRGNAM
|
|
|
|
mkdir -p $PKG$PREFIX/{bin,doc/$PRGNAM}
|
|
cat <<EOF > $PKG$PREFIX/bin/factor
|
|
#!/bin/bash
|
|
cd $PREFIX/libexec/$PRGNAM
|
|
./factor \$@
|
|
EOF
|
|
chmod +x $PKG$PREFIX/bin/factor
|
|
|
|
( cd $PKG$PREFIX/doc/$PRGNAM
|
|
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
|
|
$PRGNAM:
|
|
$PRGNAM: http://factorcode.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
|