You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

174 lines
6.3 KiB

  1. #!/bin/bash
  2. # Slackware build script for audacity
  3. # Copyright 2006-2010 Chess Griffin <chess@chessgriffin.com>
  4. # Copyright 2011-2025 Matteo Bernardini <ponce@slackbuilds.org>
  5. # All rights reserved.
  6. #
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of this script must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  14. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  16. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. # Thanks to Eric Hameleers for adding the audacity.desktop file
  24. # and other tweaks and bug fixes. Thanks to Heinz Wiesinger for
  25. # bug fixes and the soundtouch and twolame improvements.
  26. # ...and thanks again to Eric Hameleers for the various hints needed
  27. # to build the conan-free releases
  28. # Modified by the SlackBuilds.org project
  29. cd $(dirname $0) ; CWD=$(pwd)
  30. PRGNAM=audacity
  31. VERSION=${VERSION:-3.7.4}
  32. MANVER=${MANVER:-3.7.4}
  33. BUILD=${BUILD:-1}
  34. TAG=${TAG:-_SBo}
  35. PKGTYPE=${PKGTYPE:-tgz}
  36. if [ -z "$ARCH" ]; then
  37. case "$( uname -m )" in
  38. i?86) ARCH=i586 ;;
  39. arm*) ARCH=arm ;;
  40. *) ARCH=$( uname -m ) ;;
  41. esac
  42. fi
  43. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  44. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  45. exit 0
  46. fi
  47. TMP=${TMP:-/tmp/SBo}
  48. PKG=$TMP/package-$PRGNAM
  49. OUTPUT=${OUTPUT:-/tmp}
  50. if [ "$ARCH" = "i586" ]; then
  51. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  52. LIBDIRSUFFIX=""
  53. elif [ "$ARCH" = "i686" ]; then
  54. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  55. LIBDIRSUFFIX=""
  56. elif [ "$ARCH" = "x86_64" ]; then
  57. SLKCFLAGS="-O2 -fPIC"
  58. LIBDIRSUFFIX="64"
  59. else
  60. SLKCFLAGS="-O2"
  61. LIBDIRSUFFIX=""
  62. fi
  63. if [ -x /usr/bin/listplugins ]; then do_ladspa="on"; else do_ladspa="off"; fi
  64. if pkg-config --exists soundtouch; then do_soundtouch="system"; else do_soundtouch="off"; fi
  65. if pkg-config --exists twolame; then do_twolame="system"; else do_twolame="off"; fi
  66. if pkg-config --exists vamp-hostsdk; then do_vamp="system"; else do_vamp="off"; fi
  67. if pkg-config --exists jack; then do_jack="system"; else do_jack="off"; fi
  68. if $(pkg-config --exists lilv-0) && $(pkg-config --exists suil-0); then do_lv2="system"; else do_lv2="off"; fi
  69. if pkg-config --exists vst3sdk; then do_vst3="system"; export VST3SDK_DIR=/usr/include/vst3sdk else do_vst3="off"; fi
  70. set -e
  71. rm -rf $PKG
  72. mkdir -p $TMP $PKG $OUTPUT
  73. cd $TMP
  74. rm -rf $PRGNAM-sources-$VERSION
  75. tar xvf $CWD/$PRGNAM-sources-$VERSION.tar.gz
  76. cd $PRGNAM-sources-$VERSION
  77. chown -R root:root .
  78. find -L . \
  79. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  80. -o -perm 511 \) -exec chmod 755 {} \; -o \
  81. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  82. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  83. # https://github.com/audacity/audacity/issues/6352
  84. if [[ $(uname -m) =~ i*86 ]]; then SLKCFLAGS+=" -msse2"; fi
  85. sed -i 's|^#include "allegro.h"|#include "portsmf/allegro.h"|' libraries/lib-note-track/WrapAllegro.h || exit 1
  86. mkdir -p build
  87. cd build
  88. cmake \
  89. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  90. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  91. -DAUDACITY_BUILD_LEVEL=2 \
  92. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS -std=gnu17" \
  93. -DCMAKE_C_FLAGS_RELEASE:STRING="$SLKCFLAGS -std=gnu17" \
  94. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS -DHAVE_VISIBILITY=1" \
  95. -DCMAKE_CXX_FLAGS_RELEASE:STRING="$SLKCFLAGS -DHAVE_VISIBILITY=1" \
  96. -DCMAKE_CXX_STANDARD=17 \
  97. -DCMAKE_INSTALL_DOCDIR=/usr/doc/$PRGNAM-$VERSION \
  98. -DCMAKE_INSTALL_LIBDIR=lib${LIBDIRSUFFIX} \
  99. -DCMAKE_INSTALL_MANDIR=/usr/man \
  100. -DCMAKE_INSTALL_PREFIX=/usr \
  101. -DCMAKE_VERBOSE_MAKEFILE:BOOL="on" \
  102. -Daudacity_use_twolame=$do_twolame \
  103. -Daudacity_use_ladspa=$do_ladspa \
  104. -Daudacity_use_soundtouch=$do_soundtouch \
  105. -Daudacity_use_vamp=$do_vamp \
  106. -Daudacity_use_jack=$do_jack \
  107. -Daudacity_use_lv2=$do_lv2 \
  108. -Daudacity_has_vst3=$do_vst3 \
  109. -Daudacity_use_portsmf="system" \
  110. -Daudacity_use_expat="system" \
  111. -Daudacity_use_flac="system" \
  112. -Daudacity_use_id3tag="system" \
  113. -Daudacity_use_lame="system" \
  114. -Daudacity_use_mad="system" \
  115. -Daudacity_use_ogg="system" \
  116. -Daudacity_use_vorbis="system" \
  117. -Daudacity_use_ffmpeg="loaded" \
  118. -Daudacity_conan_enabled="off" \
  119. -Daudacity_has_networking="off" \
  120. -Daudacity_has_crashreports="off" \
  121. -Daudacity_has_updates_check="off" \
  122. -Daudacity_has_sentry_reporting="off" \
  123. -Daudacity_obey_system_dependencies="on" \
  124. -Daudacity_lib_preference="system" \
  125. -Daudacity_use_wxwidgets="system" \
  126. -DwxWidgets_CONFIG_EXECUTABLE=/usr/bin/wx-config \
  127. -DwxWidgets_wxrc_EXECUTABLE=/usr/bin/wxrc \
  128. -DCMAKE_BUILD_TYPE=Release ..
  129. make
  130. make install DESTDIR=$PKG
  131. cd ..
  132. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  133. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  134. find $PKG/usr/man -type f -exec gzip -9 {} \;
  135. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  136. # We're going to overwrite the included audacity.desktop file with ours
  137. install -D -m 0644 $CWD/$PRGNAM.desktop \
  138. $PKG/usr/share/applications/$PRGNAM.desktop
  139. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  140. rm -fr $PKG/usr/share/doc
  141. cp LICENSE.* README.* $PKG/usr/doc/$PRGNAM-$VERSION
  142. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  143. if [ "${MANUAL:-no}" = "yes" ]; then
  144. ( cd $PKG/usr/doc/$PRGNAM-$VERSION
  145. tar xf $CWD/$PRGNAM-manual-$VERSION.tar.gz
  146. chown -R root:root help )
  147. fi
  148. mkdir -p $PKG/install
  149. cat $CWD/slack-desc > $PKG/install/slack-desc
  150. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  151. cd $PKG
  152. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE