slackbuilds/l/libffi/SlackBuild
Gwenhael Le Moine e181ecf65d
generic name for SlackBuild scripts
Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
2018-03-14 09:35:32 +01:00

96 lines
2.1 KiB
Bash
Executable file

#!/bin/sh
# variables
CWD=$(pwd)
PRGNAM=$(basename $CWD)
VERSION=3.0.11
ARCH=$(uname -m)
BUILD=1
TAG=cyco
TMP=/tmp/$TAG
PKG=$TMP/pkg-$PRGNAM
OUTPUT=/tmp
PREFIX=/usr
DOCS="ABOUT-NLS AUTHORS ChangeLog COPYING* INSTALL NEWS README THANKS TODO"
SLCKFLAGS="-O2"
case $ARCH in
"x86_64")
SLCKFLAGS="$SLCKFLAGS -fPIC"
;;
*)
esac
# nettoyage préalable
rm -fr $PKG $TMP/$PRGNAM-$VERSION
mkdir -p $PKG
# mise en place
( cd $TMP
[ ! -e $CWD/$PRGNAM-$VERSION.tar.?z* ] && \
wget -c ftp://sourceware.org/pub/libffi/$PRGNAM-$VERSION.tar.gz \
-O $CWD/$PRGNAM-$VERSION.tar.gz
tar xf $CWD/$PRGNAM-$VERSION.tar.?z*
)
( cd $TMP/$PRGNAM-$VERSION
# configuration
CCPFLAGS=$SLCKFLAGS \
CFLAGS=$SLCKFLAGS \
LIBS="-lncursesw" \
LDFLAGS="-L$PREFIX/lib$(echo $ARCH | grep -o 64)" \
./configure \
--prefix=$PREFIX \
--mandir=$PREFIX/man \
--infodir=$PREFIX/info \
--docdir=$PREFIX/doc/$PRGNAM-$VERSION \
--includedir=$PREFIX/include \
--libdir=$PREFIX/lib$(echo $ARCH | grep -o 64)
# compilation
make -j3 PREFIX=$PREFIX
# installation
make install DESTDIR=$PKG
# WAT‽
cp -R $PKG$PREFIX/lib$(echo $ARCH | grep -o 64)/$PRGNAM-$VERSION/include $PKG$PREFIX/
)
# correction
chown -R root:root $PKG/*
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
find $PKG | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
find $PKG | 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 Portable Foreign Function Interface Library )
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: http://sourceware.org/libffi/
$PRGNAM:
EOF
# empaquetage
( cd $PKG
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | tr -d -)-$ARCH-$BUILD$TAG.txz
)