magnus.SlackBuild 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #!/bin/bash
  2. # Slackware build script for magnus
  3. # Written by B. Watson (urchlay@slackware.uk)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20230117 bkw: BUILD=2, go ahead and include an icon instead of a symlink.
  6. # This thing is more flexible and featureful than mag, but slower and
  7. # more resource-intensive (due to being written in python, I guess).
  8. # Notes:
  9. # The default refresh interval is 250ms, or 4 frames/sec. This is
  10. # painful to use. On my not-very-powerful machine, 15ms (67fps) is
  11. # fine. I'm patching the code to set the default to 30ms. Also, the
  12. # man page and --help output claim the default is 120ms...
  13. # This thing draws its own window titlebar and decorations, which look
  14. # and behave different from *everything else* I use. Very annoying,
  15. # and I'm told that's the direction the GTK/Gnome crowd is moving
  16. # towards, especially in GTK+4.
  17. # The default behaviour is to only update the magnified view when the
  18. # mouse moves, which makes this pretty useless IMO. Upstream added
  19. # a patch in git that adds a --force-refresh option, which makes it
  20. # always update. What I'm doing here: patch it so it always refreshes,
  21. # without having to pass an argument.
  22. cd $(dirname $0) ; CWD=$(pwd)
  23. PRGNAM=magnus
  24. VERSION=${VERSION:-1.0.3}
  25. BUILD=${BUILD:-2}
  26. TAG=${TAG:-_SBo}
  27. PKGTYPE=${PKGTYPE:-tgz}
  28. if [ -z "$ARCH" ]; then
  29. case "$( uname -m )" in
  30. i?86) ARCH=i586 ;;
  31. arm*) ARCH=arm ;;
  32. *) ARCH=$( uname -m ) ;;
  33. esac
  34. fi
  35. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  36. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  37. exit 0
  38. fi
  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. sed -i '/^Icon/s,=.*,=magnus,' $PKG/usr/share/applications/$PRGNAM.desktop
  80. mkdir -p $PKG/usr/share/icons/hicolor/48x48/apps
  81. cat $CWD/$PRGNAM.png > $PKG/usr/share/icons/hicolor/48x48/apps/$PRGNAM.png
  82. mkdir -p $PKG/install
  83. cat $CWD/slack-desc > $PKG/install/slack-desc
  84. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  85. cd $PKG
  86. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE