2009-11-16 02:49:46 +01:00
|
|
|
|
#!/bin/sh -x
|
|
|
|
|
|
|
|
|
|
# variables
|
2010-12-03 03:45:38 +01:00
|
|
|
|
PACKAGER=cyco
|
|
|
|
|
TMP=/tmp/$PACKAGER
|
|
|
|
|
OUTPUT=/tmp
|
2009-11-16 02:49:46 +01:00
|
|
|
|
CWD=$(pwd)
|
2010-12-03 03:45:38 +01:00
|
|
|
|
REPOSITORIES=/home/cycojesus/projets/packages/repositories
|
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:45:38 +01:00
|
|
|
|
VERSION=$(date +%Y.%m%d_%H.%M)
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
|
|
|
|
EXT=tar.gz
|
|
|
|
|
|
|
|
|
|
DOCS="AUTHORS ChangeLog COPYING INSTALL NEWS README TODO"
|
|
|
|
|
|
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
|
2010-12-03 03:45:38 +01:00
|
|
|
|
rm -fr $PKG $TMP/$PRGNAM-$VERSION
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
|
|
|
|
mkdir -p $PKG
|
|
|
|
|
|
|
|
|
|
# mise en place
|
|
|
|
|
cd $TMP
|
2010-12-03 03:45:38 +01:00
|
|
|
|
if [ -e $CWD/$PRGNAM-$VERSION.$EXT ]; then
|
|
|
|
|
tar xf $CWD/$PRGNAM-$VERSION.$EXT
|
|
|
|
|
else
|
|
|
|
|
[ ! -e $REPOSITORIES ] && mkdir -p $REPOSITORIES
|
|
|
|
|
if [ ! -e $REPOSITORIES/$PRGNAM ]; then
|
|
|
|
|
git clone git://github.com/keplerproject/luarocks.git $REPOSITORIES/$PRGNAM
|
|
|
|
|
else
|
|
|
|
|
( cd $REPOSITORIES/$PRGNAM
|
|
|
|
|
git pull
|
|
|
|
|
)
|
|
|
|
|
fi
|
|
|
|
|
cp -R $REPOSITORIES/$PRGNAM $TMP/$PRGNAM-$VERSION
|
|
|
|
|
fi
|
|
|
|
|
cd $PRGNAM-$VERSION
|
2009-11-16 02:49:46 +01:00
|
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
|
|
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 *
|
|
|
|
|
|
2010-12-03 03:45:38 +01:00
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
|
cd $TMP/$PRGNAM-$VERSION
|
|
|
|
|
cp -R $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
|
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:45:38 +01:00
|
|
|
|
$PRGNAM: $PRGNAM (one line description here)
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM: More verbose description here, usually from the README file.
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM:
|
|
|
|
|
$PRGNAM: see /usr/doc/$PRGNAM-$VERSION for more details
|
|
|
|
|
$PRGNAM:
|
2009-11-16 02:49:46 +01:00
|
|
|
|
EOF
|
|
|
|
|
|
|
|
|
|
# empaquetage
|
|
|
|
|
cd $PKG
|
2010-12-03 03:45:38 +01:00
|
|
|
|
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD$PACKAGER.txz
|