vocoder.SlackBuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/bin/bash
  2. # Slackware build script for vocoder
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20211130 bkw: BUILD=3, new-style icons.
  6. # 20170312 bkw:
  7. # - actually use SLKCFLAGS
  8. # - stop fluid from writing to /root/.fltk/
  9. # - use "-include unistd.h" compiler opt instead of a patch
  10. # - BUILD=2
  11. cd $(dirname $0) ; CWD=$(pwd)
  12. PRGNAM=vocoder
  13. VERSION=${VERSION:-0.29}
  14. BUILD=${BUILD:-3}
  15. TAG=${TAG:-_SBo}
  16. PKGTYPE=${PKGTYPE:-tgz}
  17. if [ -z "$ARCH" ]; then
  18. case "$( uname -m )" in
  19. i?86) ARCH=i586 ;;
  20. arm*) ARCH=arm ;;
  21. *) ARCH=$( uname -m ) ;;
  22. esac
  23. fi
  24. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  25. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  26. exit 0
  27. fi
  28. TMP=${TMP:-/tmp/SBo}
  29. PKG=$TMP/package-$PRGNAM
  30. OUTPUT=${OUTPUT:-/tmp}
  31. if [ "$ARCH" = "i586" ]; then
  32. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  33. LIBDIRSUFFIX=""
  34. elif [ "$ARCH" = "i686" ]; then
  35. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  36. LIBDIRSUFFIX=""
  37. elif [ "$ARCH" = "x86_64" ]; then
  38. SLKCFLAGS="-O2 -fPIC"
  39. LIBDIRSUFFIX="64"
  40. else
  41. SLKCFLAGS="-O2"
  42. LIBDIRSUFFIX=""
  43. fi
  44. set -e
  45. rm -rf $PKG
  46. mkdir -p $TMP $PKG $OUTPUT
  47. cd $TMP
  48. rm -rf $PRGNAM
  49. tar xvf $CWD/$PRGNAM-jack-$VERSION.tar.gz
  50. cd $PRGNAM
  51. chown -R root:root .
  52. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  53. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  54. sed -i "s,-O2,$SLKCFLAGS -include unistd.h," src/Makefile
  55. sed -i "/^CFLAGS/s,\$, $SLKCFLAGS -include unistd.h," util/Makefile
  56. # Override $HOME since fluid insists on writing useless stuff there.
  57. # In case the user's using ccache, this changes the cache dir, so we
  58. # put it back like it was (no harm done if user not using ccache).
  59. CCACHE_DIR=${CCACHE_DIR:-$HOME/.ccache} \
  60. HOME=$( pwd ) \
  61. make
  62. # manual install (no install target in Makefile)
  63. mkdir -p $PKG/usr/bin
  64. install -s -m0755 src/$PRGNAM $PKG/usr/bin/$PRGNAM
  65. # icon made for this slackbuild, by crudely stitching together a generic Tux
  66. # plus http://openclipart.org/detail/24414/old-style-microphone-by-boobaloo
  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 written for this slackbuild.
  76. mkdir -p $PKG/usr/share/applications
  77. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  78. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  79. cp -a AUTHORS COPYRIGHT README $PKG/usr/doc/$PRGNAM-$VERSION
  80. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  81. mkdir -p $PKG/install
  82. cat $CWD/slack-desc > $PKG/install/slack-desc
  83. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  84. # Only add capability stuff if not disabled:
  85. if [ "${SETCAP:-yes}" = "yes" ]; then
  86. cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  87. # Only allow execution by audio group
  88. chown root:audio $PKG/usr/bin/$PRGNAM
  89. chmod 0750 $PKG/usr/bin/$PRGNAM
  90. fi
  91. cd $PKG
  92. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE