2021-06-15 10:26:26 +02:00
|
|
|
#!/bin/bash
|
2015-07-26 11:01:15 +02:00
|
|
|
set -x -e
|
|
|
|
|
|
|
|
CWD=$(pwd)
|
|
|
|
|
2022-04-19 10:47:23 +02:00
|
|
|
PRGNAM=$(basename "$CWD")
|
2015-07-26 11:01:15 +02:00
|
|
|
ARCH=$(uname -m)
|
2022-01-07 13:59:10 +01:00
|
|
|
GITHUB_REPO=crystal-lang/crystal
|
2022-01-22 10:52:07 +01:00
|
|
|
VERSION=${VERSION:-latest}
|
2024-11-18 09:55:36 +01:00
|
|
|
REPOSITORY=${REPOSITORY:-/var/cache/SlackBuilds.gwh/$PRGNAM}
|
2015-07-26 11:01:15 +02:00
|
|
|
|
2022-01-07 13:59:10 +01:00
|
|
|
BUILD=1
|
2020-06-25 11:23:11 +02:00
|
|
|
TAG=gwh
|
2015-07-26 11:01:15 +02:00
|
|
|
OUTPUT=/tmp
|
|
|
|
TMP=/tmp/$TAG
|
|
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
PREFIX=/usr
|
|
|
|
|
2022-01-07 13:59:10 +01:00
|
|
|
# cleaning
|
2022-04-19 10:47:23 +02:00
|
|
|
rm -fr "$PKG" "${TMP:?}/$PRGNAM/"
|
2022-01-14 13:31:56 +01:00
|
|
|
mkdir -p $TMP/
|
2022-01-07 13:59:10 +01:00
|
|
|
|
|
|
|
# mise en place
|
2022-04-19 10:47:23 +02:00
|
|
|
[ ! -e "$REPOSITORY" ] && git clone https://github.com/${GITHUB_REPO} "$REPOSITORY"
|
|
|
|
cd "$REPOSITORY" || exit
|
2022-01-07 13:59:10 +01:00
|
|
|
git pull --all
|
2015-09-22 16:19:10 +02:00
|
|
|
|
2022-04-19 10:47:23 +02:00
|
|
|
cp -R "$REPOSITORY" $TMP/
|
|
|
|
cd "$TMP/$PRGNAM/" || exit
|
2022-01-07 13:59:10 +01:00
|
|
|
|
2024-05-27 07:53:51 +02:00
|
|
|
[ "$VERSION" == "latest" ] && VERSION=$(git tag --sort=-version:refname | head -n1)
|
2022-04-19 10:47:23 +02:00
|
|
|
[ "$VERSION" == "" ] && VERSION=trunk
|
|
|
|
if [ "$VERSION" == "trunk" ]; then
|
2023-03-23 09:54:21 +01:00
|
|
|
VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
|
2022-04-19 10:47:23 +02:00
|
|
|
else
|
|
|
|
git checkout "$VERSION"
|
|
|
|
fi
|
2022-01-07 13:59:10 +01:00
|
|
|
|
2022-04-19 10:47:23 +02:00
|
|
|
make -j"$(nproc)" interpreter=1 release=1
|
2022-01-07 13:59:10 +01:00
|
|
|
|
|
|
|
# installation
|
2022-04-19 10:47:23 +02:00
|
|
|
make install PREFIX=$PREFIX MANDIR="$PKG$PREFIX/man" LIBDIR="$PKG$PREFIX/lib$(uname -m | grep -o 64)" DESTDIR="$PKG"
|
2022-01-07 13:59:10 +01:00
|
|
|
|
2022-04-19 10:47:23 +02:00
|
|
|
[ -d "$PKG/usr/man" ] && find "$PKG/usr/man" -type f -name "*.?" -exec gzip -9f {} \;
|
2021-09-29 12:57:50 +02:00
|
|
|
|
2022-01-07 13:59:10 +01:00
|
|
|
########
|
|
|
|
# shards #
|
|
|
|
########
|
|
|
|
SHARDS_PRGNAM=shards
|
|
|
|
SHARDS_GITHUB_REPO=crystal-lang/shards
|
|
|
|
SHARDS_VERSION=${SHARDS_VERSION:-$(curl -s https://api.github.com/repos/${SHARDS_GITHUB_REPO}/releases/latest | jq -r .tag_name | sed 's|^null$|trunk|')} # or VERSION=trunk
|
2024-11-18 09:55:36 +01:00
|
|
|
SHARDS_REPOSITORY=${SHARDS_REPOSITORY:-/var/cache/SlackBuilds.gwh/$SHARDS_PRGNAM}
|
2022-01-07 13:59:10 +01:00
|
|
|
SHARDS_PKG=$TMP/pkg-$SHARDS_PRGNAM
|
2021-09-29 12:57:50 +02:00
|
|
|
|
2015-07-26 11:01:15 +02:00
|
|
|
# cleaning
|
2022-04-19 10:47:23 +02:00
|
|
|
rm -fr "$SHARDS_PKG" "${TMP:?}/$SHARDS_PRGNAM/"
|
2022-01-07 13:59:10 +01:00
|
|
|
|
|
|
|
# mise en place
|
2022-04-19 10:47:23 +02:00
|
|
|
[ ! -e "$SHARDS_REPOSITORY" ] && git clone https://github.com/${SHARDS_GITHUB_REPO} "$SHARDS_REPOSITORY"
|
|
|
|
cd "$SHARDS_REPOSITORY" || exit
|
2022-01-07 13:59:10 +01:00
|
|
|
git pull --all
|
|
|
|
|
2022-04-19 10:47:23 +02:00
|
|
|
cp -R "$SHARDS_REPOSITORY" "$TMP/"
|
2022-01-07 13:59:10 +01:00
|
|
|
cd $TMP/$SHARDS_PRGNAM/
|
2015-07-26 11:01:15 +02:00
|
|
|
|
2024-05-27 07:53:51 +02:00
|
|
|
[ "$SHARDS_VERSION" == "latest" ] && SHARDS_VERSION=$(git tag --sort=-version:refname | head -n1)
|
2022-04-19 10:47:23 +02:00
|
|
|
[ "$SHARDS_VERSION" == "" ] && SHARDS_VERSION=trunk
|
|
|
|
if [ "$SHARDS_VERSION" == "trunk" ]; then
|
2023-03-23 09:54:21 +01:00
|
|
|
SHARDS_VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
|
2022-04-19 10:47:23 +02:00
|
|
|
else
|
|
|
|
git checkout "$SHARDS_VERSION"
|
|
|
|
fi
|
2022-04-19 10:54:55 +02:00
|
|
|
|
2022-04-19 10:47:23 +02:00
|
|
|
make -j"$(nproc)" release=1
|
2018-12-05 10:38:16 +01:00
|
|
|
|
2015-07-26 11:01:15 +02:00
|
|
|
# installation
|
2022-04-19 10:47:23 +02:00
|
|
|
make install PREFIX=$PREFIX MANDIR=$SHARDS_PKG$PREFIX/man LIBDIR="$SHARDS_PKG$PREFIX/lib$(uname -m | grep -o 64)" DESTDIR=$SHARDS_PKG
|
2022-01-07 13:59:10 +01:00
|
|
|
|
|
|
|
[ -d $SHARDS_PKG/usr/man ] && find $SHARDS_PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
|
|
|
|
|
|
|
|
################
|
|
|
|
# merge both PKG #
|
|
|
|
################
|
2015-07-26 11:01:15 +02:00
|
|
|
|
2022-04-19 10:47:23 +02:00
|
|
|
cp -R $SHARDS_PKG/* "$PKG"
|
2015-09-22 16:24:09 +02:00
|
|
|
|
2015-07-26 11:01:15 +02:00
|
|
|
# packaging
|
2022-04-19 10:47:23 +02:00
|
|
|
cd "$PKG" || exit
|
2015-07-26 11:01:15 +02:00
|
|
|
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
|
|
|
|
|
2022-04-19 10:47:23 +02:00
|
|
|
rm -f "$PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la"
|
2023-08-16 12:23:26 +02:00
|
|
|
/sbin/makepkg --linkadd y --chown n --prepend "$OUTPUT/$PRGNAM-${VERSION}_${SHARDS_VERSION}-$ARCH-$BUILD$TAG.txz"
|