slackbuilds_ponce/office/fbreader/fbreader.SlackBuild
2010-05-19 02:47:05 -04:00

93 lines
2.7 KiB
Bash

#!/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/03/27
PRGNAM=fbreader
VERSION=0.12.9
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=""
ARCHQUADLET=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
LIBDIRSUFFIX=""
ARCHQUADLET=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
ARCHQUADLET=""
elif [ "$ARCH" = "arm" ]; then
SLKCFLAGS="-O2 -march=armv4t"
LIBDIRSUFFIX=""
ARCHQUADLET="-gnueabi"
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
# Use "-j1" to avoid some warnings
make -j1 LIBDIR=/usr/lib${LIBDIRSUFFIX}
make install LIBDIR=/usr/lib${LIBDIRSUFFIX} DESTDIR=$PKG
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
# 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}