aboutsummaryrefslogtreecommitdiff
path: root/patches/libtiff/libtiff.SlackBuild
blob: c25199b8935619bc6e9768abd7ec0291b93af42a (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
#!/bin/bash
#
# got it from ftp://ftp.slackware.com/pub/slackware/slackware-10.2/patches/source/libtiff/libtiff.SlackBuild
# small changes by rhatto
#

CWD="`pwd`"

if [ -f "/etc/slackbuildrc" ]; then
  source /etc/slackbuildrc
fi

if [ -f "~/.slackbuildrc" ]; then
  source ~/.slackbuildrc
fi

# default settings
PACKAGE="libtiff"
ARCH=${ARCH:=x86_64}
VERSION=${VERSION:=3.8.2}
BUILD=${BUILD:=1rha}
SRC_DIR=${SRC:=$CWD}
TMP=${TMP:=/tmp}
REPOS=${REPOS:=$TMP}

LIBDIR=/usr/lib
if [ "$ARCH" = "i386" ]; then
  SLKCFLAGS="-O2 -march=i386 -mcpu=i686"
elif [ "$ARCH" = "i486" ]; then
  SLKCFLAGS="-O2 -march=i486 -mcpu=i686"
elif [ "$ARCH" = "s390" ]; then
  SLKCFLAGS="-O2"
elif [ "$ARCH" = "x86_64" ]; then
  export LDFLAGS="-L/lib64 -L/usr/lib64"
  SLKCFLAGS="-O2"
  LIBDIR=/usr/lib64
fi

RTOOL="wget"
PACKAGE_EXT="gz"
SRC="tiff-$VERSION.tar.$PACKAGE_EXT"
URL="ftp://ftp.remotesensing.org/pub/libtiff/$SRC"

SRC_DIR="$SRC_DIR/$PACKAGE"
mkdir -p $SRC_DIR

if [ "$PACKAGE_EXT" == "bz2" ]; then
  tarflag="j"
else
  tarflag="z"
fi

if [ "$RTOOL" == "wget" ] && [ ! -f "$SRC_DIR/$SRC" ]; then
  wget "$URL" -O "$SRC_DIR/$SRC"
fi

TMP="$TMP/$PACKAGE"
PKG="$TMP/package-$PACKAGE"
rm -rf $TMP
mkdir -p $TMP
cd $TMP

rm -rf tiff-$VERSION
tar xvf$tarflag $SRC_DIR/tiff-$VERSION.tar.$PACKAGE_EXT
cd tiff-$VERSION

chown -R root:root .
find . -perm 777 -exec chmod 755 {} \;
find . -perm 664 -exec chmod 644 {} \;

if [ "$VERSION" == "3.8.2" ]; then
  zcat $CWD/tiff-3.8.2.goo-sec.diff.gz | patch -p1 --verbose || exit 1
  zcat $CWD/tiff-3.8.2.tiffsplit.commandline.overflow.diff.gz | patch -p1 --verbose || exit 1
fi

CFLAGS="$SLKCFLAGS" \
./configure \
  --prefix=/usr \
  --program-prefix="" \
  --program-suffix="" \
  --libdir=$LIBDIR    \
  $ARCH-slackware-linux

make -j3 || exit 1
make install DESTDIR=$PKG || exit 1
rm -r $PKG/usr/share
( 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
)
strip -g $PKG/$LIBDIR/lib*.a
chmod 755 $PKG/$LIBDIR/libtiff*.so.*
chown -R root:bin $PKG/usr/bin
mkdir -p $PKG/usr/doc/libtiff-$VERSION
cp -a \
  COPYRIGHT README RELEASE-DATE TODO VERSION \
  $PKG/usr/doc/libtiff-$VERSION

mv $PKG/usr/local/man $PKG/usr
rmdir $PKG/usr/local

# I'd use that shiny new manpage script here but all the
# .3 manpages end with '.3tiff'.
gzip -9 $PKG/usr/man/man?/*

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

cd $PKG
makepkg -l y -c n $REPOS/libtiff-$VERSION-$ARCH-$BUILD.tgz

if [ "$CLEANUP" == "yes" ]; then
  rm -rf $TMP
fi