#!/bin/bash # variables VERSION=${VERSION:-latest} TAG=gwh TMP=/tmp/$TAG OUTPUT=/tmp CWD=$(pwd) REPOSITORIES=/home/installs/SlackBuilds/_repositories REPOSITORY=$REPOSITORIES/$PRGNAM PRGNAM=$(basename $CWD) PKG=$TMP/pkg-$PRGNAM DOCS="COPYING* README*" ARCH=$(uname -m) BUILD=1 PREFIX=/usr SLCKFLAGS="-fPIC -O2" # nettoyage préalable rm -fr $PKG $TMP/$PRGNAM mkdir -p $PKG # mise en place cd $TMP #[ ! -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" == "xlatest" ] && VERSION=$(git tag --sort=-version:refname | head -n1) [ "x$VERSION" == "x" ] && VERSION=trunk [ "x$VERSION" == "xtrunk" ] && VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)" || 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 < $PKG/etc/profile.d/luarocks.sh #!/bin/bash export PATH=\$PATH:$PREFIX/lib64/luarocks/bin EOF cat < $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 * 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 < $PKG/install/slack-desc $PRGNAM: $PRGNAM (deployment and management system for Lua modules.) $PRGNAM: $PRGNAM: LuaRocks allows you to install Lua modules as self-contained packages $PRGNAM: called [*rocks*] $PRGNAM: $PRGNAM: $PRGNAM: $PRGNAM: LuaRocks is free software and uses the same license as Lua 5.1. $PRGNAM: $PRGNAM: http://luarocks.org $PRGNAM: EOF # empaquetage cd $PKG rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la /sbin/makepkg --linkadd y --chown n --prepend $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.txz