2010-05-11 20:01:49 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# Slackware build script for fbreader
|
2010-05-13 00:39:08 +02:00
|
|
|
# Originally written by Audrius Kazukauskas <audrius@neutrino.lt>
|
|
|
|
# Maintained as of version 0.12.1 by Niels Horn <niels.horn@gmail.com>
|
2011-03-10 01:43:16 +01:00
|
|
|
# revision date: 2011/03/09
|
2010-05-11 20:01:49 +02:00
|
|
|
|
|
|
|
PRGNAM=fbreader
|
2010-06-12 13:39:09 +02:00
|
|
|
VERSION=${VERSION:-0.12.10}
|
2011-03-10 01:43:16 +01:00
|
|
|
BUILD=${BUILD:-2}
|
2010-05-11 20:01:49 +02:00
|
|
|
TAG=${TAG:-_SBo}
|
|
|
|
|
2010-06-12 13:39:09 +02:00
|
|
|
if [ -z "$ARCH" ]; then
|
|
|
|
case "$( uname -m )" in
|
|
|
|
i?86) ARCH=i486 ;;
|
|
|
|
arm*) ARCH=arm ;;
|
|
|
|
*) ARCH=$( uname -m ) ;;
|
|
|
|
esac
|
|
|
|
fi
|
|
|
|
|
2010-05-11 20:01:49 +02:00
|
|
|
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
|
2010-05-13 00:39:08 +02:00
|
|
|
UI=${UI:-qt4}
|
2010-05-11 20:01:49 +02:00
|
|
|
|
|
|
|
if [ "$ARCH" = "i486" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
|
2010-05-13 00:39:08 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-03-22 08:27:39 +01:00
|
|
|
ARCHQUADLET=""
|
2010-05-11 20:01:49 +02:00
|
|
|
elif [ "$ARCH" = "i686" ]; then
|
|
|
|
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
|
2010-05-13 00:39:08 +02:00
|
|
|
LIBDIRSUFFIX=""
|
2010-03-22 08:27:39 +01:00
|
|
|
ARCHQUADLET=""
|
2010-05-13 00:39:08 +02:00
|
|
|
elif [ "$ARCH" = "x86_64" ]; then
|
|
|
|
SLKCFLAGS="-O2 -fPIC"
|
|
|
|
LIBDIRSUFFIX="64"
|
2010-03-22 08:27:39 +01:00
|
|
|
ARCHQUADLET=""
|
2010-06-12 13:39:09 +02:00
|
|
|
else
|
|
|
|
SLKCFLAGS="-O2"
|
|
|
|
LIBDIRSUFFIX=""
|
|
|
|
ARCHQUADLET=""
|
2010-05-11 20:01:49 +02:00
|
|
|
fi
|
|
|
|
|
2011-03-10 01:43:16 +01:00
|
|
|
set -e
|
2010-05-11 20:01:49 +02:00
|
|
|
|
|
|
|
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 .
|
2013-11-25 12:23:31 +01:00
|
|
|
find -L . \
|
|
|
|
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
|
|
|
|
-o -perm 511 \) -exec chmod 755 {} \; -o \
|
|
|
|
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
|
|
|
|
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
|
2010-05-11 20:01:49 +02:00
|
|
|
|
2010-05-13 00:39:08 +02:00
|
|
|
# We're building for desktop against Qt4
|
2010-05-11 20:01:49 +02:00
|
|
|
# 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
|
|
|
|
|
2010-05-13 00:39:08 +02:00
|
|
|
# Fix all Qt3 related flags (just in case)
|
2010-05-11 20:01:49 +02:00
|
|
|
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
|
|
|
|
|
2010-05-11 22:26:05 +02:00
|
|
|
# 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
|
|
|
|
|
2011-03-10 01:43:16 +01:00
|
|
|
# Patch source for gcc45x hickup (from the friendly ARCH people)
|
|
|
|
patch -p1 < $CWD/fbreader_gcc45x.patch
|
|
|
|
|
2010-05-14 23:48:53 +02:00
|
|
|
# Use "-j1" to avoid some warnings
|
2010-03-22 08:27:39 +01:00
|
|
|
make -j1 LIBDIR=/usr/lib${LIBDIRSUFFIX}
|
2010-05-13 00:39:08 +02:00
|
|
|
make install LIBDIR=/usr/lib${LIBDIRSUFFIX} DESTDIR=$PKG
|
2010-05-11 20:01:49 +02:00
|
|
|
|
2010-05-19 08:47:05 +02:00
|
|
|
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
|
|
|
|
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
|
2010-05-11 20:01:49 +02:00
|
|
|
|
|
|
|
# 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
|
2010-05-13 00:39:08 +02:00
|
|
|
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
|