klick.SlackBuild 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. # Slackware build script for klick
  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
  6. # - fix build on -current. see Makefile.
  7. # - autodetect rubberband and liblo.
  8. # - enable terminal support.
  9. # - add missing klick.pod (source for the man page).
  10. # - dynamic slack-desc.
  11. # - include klick2ardour.py, in case someone has a use for it.
  12. # 20170620 bkw: add -fpermissive to cflags, for -current's gcc7.
  13. cd $(dirname $0) ; CWD=$(pwd)
  14. PRGNAM=klick
  15. VERSION=${VERSION:-0.12.2}
  16. BUILD=${BUILD:-2}
  17. TAG=${TAG:-_SBo}
  18. PKGTYPE=${PKGTYPE:-tgz}
  19. if [ -z "$ARCH" ]; then
  20. case "$( uname -m )" in
  21. i?86) ARCH=i586 ;;
  22. arm*) ARCH=arm ;;
  23. *) ARCH=$( uname -m ) ;;
  24. esac
  25. fi
  26. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  27. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  28. exit 0
  29. fi
  30. TMP=${TMP:-/tmp/SBo}
  31. PKG=$TMP/package-$PRGNAM
  32. OUTPUT=${OUTPUT:-/tmp}
  33. if [ "$ARCH" = "i586" ]; then
  34. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  35. LIBDIRSUFFIX=""
  36. elif [ "$ARCH" = "i686" ]; then
  37. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  38. LIBDIRSUFFIX=""
  39. elif [ "$ARCH" = "x86_64" ]; then
  40. SLKCFLAGS="-O2 -fPIC"
  41. LIBDIRSUFFIX="64"
  42. else
  43. SLKCFLAGS="-O2"
  44. LIBDIRSUFFIX=""
  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-$VERSION.tar.gz
  52. cd $PRGNAM-$VERSION
  53. chown -R root:root .
  54. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  55. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  56. RUBBERBAND=${RUBBERBAND:-yes}
  57. LIBLO=${LIBLO:-yes}
  58. pkg-config --exists rubberband || RUBBERBAND="no"
  59. pkg-config --exists liblo || LIBLO="no"
  60. # 20211129 bkw: wrote a Makefile because the SConstruct is too old
  61. # for scons-4.0.1 and I hate scons anyway.
  62. make -f $CWD/Makefile RUBBERBAND=$RUBBERBAND OSC=$LIBLO SLKCFLAGS="$SLKCFLAGS"
  63. mkdir -p $PKG/usr/bin $PKG/usr/share/$PRGNAM/samples
  64. install -oroot -groot -s -m0755 $PRGNAM $PKG/usr/bin
  65. install -oroot -groot -m0755 $CWD/klick2ardour.py $PKG/usr/bin
  66. install -oroot -groot -m0644 samples/* $PKG/usr/share/$PRGNAM/samples
  67. # man page written for this SlackBuild (from --help output)
  68. mkdir -p $PKG/usr/man/man1
  69. gzip -9c < $CWD/$PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
  70. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  71. cp -a COPYING NEWS README doc/manual.html $PKG/usr/doc/$PRGNAM-$VERSION
  72. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  73. L=no; R=no
  74. objdump -p $PKG/usr/bin/$PRGNAM > otmp
  75. grep -q 'NEEDED.*liblo' otmp && L=yes
  76. grep -q 'NEEDED.*librubberband' otmp && R=yes
  77. mkdir -p $PKG/install
  78. sed -e "s,@L@,$L," -e "s,@R@,$R," $CWD/slack-desc > $PKG/install/slack-desc
  79. # Only add capability stuff if not disabled:
  80. if [ "${SETCAP:-yes}" = "yes" ]; then
  81. cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  82. # Only allow execution by audio group
  83. chown root:audio $PKG/usr/bin/$PRGNAM
  84. chmod 0750 $PKG/usr/bin/$PRGNAM
  85. fi
  86. cd $PKG
  87. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE