qm-vamp-plugins.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. #!/bin/bash
  2. # Slackware build script for qm-vamp-plugins
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20201103 bkw: update for v1.8.0. qm-dsp source is included now, get
  6. # rid of separate download and build for it. Also, there's no longer
  7. # a prebuilt atlas, and the build uses a bundled blas and lapack
  8. # now. It also uses a bundled vamp-plugin-sdk, so I removed that from
  9. # REQUIRES.
  10. # 20200123 bkw: found out upstream includes a prebuilt libatlas.a, which
  11. # the build has been using all along. Remove atlas from REQUIRES since
  12. # it was never used anyway. Tried to build this with atlas, lapack,
  13. # blas from SBo instead of the prebuilt stuff, but it fails, and for
  14. # now I've run out of patience for it. So added a note to README about
  15. # the prebuilt libs.
  16. # 20191202 bkw: update for v1.7.1
  17. # 20150403 bkw:
  18. # Bump BUILD to 3, make it build against vamp-plugin-sdk 2.5 (whoops)
  19. cd $(dirname $0) ; CWD=$(pwd)
  20. PRGNAM=qm-vamp-plugins
  21. VERSION=${VERSION:-1.8.0}
  22. BUILD=${BUILD:-1}
  23. TAG=${TAG:-_SBo}
  24. PKGTYPE=${PKGTYPE:-tgz}
  25. if [ -z "$ARCH" ]; then
  26. case "$( uname -m )" in
  27. i?86) ARCH=i586 ;;
  28. arm*) ARCH=arm ;;
  29. *) ARCH=$( uname -m ) ;;
  30. esac
  31. fi
  32. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  33. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  34. exit 0
  35. fi
  36. TMP=${TMP:-/tmp/SBo}
  37. PKG=$TMP/package-$PRGNAM
  38. OUTPUT=${OUTPUT:-/tmp}
  39. # No CFLAGS support (releases are tested with their own opts)
  40. if [ "$ARCH" = "i586" ]; then
  41. LIBDIRSUFFIX=""
  42. elif [ "$ARCH" = "i686" ]; then
  43. LIBDIRSUFFIX=""
  44. elif [ "$ARCH" = "x86_64" ]; then
  45. LIBDIRSUFFIX="64"
  46. else
  47. LIBDIRSUFFIX=""
  48. fi
  49. set -e
  50. # Remove SSE/SSE2 flags as needed from the CFLAGS
  51. fix_sse_flags() {
  52. local makefile="$1"
  53. if [ "$USE_SSE2" != "yes" ]; then
  54. sed -i \
  55. -e 's/-msse2//g' \
  56. $makefile
  57. fi
  58. if [ "$USE_SSE" != "yes" ]; then
  59. sed -i \
  60. -e 's/-msse//g' \
  61. -e 's/-mfpmath=sse//g' \
  62. $makefile
  63. fi
  64. }
  65. rm -rf $PKG
  66. mkdir -p $TMP $PKG $OUTPUT
  67. cd $TMP
  68. rm -rf $PRGNAM-$VERSION
  69. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  70. cd $PRGNAM-$VERSION
  71. chown -R root:root .
  72. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  73. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  74. # SSE/SSE2 support:
  75. case "$SSE" in
  76. "yes") USE_SSE=yes ;;
  77. "no") USE_SSE=no ;;
  78. *) if grep -q '\<sse\>' /proc/cpuinfo; then
  79. USE_SSE=yes
  80. else
  81. USE_SSE=no
  82. fi
  83. ;;
  84. esac
  85. if [ "$USE_SSE" = "yes" ]; then
  86. case "$SSE2" in
  87. "yes") USE_SSE2=yes ;;
  88. "no") USE_SSE2=no ;;
  89. *) if grep -q '\<sse2\>' /proc/cpuinfo; then
  90. USE_SSE2=yes
  91. else
  92. USE_SSE2=no
  93. fi
  94. ;;
  95. esac
  96. else
  97. USE_SSE2=no
  98. fi
  99. echo "USE_SSE=$USE_SSE and USE_SSE2=$USE_SSE2"
  100. # Makefile.linux64 works fine on 32-bit.
  101. MAKEFILE=build/linux/Makefile.linux64
  102. # 20150403 bkw: crap. getting rid of vamp-plugin-sdk static libs
  103. # breaks this. Fix by getting rid of -Wl,-Bstatic and -Wl,-Bdynamic
  104. # options (so it doesn't insist on a static libvamp-sdk).
  105. sed -i 's/-Wl,-B[^ ]* //g' $MAKEFILE
  106. # Apply correct SSE-related flags. also we need c++11 starting with 1.8.0.
  107. fix_sse_flags $MAKEFILE
  108. sed -i '/^CXXFLAGS/s,=,= -std=c++11,' $MAKEFILE
  109. # It's either 2 separate makes, or use -j1.
  110. make -f $MAKEFILE lib/qm-dsp
  111. make -f $MAKEFILE
  112. # no 'make install' target, just cp it.
  113. mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/vamp
  114. strip $PRGNAM.so
  115. cp $PRGNAM.so $PRGNAM.cat $PRGNAM.n3 $PKG/usr/lib$LIBDIRSUFFIX/vamp
  116. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  117. cp -a README* COPYING $PKG/usr/doc/$PRGNAM-$VERSION
  118. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  119. mkdir -p $PKG/install
  120. cat $CWD/slack-desc > $PKG/install/slack-desc
  121. cd $PKG
  122. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE