2021-06-15 10:26:26 +02:00
|
|
|
|
#!/bin/bash
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
|
|
|
|
# variables
|
2022-01-22 11:08:16 +01:00
|
|
|
|
VERSION=${VERSION:-latest}
|
2011-02-17 05:54:04 +01:00
|
|
|
|
|
2020-06-25 11:23:11 +02:00
|
|
|
|
TAG=gwh
|
2011-02-17 05:54:04 +01:00
|
|
|
|
TMP=/tmp/$TAG
|
2010-12-03 03:45:38 +01:00
|
|
|
|
OUTPUT=/tmp
|
2009-11-16 02:49:46 +01:00
|
|
|
|
CWD=$(pwd)
|
2024-11-18 09:55:36 +01:00
|
|
|
|
REPOSITORIES=/var/cache/SlackBuilds.gwh
|
2020-07-12 13:43:05 +02:00
|
|
|
|
REPOSITORY=$REPOSITORIES/$PRGNAM
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
2010-12-03 03:45:38 +01:00
|
|
|
|
PRGNAM=$(basename $CWD)
|
|
|
|
|
PKG=$TMP/pkg-$PRGNAM
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
2010-12-03 03:51:11 +01:00
|
|
|
|
DOCS="COPYING* README*"
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
2009-11-13 12:48:13 +01:00
|
|
|
|
ARCH=$(uname -m)
|
2010-12-03 03:45:38 +01:00
|
|
|
|
BUILD=1
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
|
|
|
|
PREFIX=/usr
|
|
|
|
|
|
|
|
|
|
SLCKFLAGS="-fPIC -O2"
|
|
|
|
|
|
|
|
|
|
# nettoyage pr<70>alable
|
2020-07-12 13:43:05 +02:00
|
|
|
|
rm -fr $PKG $TMP/$PRGNAM
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
|
|
|
|
mkdir -p $PKG
|
|
|
|
|
|
|
|
|
|
# mise en place
|
|
|
|
|
cd $TMP
|
2020-07-12 13:43:05 +02:00
|
|
|
|
#[ ! -e $REPOSITORIES ] && mkdir -p $REPOSITORIES
|
|
|
|
|
[ ! -e $REPOSITORIES/$PRGNAM ] && git clone http://github.com/keplerproject/luarocks.git $REPOSITORIES/$PRGNAM
|
|
|
|
|
( cd $REPOSITORIES/$PRGNAM;
|
|
|
|
|
git pull
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
cp -R $REPOSITORIES/$PRGNAM $TMP/$PRGNAM
|
|
|
|
|
cd $PRGNAM
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
2024-05-27 07:53:51 +02:00
|
|
|
|
[ "x$VERSION" == "xlatest" ] && VERSION=$(git tag --sort=-version:refname | head -n1)
|
2022-01-22 10:52:07 +01:00
|
|
|
|
[ "x$VERSION" == "x" ] && VERSION=trunk
|
2023-03-23 09:54:21 +01:00
|
|
|
|
[ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || git checkout $VERSION
|
2021-06-15 15:15:18 +02:00
|
|
|
|
|
2009-11-16 02:49:46 +01:00
|
|
|
|
# configuration
|
|
|
|
|
CFLAGS=$SLCKFLAGS \
|
|
|
|
|
CPPFLAGS=$SLCKFLAGS \
|
|
|
|
|
./configure \
|
2024-12-25 17:44:11 +01:00
|
|
|
|
--prefix=$PREFIX \
|
|
|
|
|
--lua-version=$(lua -v | rg -o "[0-9]\.[0-9]" | head -n1)
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
|
|
|
|
# compilation
|
|
|
|
|
make -j3 PREFIX=$PREFIX
|
|
|
|
|
|
|
|
|
|
# installation
|
2024-12-25 17:44:11 +01:00
|
|
|
|
make install DESTDIR=$PKG ROCKS_TREE=$PREFIX/lib64/luarocks
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
|
|
|
|
mkdir -p $PKG/etc/profile.d/
|
|
|
|
|
cat <<EOF > $PKG/etc/profile.d/luarocks.sh
|
2021-06-15 10:26:26 +02:00
|
|
|
|
#!/bin/bash
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
2012-02-12 17:00:02 +01:00
|
|
|
|
export PATH=\$PATH:$PREFIX/lib64/luarocks/bin
|
2009-11-16 02:49:46 +01:00
|
|
|
|
EOF
|
|
|
|
|
cat <<EOF > $PKG/etc/profile.d/luarocks.csh
|
|
|
|
|
#!/bin/csh
|
|
|
|
|
|
2012-02-12 17:00:02 +01:00
|
|
|
|
setenv PATH \$PATH:$PREFIX/lib64/luarocks/bin
|
2009-11-16 02:49:46 +01:00
|
|
|
|
EOF
|
|
|
|
|
chmod +x $PKG/etc/profile.d/*
|
|
|
|
|
|
|
|
|
|
# correction
|
|
|
|
|
cd $PKG
|
|
|
|
|
chown -R root:root *
|
|
|
|
|
|
2020-07-12 13:43:05 +02:00
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM
|
|
|
|
|
cd $TMP/$PRGNAM
|
|
|
|
|
cp -R *.md COPYING $PKG/usr/doc/$PRGNAM
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
|
|
|
|
[ -d $PKG/usr/man ] && find $PKG/usr/man -type f -name "*.?" -exec gzip -9f {} \;
|
|
|
|
|
|
|
|
|
|
# Strip binaries
|
|
|
|
|
( cd $PKG
|
|
|
|
|
find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
|
|
|
find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# embaumement
|
|
|
|
|
mkdir -p $PKG/install
|
|
|
|
|
cat <<EOF > $PKG/install/slack-desc
|
2010-12-03 03:48:34 +01:00
|
|
|
|
$PRGNAM: $PRGNAM (deployment and management system for Lua modules.)
|
2010-12-03 03:45:38 +01:00
|
|
|
|
$PRGNAM:
|
2010-12-03 03:48:34 +01:00
|
|
|
|
$PRGNAM: LuaRocks allows you to install Lua modules as self-contained packages
|
|
|
|
|
$PRGNAM: called [*rocks*]
|
2010-12-03 03:45:38 +01:00
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
2010-12-03 03:48:34 +01:00
|
|
|
|
$PRGNAM: LuaRocks is free software and uses the same license as Lua 5.1.
|
2010-12-03 03:45:38 +01:00
|
|
|
|
$PRGNAM:
|
2010-12-03 03:48:34 +01:00
|
|
|
|
$PRGNAM: http://luarocks.org
|
2010-12-03 03:45:38 +01:00
|
|
|
|
$PRGNAM:
|
2009-11-16 02:49:46 +01:00
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
# empaquetage
|
|
|
|
|
cd $PKG
|
2018-04-20 23:02:35 +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-$ARCH-$BUILD$TAG.txz
|