muse.SlackBuild 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #!/bin/bash
  2. # Slackware build script for muse
  3. # Written by Felix Pfeifer pfeifer[dot]felix[at]googlemail[dot]com
  4. # 20200416 bkw: Modified by the SlackBuilds.org project
  5. # - updated for v3.1
  6. # - don't install docs in /usr/share/doc
  7. # - add realtime capability support
  8. cd $(dirname $0) ; CWD=$(pwd)
  9. PRGNAM=muse
  10. VERSION=${VERSION:-3.1.1}
  11. BUILD=${BUILD:-1}
  12. TAG=${TAG:-_SBo}
  13. PKGTYPE=${PKGTYPE:-tgz}
  14. if [ -z "$ARCH" ]; then
  15. case "$( uname -m )" in
  16. i?86) ARCH=i586 ;;
  17. arm*) ARCH=arm ;;
  18. *) ARCH=$( uname -m ) ;;
  19. esac
  20. fi
  21. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  22. # the name of the created package would be, and then exit. This information
  23. # could be useful to other scripts.
  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-$VERSION
  49. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  50. cd $PRGNAM-$VERSION
  51. chown -R root:root .
  52. find -L . \
  53. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  54. -exec chmod 755 {} \; -o \
  55. \( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
  56. -exec chmod 644 {} \;
  57. # Change the INSTALL_NAME or every path in the package is versioned
  58. sed -e "s/muse-3.1/muse/" -i CMakeLists.txt
  59. mkdir -p build
  60. cd build
  61. cmake \
  62. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  63. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  64. -DCMAKE_INSTALL_PREFIX=/usr \
  65. -DLIB_SUFFIX=${LIBDIRSUFFIX} \
  66. -DENABLE_PYTHON:STRING="OFF" \
  67. -DCMAKE_BUILD_TYPE=Release ..
  68. make
  69. make install DESTDIR=$PKG
  70. cd ..
  71. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  72. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  73. mv $PKG/usr/share/man $PKG/usr/man
  74. find $PKG/usr/man -type f -exec gzip -9 {} \;
  75. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  76. mkdir -p $PKG/usr/doc
  77. mv $PKG/usr/share/doc/$PRGNAM $PKG/usr/doc/$PRGNAM-$VERSION
  78. rmdir $PKG/usr/share/doc
  79. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  80. mkdir -p $PKG/install
  81. cat $CWD/slack-desc > $PKG/install/slack-desc
  82. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  83. # Only add capability stuff if not disabled:
  84. if [ "${SETCAP:-yes}" = "yes" ]; then
  85. cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  86. # Only allow execution by audio group
  87. chown root:audio $PKG/usr/bin/muse3
  88. chmod 0750 $PKG/usr/bin/muse3
  89. fi
  90. cd $PKG
  91. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE