95 lines
1.8 KiB
Bash
Executable file
95 lines
1.8 KiB
Bash
Executable file
#!/bin/sh -x
|
|
|
|
# variables
|
|
TAG=cyco
|
|
OUTPUT=/tmp
|
|
TMP=/tmp/$TAG
|
|
CWD=$(pwd)
|
|
|
|
PRGNAM=libxdg-basedir
|
|
PKG=$TMP/pkg-$PRGNAM
|
|
|
|
VERSION=$(date +%Y.%m.%d_%H.%M)
|
|
|
|
EXT=tar.gz
|
|
|
|
DOCS="AUTHORS ChangeLog COPYING INSTALL NEWS README TODO"
|
|
|
|
ARCH=$(uname -m)
|
|
BUILD=1
|
|
|
|
REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
|
|
|
|
PREFIX=/usr
|
|
|
|
SLCKFLAGS="-fPIC -O2"
|
|
|
|
# nettoyage préalable
|
|
rm -fr $PKG $TMP/$PRGNAM-$VERSION
|
|
|
|
mkdir -p $PKG
|
|
|
|
# mise en place
|
|
cd $TMP
|
|
if [ -e $REPOSITORY ]; then
|
|
( cd $REPOSITORY
|
|
git pull
|
|
)
|
|
else
|
|
git clone http://repo.or.cz/r/libxdg-basedir.git $REPOSITORY
|
|
fi
|
|
cp -R $REPOSITORY $PRGNAM-$VERSION
|
|
cd $PRGNAM-$VERSION
|
|
|
|
# configuration
|
|
./autogen.sh
|
|
|
|
CFLAGS=$SLCKFLAGS \
|
|
CPPFLAGS=$SLCKFLAGS \
|
|
./configure \
|
|
--prefix=$PREFIX \
|
|
--mandir=$PREFIX/man \
|
|
--libdir=$PREFIX/lib$( [ $ARCH = "x86_64" ] && echo 64 )
|
|
|
|
# compilation
|
|
make -j3 PREFIX=$PREFIX
|
|
|
|
# installation
|
|
make install DESTDIR=$PKG
|
|
|
|
# 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 (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:
|
|
EOF
|
|
|
|
# empaquetage
|
|
cd $PKG
|
|
makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD$TAG.txz
|