slackbuilds/lua/luarocks/SlackBuild

105 lines
2.3 KiB
Text
Raw Normal View History

2021-06-15 10:26:26 +02:00
#!/bin/bash
# variables
VERSION=${VERSION:-"trunk"}
2020-06-25 11:23:11 +02:00
TAG=gwh
TMP=/tmp/$TAG
2010-12-03 03:45:38 +01:00
OUTPUT=/tmp
CWD=$(pwd)
2011-07-22 08:41:46 +02:00
REPOSITORIES=/home/installs/SlackBuilds/repositories
2020-07-12 13:43:05 +02:00
REPOSITORY=$REPOSITORIES/$PRGNAM
2010-12-03 03:45:38 +01:00
PRGNAM=$(basename $CWD)
PKG=$TMP/pkg-$PRGNAM
2010-12-03 03:51:11 +01:00
DOCS="COPYING* README*"
ARCH=$(uname -m)
2010-12-03 03:45:38 +01:00
BUILD=1
PREFIX=/usr
SLCKFLAGS="-fPIC -O2"
# nettoyage pr<70>alable
2020-07-12 13:43:05 +02:00
rm -fr $PKG $TMP/$PRGNAM
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
[ "x$VERSION" == "xtrunk" ] && VERSION="git_$(git log -1 --format=%h_%ad --date=format:%Y.%m.%d)" || git checkout $VERSION
# configuration
CFLAGS=$SLCKFLAGS \
CPPFLAGS=$SLCKFLAGS \
./configure \
--prefix=$PREFIX
# compilation
make -j3 PREFIX=$PREFIX
# installation
make install DESTDIR=$PKG ROCKS_TREE=$PREFIX/lib64/luarocks #LUADIR=$PREFIX/lib64/lua/5.1
mkdir -p $PKG/etc/profile.d/
cat <<EOF > $PKG/etc/profile.d/luarocks.sh
2021-06-15 10:26:26 +02:00
#!/bin/bash
export PATH=\$PATH:$PREFIX/lib64/luarocks/bin
EOF
cat <<EOF > $PKG/etc/profile.d/luarocks.csh
#!/bin/csh
setenv PATH \$PATH:$PREFIX/lib64/luarocks/bin
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
[ -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:
EOF
# empaquetage
cd $PKG
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
2020-07-12 13:43:05 +02:00
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz