slackbuilds/d/crystal/SlackBuild

62 lines
2.1 KiB
Text
Raw Normal View History

2015-07-26 11:01:15 +02:00
#!/bin/sh
set -x -e
CWD=$(pwd)
PRGNAM=$(basename $CWD)
ARCH=$(uname -m)
2018-12-05 10:38:16 +01:00
BUILD=5
2015-07-26 11:01:15 +02:00
TAG=cyco
OUTPUT=/tmp
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
PREFIX=/usr
2016-05-09 17:28:58 +02:00
LATEST_RELEASE_URL=$(curl -s https://api.github.com/repos/crystal-lang/crystal/releases | grep browser_download_url | grep linux-${ARCH} | head -n 1 | cut -d '"' -f 4)
2017-10-28 21:15:47 +02:00
VERSION=$(echo $LATEST_RELEASE_URL | grep -o "/crystal-[0-9.-]*-" | sed "s|/crystal-\([0-9.-]*\)-|\1|g")
2018-03-10 09:22:36 +01:00
CLEAN_VERSION=$(echo $VERSION | tr '-' '_')
2015-07-26 11:01:15 +02:00
# cleaning
rm -fr $PKG
2018-12-05 10:38:16 +01:00
# download
2017-10-28 21:15:47 +02:00
[ ! -e $CWD/crystal-${VERSION}-linux-${ARCH}.tar.gz ] && wget -c https://github.com/manastech/crystal/releases/download/$(echo $VERSION | grep -o "[0-9.]*" | head -n1)/crystal-${VERSION}-linux-${ARCH}.tar.gz -O $CWD/crystal-${VERSION}-linux-${ARCH}.tar.gz
2015-07-26 11:01:15 +02:00
2018-12-05 10:38:16 +01:00
[ ! -e $CWD/completion.zsh ] && wget -c https://raw.githubusercontent.com/crystal-lang/crystal/master/etc/completion.zsh -O $CWD/completion.zsh
2015-07-26 11:01:15 +02:00
# installation
2018-03-10 09:22:36 +01:00
mkdir -p $PKG
cd $PKG
2017-10-28 21:15:47 +02:00
tar xvf $CWD/crystal-${VERSION}-linux-${ARCH}.tar.gz
2018-06-16 08:30:11 +02:00
mv crystal-$VERSION $PKG$PREFIX
2018-03-10 09:22:36 +01:00
mkdir -p $PKG$PREFIX/doc/
mv $PKG$PREFIX/share/doc $PKG$PREFIX/doc/$PRGNAM
mv $PKG$PREFIX/share/licenses $PKG$PREFIX/doc/$PRGNAM
mv $PKG$PREFIX/share/man $PKG$PREFIX/
2015-07-26 11:01:15 +02:00
2018-12-05 10:38:16 +01:00
mkdir -p $PKG$PREFIX/share/zsh/site-functions/
cp -R $CWD/completion.zsh $PKG$PREFIX/share/zsh/site-functions/_crystal
2015-09-22 16:24:09 +02:00
2018-03-10 09:22:36 +01:00
# sed -i "s|INSTALL_DIR=.*|INSTALL_DIR=$PREFIX/libexec/$PRGNAM|g" $PKG$PREFIX/bin/crystal
2015-07-26 11:01:15 +02:00
# packaging
cd $PKG
mkdir install
cat <<EOF > install/slack-desc
$PRGNAM: $PRGNAM (The Crystal Programming Language)
$PRGNAM:
$PRGNAM: Crystal is a programming language with the following goals:
$PRGNAM: .Have the same syntax as Ruby, or at least as similar as possible.
$PRGNAM: .Statically type-checked but without having to specify the type of variables or
$PRGNAM: method arguments.
$PRGNAM: .Be able to call C code by writing bindings to it in Crystal.
$PRGNAM: .Have compile-time evaluation and generation of code, to avoid boilerplate code.
$PRGNAM: .Compile to efficient native code.
$PRGNAM:
$PRGNAM: http://crystal-lang.org/
EOF
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
2018-03-10 09:22:36 +01:00
makepkg -l y -c n $OUTPUT/$PRGNAM-$CLEAN_VERSION-$ARCH-$BUILD$TAG.txz