summaryrefslogtreecommitdiffstats
path: root/libraries/libpst/libpst.SlackBuild
blob: f02b91fcd1ca669a0bbf06564e501ca5a62ef73a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/bin/bash

# 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.

# 20220510 bkw: old website went 404, project moved to github. thanks to
# Ozan Türkyılmaz for reporting this!
# 20211019 bkw:
# - upgrade to 0.6.76
# - build both python 2 and 3 modules
# - get rid of .la files
# 20201025 bkw: upgrade to 0.6.75
# 20200224 bkw: upgrade to 0.6.74
# 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

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=libpst
VERSION=${VERSION:-0.6.76}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}

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

if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

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

# 20220510 bkw: the github release URL has a ton of cloud-ey CGI
# parameters. wget (with or without content-disposition) saves it
# with the right filename, but be paranoid about it anyway:
TARBALL=$CWD/$PRGNAM-$VERSION.tar.gz
[ -e $TARBALL ] || TARBALL="$( /bin/ls -1 $TARBALL* | head -1 )"

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $TARBALL
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 {} \+

buildit() {
  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
}

# 20211019 bkw: python3 builds work now. Include support for both
# python versions, 2 and 3. Unfortunately this means building the
# entire project twice (keeping only the python2 stuff from the
# first build). autotools doesn't make it easy or even necessarily
# possible to build only part of a project :(

# Python 2 build. If python2 ever really does go away, this code will
# silently omit python2 support from the package.
if type -p python2 &>/dev/null; then
  PY2VER="$( python2 --version 2>&1 | cut -d' ' -f2 | cut -d. -f1,2 )"

  # ./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.bak 's,\<python3\..\>,python'$PY2VER',g' m4/ax_python.m4

  buildit

  mv $PKG/usr/lib$LIBDIRSUFFIX/python$PY2VER $PKG/.keep.python2
  rm -rf $PKG/*

  # put everything back the way it was.
  make distclean
  mv m4/ax_python.m4.bak m4/ax_python.m4
fi

# Python 3 build
buildit
[ -e $PKG/.keep.python2 ] && \
  mv $PKG/.keep.python2 $PKG/usr/lib$LIBDIRSUFFIX/python$PY2VER

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

rm -f $PKG/usr/lib*/*.la $PKG/usr/lib*/python*/*/*.la

# 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