zita-rev1.SlackBuild 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #!/bin/bash
  2. # Slackware build script for zita-rev1
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20211129 bkw: BUILD=2, new-style icons.
  6. cd $(dirname $0) ; CWD=$(pwd)
  7. PRGNAM=zita-rev1
  8. VERSION=${VERSION:-0.2.2}
  9. BUILD=${BUILD:-2}
  10. TAG=${TAG:-_SBo}
  11. PKGTYPE=${PKGTYPE:-tgz}
  12. if [ -z "$ARCH" ]; then
  13. case "$( uname -m )" in
  14. i?86) ARCH=i586 ;;
  15. arm*) ARCH=arm ;;
  16. *) ARCH=$( uname -m ) ;;
  17. esac
  18. fi
  19. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  20. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  21. exit 0
  22. fi
  23. TMP=${TMP:-/tmp/SBo}
  24. PKG=$TMP/package-$PRGNAM
  25. OUTPUT=${OUTPUT:-/tmp}
  26. if [ "$ARCH" = "i586" ]; then
  27. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  28. LIBDIRSUFFIX=""
  29. elif [ "$ARCH" = "i686" ]; then
  30. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  31. LIBDIRSUFFIX=""
  32. elif [ "$ARCH" = "x86_64" ]; then
  33. SLKCFLAGS="-O2 -fPIC"
  34. LIBDIRSUFFIX="64"
  35. else
  36. SLKCFLAGS="-O2"
  37. LIBDIRSUFFIX=""
  38. fi
  39. set -e
  40. rm -rf $PKG
  41. mkdir -p $TMP $PKG/usr/bin $OUTPUT
  42. cd $TMP
  43. rm -rf $PRGNAM-$VERSION
  44. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  45. cd $PRGNAM-$VERSION
  46. chown -R root:root .
  47. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  48. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  49. sed -i 's,pkgconf,pkg-config,' source/Makefile
  50. make -C source CFLAGS="$SLKCFLAGS" CXXFLAGS="$SLKCFLAGS" PREFIX=/usr
  51. make -C source install DESTDIR=$PKG PREFIX=/usr
  52. strip $PKG/usr/bin/$PRGNAM
  53. # 20211129 bkw: man pages taken from Debian.
  54. mkdir -p $PKG/usr/man/man1 $PKG/usr/man/fr_FR.UTF-8/man1
  55. gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  56. gzip -9c < $CWD/$PRGNAM.fr.1 > $PKG/usr/man/fr_FR.UTF-8/man1/$PRGNAM.1.gz
  57. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  58. mkdir -p $PKGDOC
  59. cp -a AUTHORS COPYING doc/* $PKGDOC
  60. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  61. # 20211129 bkw: redzita.png in the docdir isn't a png, it's a gif!
  62. mv $PKGDOC/redzita.png $PKGDOC/redzita.gif
  63. sed -i 's,redzita\.png,redzita.gif,g' $PKGDOC/*.html
  64. # zita-rev1.png made with "convert -background none -extent 128x128
  65. # -gravity center", then superimposing a pixellated letter R on top.
  66. # Debian has an SVG icon, but I think mine looks a lot nicer.
  67. for px in 16 32 48 64 128; do
  68. size=${px}x${px}
  69. dir=$PKG/usr/share/icons/hicolor/$size/apps
  70. mkdir -p $dir
  71. convert -resize $size $CWD/$PRGNAM.png $dir/$PRGNAM.png
  72. done
  73. mkdir -p $PKG/usr/share/pixmaps
  74. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
  75. # .desktop taken from Debian.
  76. mkdir -p $PKG/usr/share/applications
  77. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  78. mkdir -p $PKG/install
  79. cat $CWD/slack-desc > $PKG/install/slack-desc
  80. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  81. # Only add capability stuff if not disabled:
  82. if [ "${SETCAP:-yes}" = "yes" ]; then
  83. cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  84. # Only allow execution by audio group
  85. chown root:audio $PKG/usr/bin/$PRGNAM
  86. chmod 0750 $PKG/usr/bin/$PRGNAM
  87. fi
  88. cd $PKG
  89. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE