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
|
#!/bin/bash
# Slackware build script for jfbview
# Written by B. Watson (yalhcru@gmail.com)
# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
# This doesn't depend on mupdf or mupdf-legacy because it includes its
# own bundled mupdf source.
cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=jfbview
VERSION=${VERSION:-0.6.0}
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
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
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION-full-source
unzip $CWD/$PRGNAM-$VERSION-full-source.zip
cd $PRGNAM-$VERSION-full-source
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 {} \+
# fix a typo.
sed -i 's,Plase,Please,' src/main.cpp
# hardcoded man and doc paths.
sed -i -e 's,share/man,man,g' \
-e "s,share/doc/$PRGNAM,doc/$PRGNAM-$VERSION,g" \
doc/CMakeLists.txt
# no autodetect for imlib2, help it out some.
IMLIB_OPT=off
[ "${IMLIB:-yes}" = "yes" ] && pkg-config --exists imlib2 && IMLIB_OPT=on
mkdir -p build
cd build
cmake \
-DENABLE_IMAGE_SUPPORT=$IMLIB_OPT \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release ..
make
make install/strip DESTDIR=$PKG
cd ..
# when building without imlib2, we end up with two almost-identical copies
# of the binary, weighing in at 36MB apiece. use symlinks instead.
rm -f $PKG/usr/bin/jfbpdf $PKG/usr/man/man1/jfbpdf.1.gz
ln -s $PRGNAM $PKG/usr/bin/jfbpdf
ln -s $PRGNAM.1.gz $PKG/usr/man/man1/jfbpdf.1.gz
# upstream's got a nice man page for the main application, but nothing
# for jpdf(cat|grep), so I wrote these.
gzip -9c < $CWD/jpdfcat.1 > $PKG/usr/man/man1/jpdfcat.1.gz
gzip -9c < $CWD/jpdfgrep.1 > $PKG/usr/man/man1/jpdfgrep.1.gz
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
WITHIM=WITHOUT
objdump -p $PKG/usr/bin/$PRGNAM | grep -q 'NEEDED.*libImlib2' && WITHIM=with
mkdir -p $PKG/install
sed "s,@WITHIM@,$WITHIM," $CWD/slack-desc > $PKG/install/slack-desc
cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|