ecasound.SlackBuild 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #!/bin/bash
  2. # Slackware build script for ecasound
  3. # Written by B. Watson (yalhcru@gmail.com)
  4. # Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
  5. # 20211128 bkw: BUILD=2, add python3 support.
  6. # 20200117 bkw: Updated for v2.9.3.
  7. # 20191202 bkw:
  8. # - Updated for v2.9.2.
  9. # - removed python_module_dir.diff and ruby2.patch from 2.9.1,
  10. # they're no longer needed. This means you can no longer build
  11. # 2.9.1 with this script.
  12. cd $(dirname $0) ; CWD=$(pwd)
  13. PRGNAM=ecasound
  14. VERSION=${VERSION:-2.9.3}
  15. BUILD=${BUILD:-2}
  16. TAG=${TAG:-_SBo}
  17. PKGTYPE=${PKGTYPE:-tgz}
  18. if [ -z "$ARCH" ]; then
  19. case "$( uname -m )" in
  20. i?86) ARCH=i586 ;;
  21. arm*) ARCH=arm ;;
  22. *) ARCH=$( uname -m ) ;;
  23. esac
  24. fi
  25. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  26. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  27. exit 0
  28. fi
  29. TMP=${TMP:-/tmp/SBo}
  30. PKG=$TMP/package-$PRGNAM
  31. OUTPUT=${OUTPUT:-/tmp}
  32. if [ "$ARCH" = "i586" ]; then
  33. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  34. LIBDIRSUFFIX=""
  35. elif [ "$ARCH" = "i686" ]; then
  36. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  37. LIBDIRSUFFIX=""
  38. elif [ "$ARCH" = "x86_64" ]; then
  39. SLKCFLAGS="-O2 -fPIC"
  40. LIBDIRSUFFIX="64"
  41. else
  42. SLKCFLAGS="-O2"
  43. LIBDIRSUFFIX=""
  44. fi
  45. set -e
  46. rm -rf $PKG
  47. mkdir -p $TMP $PKG $OUTPUT
  48. cd $TMP
  49. rm -rf $PRGNAM-$VERSION
  50. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  51. cd $PRGNAM-$VERSION
  52. chown -R root:root .
  53. find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
  54. \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
  55. # --disable-static and --enable-shared are accepted, but ignored.
  56. # This is deliberate: upstream doesn't want shared libs. See:
  57. # http://www.eca.cx/ecasound-list/2002/10/0031.html
  58. setpyver() {
  59. PYVER=$( python -c 'import sys; print("%d.%d" % sys.version_info[0:2])' )
  60. echo "=== PYVER='$PYVER'"
  61. }
  62. conf() {
  63. CFLAGS="$SLKCFLAGS" \
  64. CXXFLAGS="$SLKCFLAGS" \
  65. ./configure \
  66. --disable-arts \
  67. --prefix=/usr \
  68. --libdir=/usr/lib${LIBDIRSUFFIX} \
  69. --sysconfdir=/etc \
  70. --localstatedir=/var \
  71. --mandir=/usr/man \
  72. --docdir=/usr/doc/$PRGNAM-$VERSION \
  73. --with-python-modules=/usr/lib$LIBDIRSUFFIX/python$PYVER \
  74. --enable-python-force-site-packages \
  75. --disable-all-static \
  76. --build=$ARCH-slackware-linux
  77. }
  78. # first time around, build everything, with python2 support.
  79. setpyver
  80. conf
  81. make
  82. make install-strip DESTDIR=$PKG
  83. # 2nd build, python3 support only. configure has "python" hardcoded as
  84. # the executable (can't pass python3), so fake it out with $PATH.
  85. mkdir pytmp
  86. ln -s /usr/bin/python3 pytmp/python
  87. export PATH=$(pwd)/pytmp:$PATH
  88. setpyver
  89. make clean
  90. conf
  91. make -C pyecasound install DESTDIR=$PKG
  92. # Per -current guidelines (and does no harm on 14.2):
  93. rm -f $PKG/usr/lib$LIBDIRSUFFIX/*.la
  94. # Kind of a twist for a SlackBuild: bunch of identical man pages are getting
  95. # installed, and we want them to be symlinks instead of copies.
  96. cd $PKG/usr/man/man1
  97. toolsum="$( cat ecatools.1 | md5sum )"
  98. for manpage in $( /bin/ls * | grep -v ecatools ); do
  99. if [ "$toolsum" = "$( cat $manpage | md5sum )" ]; then
  100. rm -f $manpage
  101. ln -s ecatools.1 $manpage
  102. fi
  103. done
  104. cd -
  105. find $PKG/usr/man -type f -exec gzip -9 {} \;
  106. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  107. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  108. cp -a AUTHORS BUGS COPYING* INSTALL README RELNOTES TODO \
  109. $PKG/usr/doc/$PRGNAM-$VERSION
  110. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  111. mkdir -p $PKG/install
  112. cat $CWD/slack-desc > $PKG/install/slack-desc
  113. # Only add capability stuff if not disabled:
  114. if [ "${SETCAP:-yes}" = "yes" ]; then
  115. cat $CWD/setcap.sh >> $PKG/install/doinst.sh
  116. # Only allow execution by audio group
  117. chown root:audio $PKG/usr/bin/$PRGNAM
  118. chmod 0750 $PKG/usr/bin/$PRGNAM
  119. fi
  120. cd $PKG
  121. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE