2c99795a7c
Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
99 lines
2.1 KiB
Bash
Executable file
99 lines
2.1 KiB
Bash
Executable file
#!/bin/sh -x
|
|
|
|
#NOTE: Needs File::Next (cpan -i File::Next)
|
|
|
|
# variables
|
|
|
|
TAG=cyco
|
|
TMP=/tmp/$TAG
|
|
CWD=$(pwd)
|
|
OUTPUT=/tmp
|
|
|
|
PRGNAM=$(basename $CWD)
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
VERSION=git$(date +%Y.%m.%d_%H.%M)
|
|
|
|
EXT=tar.xz
|
|
|
|
DOCS="AUTHORS ChangeLog COPYING INSTALL NEWS README TODO"
|
|
|
|
ARCH=$(uname -m)
|
|
BUILD=1
|
|
|
|
PREFIX=/usr
|
|
|
|
SLCKFLAGS="-fPIC -O2"
|
|
|
|
REPOSITORIES=/home/installs/SlackBuilds/repositories
|
|
# nettoyage préalable
|
|
rm -fr $PKG $TMP/$PRGNAM-$VERSION
|
|
|
|
mkdir -p $PKG
|
|
|
|
# mise en place
|
|
cd $TMP
|
|
if [ ! -e $REPOSITORIES/$PRGNAM ] ; then
|
|
mkdir -p $REPOSITORIES
|
|
( cd $REPOSITORIES
|
|
git clone http://github.com/petdance/ack.git $PRGNAM
|
|
)
|
|
else
|
|
( cd $REPOSITORIES/$PRGNAM
|
|
git pull
|
|
)
|
|
fi
|
|
cp -R $REPOSITORIES/$PRGNAM $TMP/$PRGNAM-$VERSION
|
|
cd $TMP/$PRGNAM-$VERSION
|
|
|
|
# configuration
|
|
perl Makefile.PL
|
|
sed -i 's|/usr/local|/usr|g' Makefile
|
|
|
|
# compilation
|
|
make -j3 PREFIX=$PREFIX
|
|
|
|
# installation
|
|
make install DESTDIR=$PKG
|
|
mv $PKG$PREFIX/share/man $PKG$PREFIX/
|
|
rm -fr $PKG$PREFIX/share/
|
|
|
|
mkdir -p $PKG/usr/share/zsh/site-functions/
|
|
mv etc/ack.zsh_completion $PKG/usr/share/zsh/site-functions/_ack
|
|
|
|
# correction
|
|
cd $PKG
|
|
chown -R root:root *
|
|
|
|
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
|
|
cd $TMP/$PRGNAM-$VERSION
|
|
cp -R $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
|
|
|
|
[ -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
|
|
$PRGNAM: $PRGNAM (a power search tool for programmers)
|
|
$PRGNAM:
|
|
$PRGNAM: ack is a tool like grep, designed for programmers with large trees of
|
|
$PRGNAM: heterogeneous source code.
|
|
$PRGNAM:
|
|
$PRGNAM: ack is written purely in Perl, and takes advantage of the power of
|
|
$PRGNAM: Perl's regular expressions.
|
|
$PRGNAM:
|
|
$PRGNAM: see /usr/doc/$PRGNAM-$VERSION for more details
|
|
$PRGNAM:
|
|
$PRGNAM: http://betterthangrep.com/
|
|
EOF
|
|
|
|
# empaquetage
|
|
cd $PKG
|
|
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD$TAG.txz
|