magnus.SlackBuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #!/bin/bash
  2. # Slackware build script for magnus
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # This thing is more flexible and featureful than mag, but slower and
  6. # more resource-intensive (due to being written in python, I guess).
  7. # Notes:
  8. # The default refresh interval is 250ms, or 4 frames/sec. This is
  9. # painful to use. On my not-very-powerful machine, 15ms (67fps) is
  10. # fine. I'm patching the code to set the default to 30ms. Also, the
  11. # man page and --help output claim the default is 120ms...
  12. # This thing draws its own window titlebar and decorations, which look
  13. # and behave different from *everything else* I use. Very annoying,
  14. # and I'm told that's the direction the GTK/Gnome crowd is moving
  15. # towards, especially in GTK+4.
  16. # The default behaviour is to only update the magnified view when the
  17. # mouse moves, which makes this pretty useless IMO. Upstream added
  18. # a patch in git that adds a --force-refresh option, which makes it
  19. # always update. What I'm doing here: patch it so it always refreshes,
  20. # without having to pass an argument.
  21. cd $(dirname $0) ; CWD=$(pwd)
  22. PRGNAM=magnus
  23. VERSION=${VERSION:-1.0.3}
  24. BUILD=${BUILD:-1}
  25. TAG=${TAG:-_SBo}
  26. PKGTYPE=${PKGTYPE:-tgz}
  27. if [ -z "$ARCH" ]; then
  28. case "$( uname -m )" in
  29. i?86) ARCH=i586 ;;
  30. arm*) ARCH=arm ;;
  31. *) ARCH=$( uname -m ) ;;
  32. esac
  33. fi
  34. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  35. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  36. exit 0
  37. fi
  38. CWD=$(pwd)
  39. TMP=${TMP:-/tmp/SBo}
  40. PKG=$TMP/package-$PRGNAM
  41. OUTPUT=${OUTPUT:-/tmp}
  42. if [ "$ARCH" = "i586" ]; then
  43. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  44. LIBDIRSUFFIX=""
  45. elif [ "$ARCH" = "i686" ]; then
  46. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  47. LIBDIRSUFFIX=""
  48. elif [ "$ARCH" = "x86_64" ]; then
  49. SLKCFLAGS="-O2 -fPIC"
  50. LIBDIRSUFFIX="64"
  51. else
  52. SLKCFLAGS="-O2"
  53. LIBDIRSUFFIX=""
  54. fi
  55. set -e
  56. rm -rf $PKG
  57. mkdir -p $TMP $PKG $OUTPUT
  58. cd $TMP
  59. rm -rf $PRGNAM-$VERSION
  60. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  61. cd $PRGNAM-$VERSION
  62. chown -R root:root .
  63. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  64. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  65. # always refresh even if the mouse hasn't moved.
  66. sed -i '/def *poll/s,=False,=True,' $PRGNAM
  67. # set the default refresh rate to something usable.
  68. REFRESH=${REFRESH:-30}
  69. sed -i -e '/refresh_interval *=/s,250,'$REFRESH',' \
  70. -e '/--refresh-interval=/s,120,'$REFRESH',' \
  71. $PRGNAM
  72. sed -i 's,120ms,'$REFRESH',' data/$PRGNAM.1
  73. python3 setup.py install --root=$PKG
  74. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  75. cp -a README.md LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
  76. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  77. mv $PKG/usr/share/man $PKG/usr/man
  78. gzip -9 $PKG/usr/man/man?/*
  79. # doesn't ship an icon, expects to uses a system icon called "zoom-best-fit".
  80. # we have such an icon in the elementary-xfce theme, include a symlink here.
  81. mkdir -p $PKG/usr/share/icons/hicolor/48x48/apps
  82. ln -s ../../../elementary-xfce/actions/48/zoom-best-fit.png \
  83. $PKG/usr/share/icons/hicolor/48x48/apps
  84. mkdir -p $PKG/install
  85. cat $CWD/slack-desc > $PKG/install/slack-desc
  86. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  87. cd $PKG
  88. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE