summaryrefslogtreecommitdiffstats
path: root/libraries/libpst/libpst.SlackBuild
blob: 1fa5bfa36c962c1210d33291be97c2a302173720 (plain)
#!/bin/sh

# Slackware build script for libpst

# Copyright 2011-2012 Roberto Neri, Palermo, Italy
#
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# 20180917 bkw: upgrade to 0.6.72

# 20170122 bkw:
# - upgrade to 0.6.69

# 20161017 bkw:
# - upgrade to 0.6.68

# 20160803 bkw:
# - upgrade to 0.6.67

# 20150513 bkw:
# - upgrade to 0.6.64

# 20140314 bkw
# - took over maintenance
# - upgrade to 0.6.63
# - make install-strip instead of slow find stuff

PRGNAM=libpst
VERSION=${VERSION:-0.6.72}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

CWD=$(pwd)
TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
else
  SLKCFLAGS="-O2"
  LIBDIRSUFFIX=""
fi

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
cd $PRGNAM-$VERSION
chown -R root:root .
find -L .  -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
        \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+

# 20180917 bkw: libpst supposedly supports python3 now, but python3
# builds fail. Not tried to diagnose it, just reverting to python2,
# like previous versions of libpst used.
# ./configure --help claims that I can set PYTHON_VERSION in the environment
# and it'll use that, but it doesn't work. So I have to use this abomination:
sed -i 's,\<python3\..\>,,g' m4/ax_python.m4

autoreconf -if

CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --libdir=/usr/lib${LIBDIRSUFFIX} \
  --mandir=/usr/man \
  --enable-dii \
  --disable-static \
  --enable-libpst-shared \
  --enable-python \
  --build=$ARCH-slackware-linux

make
# ./configure options --docdir and --htmldir have no effect,
# it is necessary to override "htmldir" and "htmldeveldir"
make install-strip DESTDIR=$PKG \
  htmldir=/usr/doc/$PRGNAM-$VERSION \
  htmldeveldir=/usr/doc/$PRGNAM-$VERSION/devel

gzip -9 $PKG/usr/man/man?/*.?

# Package documentation has aready been copied
# into $PKG/usr/doc/$PRGNAM-$VERSION by "make install"
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}