sfc.SlackBuild 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #!/bin/bash
  2. # Slackware build script for soundfontcombi
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20211204 bkw: BUILD=3.
  6. # - install setgid audio (for access to /dev/snd/seq).
  7. # - add icons and .desktop.
  8. # - fix hardcoded (wrong) version number in binary.
  9. cd $(dirname $0) ; CWD=$(pwd)
  10. PRGNAM=sfc
  11. VERSION=${VERSION:-0.018}
  12. BUILD=${BUILD:-3}
  13. TAG=${TAG:-_SBo}
  14. PKGTYPE=${PKGTYPE:-tgz}
  15. if [ -z "$ARCH" ]; then
  16. case "$( uname -m )" in
  17. i?86) ARCH=i586 ;;
  18. arm*) ARCH=arm ;;
  19. *) ARCH=$( uname -m ) ;;
  20. esac
  21. fi
  22. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  23. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  24. exit 0
  25. fi
  26. TMP=${TMP:-/tmp/SBo}
  27. PKG=$TMP/package-$PRGNAM
  28. OUTPUT=${OUTPUT:-/tmp}
  29. if [ "$ARCH" = "i586" ]; then
  30. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  31. LIBDIRSUFFIX=""
  32. elif [ "$ARCH" = "i686" ]; then
  33. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  34. LIBDIRSUFFIX=""
  35. elif [ "$ARCH" = "x86_64" ]; then
  36. SLKCFLAGS="-O2 -fPIC"
  37. LIBDIRSUFFIX="64"
  38. else
  39. SLKCFLAGS="-O2"
  40. LIBDIRSUFFIX=""
  41. fi
  42. set -e
  43. rm -rf $PKG
  44. mkdir -p $TMP $PKG $OUTPUT
  45. cd $TMP
  46. rm -rf $PRGNAM-$VERSION
  47. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  48. cd $PRGNAM-$VERSION
  49. chown -R root:root .
  50. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  51. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  52. sed -i "s,v0\.017,v$VERSION,g" src/{SFSUI.cxx,main.C}
  53. CFLAGS="$SLKCFLAGS" \
  54. CXXFLAGS="$SLKCFLAGS" \
  55. ./configure \
  56. --prefix=/usr \
  57. --libdir=/usr/lib${LIBDIRSUFFIX} \
  58. --sysconfdir=/etc \
  59. --localstatedir=/var \
  60. --mandir=/usr/man \
  61. --docdir=/usr/doc/$PRGNAM-$VERSION \
  62. --build=$ARCH-slackware-linux
  63. make
  64. make install-strip DESTDIR=$PKG
  65. # needs to be setgid audio
  66. chown root:audio $PKG/usr/bin/$PRGNAM
  67. chmod 2750 $PKG/usr/bin/$PRGNAM
  68. for px in 16 32 48 64; do
  69. size=${px}x${px}
  70. dir=$PKG/usr/share/icons/hicolor/$size/apps
  71. mkdir -p $dir
  72. convert -resize $size $CWD/$PRGNAM.png $dir/$PRGNAM.png
  73. done
  74. mkdir -p $PKG/usr/share/pixmaps/
  75. ln -s ../icons/hicolor/48x48/apps/$PRGNAM.png $PKG/usr/share/pixmaps/$PRGNAM.png
  76. mkdir -p $PKG/usr/share/applications
  77. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  78. # TODO: maybe a man page?
  79. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  80. cp -a AUTHORS COPYING ChangeLog README TODO $PKG/usr/doc/$PRGNAM-$VERSION
  81. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  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