jkmeter.SlackBuild 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/bash
  2. # Slackware build script for jkmeter
  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, update Bob Katz link.
  6. # 20201104 bkw: updated for 0.8.0.
  7. cd $(dirname $0) ; CWD=$(pwd)
  8. PRGNAM=jkmeter
  9. VERSION=${VERSION:-0.8.0}
  10. BUILD=${BUILD:-2}
  11. TAG=${TAG:-_SBo}
  12. PKGTYPE=${PKGTYPE:-tgz}
  13. if [ -z "$ARCH" ]; then
  14. case "$( uname -m )" in
  15. i?86) ARCH=i586 ;;
  16. arm*) ARCH=arm ;;
  17. *) ARCH=$( uname -m ) ;;
  18. esac
  19. fi
  20. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  21. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  22. exit 0
  23. fi
  24. TMP=${TMP:-/tmp/SBo}
  25. PKG=$TMP/package-$PRGNAM
  26. OUTPUT=${OUTPUT:-/tmp}
  27. if [ "$ARCH" = "i586" ]; then
  28. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  29. LIBDIRSUFFIX=""
  30. elif [ "$ARCH" = "i686" ]; then
  31. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  32. LIBDIRSUFFIX=""
  33. elif [ "$ARCH" = "x86_64" ]; then
  34. SLKCFLAGS="-O2 -fPIC"
  35. LIBDIRSUFFIX="64"
  36. else
  37. SLKCFLAGS="-O2"
  38. LIBDIRSUFFIX=""
  39. fi
  40. set -e
  41. rm -rf $PKG
  42. mkdir -p $TMP $PKG $OUTPUT
  43. cd $TMP
  44. rm -rf $PRGNAM-$VERSION
  45. tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
  46. cd $PRGNAM-$VERSION
  47. chown -R root:root .
  48. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  49. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  50. if [ "${FORCE_SLACK_CFLAGS:-no}" = "yes" ]; then
  51. sed -i \
  52. -e '/march=native/d' \
  53. -e "s,-O2 -ffast-math,$SLKCFLAGS," \
  54. source/Makefile
  55. fi
  56. sed -i 's,pkgconf,pkg-config,' source/Makefile
  57. make -C source PREFIX=/usr DESTDIR=$PKG all install
  58. strip $PKG/usr/bin/$PRGNAM
  59. # man page and .desktop file came from Debian
  60. mkdir -p $PKG/usr/man/man1 $PKG/usr/share/applications
  61. gzip -9c $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  62. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  63. # the 32x32 icon comes from Debian.
  64. # the 48x48 icon is the 32x32 one, centered in a 48x48 transparent PNG.
  65. mkdir -p $PKG/usr/share/icons/hicolor/{32x32,48x48}/apps
  66. convert $CWD/$PRGNAM.xpm \
  67. $PKG/usr/share/icons/hicolor/32x32/apps/$PRGNAM.png
  68. convert -background none -extent 48x48 -gravity center \
  69. $CWD/$PRGNAM.xpm \
  70. $PKG/usr/share/icons/hicolor/48x48/apps/$PRGNAM.png
  71. mkdir -p $PKG/usr/share/pixmaps
  72. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
  73. cat $CWD/$PRGNAM.xpm > $PKG/usr/share/pixmaps/$PRGNAM.xpm
  74. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  75. cp -a AUTHORS COPYING README $PKG/usr/doc/$PRGNAM-$VERSION
  76. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  77. mkdir -p $PKG/install
  78. cat $CWD/slack-desc > $PKG/install/slack-desc
  79. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  80. # Only add capability stuff if not disabled:
  81. if [ "${SETCAP:-yes}" = "yes" ]; then
  82. cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  83. # Only allow execution by audio group
  84. chown root:audio $PKG/usr/bin/$PRGNAM
  85. chmod 0750 $PKG/usr/bin/$PRGNAM
  86. fi
  87. cd $PKG
  88. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE