slackbuilds/l/phpredis/SlackBuild
2020-07-12 09:22:26 +02:00

83 lines
1.7 KiB
Bash
Executable file

#!/bin/sh
# variables
TAG=gwh
OUTPUT=/tmp
TMP=/tmp/$TAG
CWD=$(pwd)
PRGNAM=$(basename $CWD)
PKG=$TMP/pkg-$PRGNAM
VERSION=$(date +%Y.%m.%d_%H.%M)
EXT=tar.gz
DOCS="COPYING CREDITS README.markdown"
ARCH=$(uname -m)
BUILD=1
REPOSITORY=/home/installs/SlackBuilds/repositories/$PRGNAM
PREFIX=/usr
SLCKFLAGS="-fPIC -O2"
# nettoyage préalable
rm -fr $PKG $TMP/$PRGNAM
mkdir -p $PKG
# mise en place
[ ! -e $REPOSITORY ] && git clone https://github.com/phpredis/phpredis.git $REPOSITORY
( cd $REPOSITORY && git pull )
VERSION="$( cd $REPOSITORY && git log -1 --format=%h_%ad --date=format:%Y.%m.%d )"
cp -R $REPOSITORY $PRGNAM
cd $PRGNAM
# configuration
phpize
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 INSTALL_ROOT=$PKG
# correction
cd $PKG
chown -R root:root *
mkdir -p $PKG/usr/doc/$PRGNAM
cd $TMP/$PRGNAM
cp -R $DOCS $PKG/usr/doc/$PRGNAM
# embaumement
mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc
$PRGNAM: $PRGNAM ( A PHP extension for Redis)
$PRGNAM:
$PRGNAM: The phpredis extension provides an API for communicating with the Redis
$PRGNAM: key-value store. It is released under the PHP License, version 3.01.
$PRGNAM: This code has been developed and maintained by Owlient from November 2009 to March 2011.
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM:
$PRGNAM: https://github.com/phpredis/phpredis
$PRGNAM:
EOF
# empaquetage
cd $PKG
rm -f $PKG/{,usr/}lib$(uname -m | grep -o 64)/*.la
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$(echo $VERSION | sed 's/-//g')-$ARCH-$BUILD$TAG.txz