fbreader.SlackBuild 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. # Slackware build script for fbreader
  3. # Originally written by Audrius Kazukauskas <audrius@neutrino.lt>
  4. # Maintained as of version 0.12.1 by Niels Horn <niels.horn@gmail.com>
  5. # revision date: 2011/03/09
  6. cd $(dirname $0) ; CWD=$(pwd)
  7. PRGNAM=fbreader
  8. VERSION=${VERSION:-0.99.4}
  9. BUILD=${BUILD:-1}
  10. TAG=${TAG:-_SBo}
  11. PKGTYPE=${PKGTYPE:-tgz}
  12. if [ -z "$ARCH" ]; then
  13. case "$( uname -m )" in
  14. i?86) ARCH=i486 ;;
  15. arm*) ARCH=arm ;;
  16. *) ARCH=$( uname -m ) ;;
  17. esac
  18. fi
  19. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  20. # the name of the created package would be, and then exit. This information
  21. # could be useful to other scripts.
  22. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  23. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  24. exit 0
  25. fi
  26. TMP=${TMP:-/tmp/SBo}
  27. PKG=$TMP/package-$PRGNAM
  28. OUTPUT=${OUTPUT:-/tmp}
  29. if [ "$ARCH" = "i486" ]; then
  30. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  31. LIBDIRSUFFIX=""
  32. ARCHQUADLET=""
  33. elif [ "$ARCH" = "i686" ]; then
  34. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  35. LIBDIRSUFFIX=""
  36. ARCHQUADLET=""
  37. elif [ "$ARCH" = "x86_64" ]; then
  38. SLKCFLAGS="-O2 -fPIC"
  39. LIBDIRSUFFIX="64"
  40. ARCHQUADLET=""
  41. else
  42. SLKCFLAGS="-O2"
  43. LIBDIRSUFFIX=""
  44. ARCHQUADLET=""
  45. fi
  46. set -e
  47. rm -rf $PKG
  48. mkdir -p $TMP $PKG $OUTPUT
  49. cd $TMP
  50. rm -rf $PRGNAM-$VERSION
  51. tar xvf $CWD/$PRGNAM-sources-$VERSION.tgz
  52. cd $PRGNAM-$VERSION
  53. chown -R root:root .
  54. find -L . \
  55. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  56. -o -perm 511 \) -exec chmod 755 {} \; -o \
  57. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  58. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  59. # Needed for gcc >= 6.x
  60. sed -i "s|-Wall|-Wall -Wno-narrowing|" makefiles/arch/desktop.mk
  61. patch -p1 < $CWD/fbreader-0.99.4.patch
  62. # Port to qt5 - patch from gentoo
  63. patch -p1 < $CWD/fbreader-qt5.patch
  64. export TARGET_ARCH=desktop
  65. export UI_TYPE=qt4 # this hasn't changed
  66. export TARGET_STATUS=release
  67. make LIBDIR=/usr/lib${LIBDIRSUFFIX}
  68. make install LIBDIR=/usr/lib${LIBDIRSUFFIX} DESTDIR=$PKG
  69. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  70. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  71. # Fix .desktop file
  72. sed -i 's|^Name=E-book reader|Name=FBReader|' $PKG/usr/share/applications/FBReader.desktop
  73. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  74. cp -a README.build fbreader/LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
  75. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  76. mkdir -p $PKG/install
  77. cat $CWD/slack-desc > $PKG/install/slack-desc
  78. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  79. cd $PKG
  80. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE