aboutsummaryrefslogtreecommitdiff
path: root/office/fbreader/fbreader.SlackBuild
blob: 8199f255ca0144d0095df60101743b207335c0a0 (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
#!/bin/sh

# Slackware build script for fbreader
# Originally written by Audrius Kazukauskas <audrius@neutrino.lt>
# Maintained as of version 0.12.1 by Niels Horn <niels.horn@gmail.com>
# revision date: 2010/02/11

PRGNAM=fbreader
VERSION=0.12.2
ARCH=${ARCH:-i486}
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}

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

# If you want to build the gtk interface instead, then change this
# value to 'gtk' or run the script like this:
# UI=gtk ./fbreader.SlackBuild
UI=${UI:-qt4}

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

set -e	 # Exit on most errors

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $PRGNAM-$VERSION
tar xvf $CWD/$PRGNAM-sources-$VERSION.tgz
cd $PRGNAM-$VERSION
chown -R root:root .
chmod -R u+w,go+r-w,a-s .

# We're building for desktop against Qt4
# If you want to build against GTK+2, just change UI_TYPE to gtk
cat > makefiles/target.mk << EOF
TARGET_ARCH = desktop
UI_TYPE = $UI
TARGET_STATUS = release
EOF

# Add SLKCFLAGS
sed -i "s|CFLAGS =|CFLAGS = $SLKCFLAGS|" makefiles/arch/desktop.mk

# Fix all Qt3 related flags (just in case)
sed -i 's|moc-qt3|moc|' makefiles/arch/desktop.mk
sed -i 's|-I /usr/include/qt3|$(shell pkg-config --cflags qt-mt)|' makefiles/arch/desktop.mk
sed -i 's|-lqt-mt|$(shell pkg-config --libs qt-mt)|' makefiles/arch/desktop.mk

# Fix all Qt4 related flags
sed -i 's|moc-qt4|moc|' makefiles/arch/desktop.mk
sed -i 's|-I /usr/include/qt4|$(shell pkg-config --cflags QtGui)|' makefiles/arch/desktop.mk
sed -i 's|-lQtGui|$(shell pkg-config --libs QtGui)|' makefiles/arch/desktop.mk

make LIBDIR=/usr/lib${LIBDIRSUFFIX}
make install LIBDIR=/usr/lib${LIBDIRSUFFIX} DESTDIR=$PKG

( 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
)

# Fix .desktop file
sed -i 's|^Name=E-book reader|Name=FBReader|' $PKG/usr/share/applications/FBReader.desktop

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a README.build fbreader/LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

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

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