calf.SlackBuild 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. #!/bin/bash
  2. # Slackware build script for calf
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # 20211204 bkw: BUILD=3, move html docs to subdir.
  5. # 20200117 bkw: demote lash from required to optional dependency.
  6. # 20191208 bkw: update for v0.90.3.
  7. # 20180709 bkw:
  8. # - Update to latest release (less than a day old).
  9. # - Use correct upstream homepage.
  10. # 20170622 bkw:
  11. # - Update to latest git. It's been a long time since the last release.
  12. # - Actually make the SSE=yes option work (d'oh!)
  13. # 20170301 bkw: use long-format github URL, no more $VERSION.tar.gz
  14. # 20151106 bkw:
  15. # Switch to -master and upgrade to v0.0.60. No more LADSPA or DSSI
  16. # support (upstream dropped it). But if you need LADSPA, there's a
  17. # separate calf-ladspa build now. If there's a popular demand for
  18. # DSSI, I'll add it to calf-ladspa, not here.
  19. # fluidsynth is now required, because the build fails without it, even
  20. # though it's listed as experimental and there's a --disable-experimental
  21. # option. Since it's required anyway, might as well --enable-experimental.
  22. # 20141030 bkw:
  23. # Finally getting around to submitting this, there have been no code
  24. # changes upstream since 20140308.
  25. # 20140308 bkw:
  26. # - Switched to falkTX's KXStudio fork of CALF. falkTX doesn't do release
  27. # tarballs, so this is a git checkout from 20140308.
  28. # - Added capability stuff.
  29. cd $(dirname $0) ; CWD=$(pwd)
  30. PRGNAM=calf
  31. VERSION=${VERSION:-0.90.3}
  32. BUILD=${BUILD:-3}
  33. TAG=${TAG:-_SBo}
  34. PKGTYPE=${PKGTYPE:-tgz}
  35. if [ -z "$ARCH" ]; then
  36. case "$( uname -m )" in
  37. i?86) ARCH=i586 ;;
  38. arm*) ARCH=arm ;;
  39. *) ARCH=$( uname -m ) ;;
  40. esac
  41. fi
  42. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  43. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  44. exit 0
  45. fi
  46. TMP=${TMP:-/tmp/SBo}
  47. PKG=$TMP/package-$PRGNAM
  48. OUTPUT=${OUTPUT:-/tmp}
  49. if [ "$ARCH" = "i586" ]; then
  50. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  51. LIBDIRSUFFIX=""
  52. elif [ "$ARCH" = "i686" ]; then
  53. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  54. LIBDIRSUFFIX=""
  55. elif [ "$ARCH" = "x86_64" ]; then
  56. SLKCFLAGS="-O2 -fPIC"
  57. LIBDIRSUFFIX="64"
  58. else
  59. SLKCFLAGS="-O2"
  60. LIBDIRSUFFIX=""
  61. fi
  62. set -e
  63. rm -rf $PKG
  64. mkdir -p $TMP $PKG $OUTPUT
  65. cd $TMP
  66. rm -rf $PRGNAM-$VERSION
  67. tar xvf $CWD/$PRGNAM-$VERSION.tar.?z
  68. cd $PRGNAM-$VERSION
  69. chown -R root:root .
  70. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  71. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  72. autoreconf -if
  73. # Note: The build ignores the provided -O2 in the flags (but the
  74. # -march/-mtune -fPIC stuff is used). If you really want to force
  75. # it to use -O2 (Slackware default), set FORCE_SLACK_CFLAGS=yes
  76. # in the environment.
  77. if [ "${FORCE_SLACK_CFLAGS:-no}" = "yes" ]; then
  78. sed -i -e 's/ -O3[^"]*//' configure
  79. SSE=no
  80. fi
  81. # Build with SSE support?
  82. case "${SSE:-auto}" in
  83. "yes") SSEOPT="--enable-sse" ;;
  84. "no") SSEOPT="--disable-sse" ;;
  85. *) grep sse /proc/cpuinfo >/dev/null \
  86. && SSEOPT="--enable-sse" \
  87. || SSEOPT="--disable-sse" ;;
  88. esac
  89. echo "=== SSEOPT: $SSEOPT"
  90. # For the slack-desc:
  91. WITHSSE="without"
  92. [ "$SSEOPT" = "--enable-sse" ] && WITHSSE="with"
  93. # 20211204 bkw: --docdir and --htmldir accepted and ignored.
  94. # htmldir on the make command line is also ignored (html docs go to docdir).
  95. CFLAGS="$SLKCFLAGS" \
  96. CXXFLAGS="$SLKCFLAGS" \
  97. ./configure \
  98. $SSEOPT \
  99. --enable-experimental \
  100. --prefix=/usr \
  101. --libdir=/usr/lib${LIBDIRSUFFIX} \
  102. --sysconfdir=/etc \
  103. --localstatedir=/var \
  104. --mandir=/usr/man \
  105. --enable-shared \
  106. --disable-static \
  107. --with-lv2-dir=/usr/lib${LIBDIRSUFFIX}/lv2 \
  108. --build=$ARCH-slackware-linux
  109. make
  110. make install \
  111. DESTDIR=$PKG \
  112. docdir=/usr/doc/$PRGNAM-$VERSION/html \
  113. # install-strip is supported, but doesn't work:
  114. strip $PKG/usr/bin/* $PKG/usr/lib*/{lv2/calf.lv2/calflv2gui.so,calf/calf.so}
  115. gzip $PKG/usr/man/man?/*
  116. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  117. cp -a AUTHORS COPYING* ChangeLog README TODO $PKG/usr/doc/$PRGNAM-$VERSION
  118. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  119. # This shouldn't be in the package:
  120. rm -f $PKG/usr/share/icons/hicolor/icon-theme.cache
  121. # Shipped .desktop file doesn't validate, use modified copy:
  122. cat $CWD/$PRGNAM.desktop > $PKG/usr/share/applications/$PRGNAM.desktop
  123. mkdir -p $PKG/install
  124. sed "s,@WITHSSE@,$WITHSSE," $CWD/slack-desc > $PKG/install/slack-desc
  125. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  126. # Only add capability stuff if not disabled:
  127. if [ "${SETCAP:-yes}" = "yes" ]; then
  128. cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  129. # Only allow execution by audio group
  130. chown root:audio $PKG/usr/bin/$PRGNAM*
  131. chmod 0750 $PKG/usr/bin/$PRGNAM*
  132. fi
  133. cd $PKG
  134. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE