#!/bin/bash # Slackware build script for openvino-plugins-ai-audacity # Copyright 2024 Johannes Schoepfer, Germany # All rights reserved. # # Redistribution and use of this script, with or without modification, is # permitted provided that the following conditions are met: # # 1. Redistributions of this script must retain the above copyright # notice, this list of conditions and the following disclaimer. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. cd $(dirname $0) ; CWD=$(pwd) PRGNAM=openvino-plugins-ai-audacity VERSION=${VERSION:-3.6.4.R.3.4} VERSION_SRC="3.6.4-R3.4" VERSION_AUDACITY=3.6.4 BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" exit 0 fi TMP=${TMP:-/tmp/SBo} PKG=$TMP/package-$PRGNAM OUTPUT=${OUTPUT:-/tmp} if [ "$ARCH" = "i586" ]; then SLKCFLAGS="-O2 -march=i586 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "i686" ]; then SLKCFLAGS="-O2 -march=i686 -mtune=i686" LIBDIRSUFFIX="" elif [ "$ARCH" = "aarch64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" elif [ "$ARCH" = "x86_64" ]; then SLKCFLAGS="-O2 -fPIC" LIBDIRSUFFIX="64" elif [ "$ARCH" = "arm" ]; then SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard" LIBDIRSUFFIX="" else SLKCFLAGS="-O2" LIBDIRSUFFIX="" fi set -e rm -rf $PKG mkdir -p $TMP $PKG $OUTPUT cd $TMP rm -rf $PRGNAM-$VERSION_SRC tar xvf $CWD/$PRGNAM-$VERSION_SRC.tar.gz cd $PRGNAM-$VERSION_SRC chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ -o -perm 511 \) -exec chmod 755 {} + -o \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} + tar vxf $CWD/audacity-sources-$VERSION_AUDACITY.tar.gz cat << EOF >> audacity-sources-$VERSION_AUDACITY/modules/CMakeLists.txt add_subdirectory(mod-openvino) EOF mv mod-openvino audacity-sources-$VERSION_AUDACITY/modules/ source /usr/share/openvino/setupvars.sh cd audacity-sources-$VERSION_AUDACITY sed -i 's|^#include "allegro.h"|#include "portsmf/allegro.h"|' libraries/lib-note-track/WrapAllegro.h mkdir build cd build unshare -n cmake \ -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS $RPATH $LDPATH" \ -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS $RPATH $LDPATH" \ -DAUDACITY_BUILD_LEVEL=2 \ -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_C_FLAGS_RELEASE:STRING="$SLKCFLAGS" \ -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS -DHAVE_VISIBILITY=1" \ -DCMAKE_CXX_FLAGS_RELEASE:STRING="$SLKCFLAGS -DHAVE_VISIBILITY=1" \ -DCMAKE_CXX_STANDARD=11 \ -DCMAKE_INSTALL_DOCDIR=/usr/doc/$PRGNAM-$VERSION \ -DCMAKE_INSTALL_LIBDIR=/usr/lib${LIBDIRSUFFIX} \ -DCMAKE_INSTALL_MANDIR=/usr/man \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_VERBOSE_MAKEFILE:BOOL="on" \ -Daudacity_use_twolame="off" \ -Daudacity_use_ladspa="off" \ -Daudacity_use_soundtouch="off" \ -Daudacity_use_vamp="off" \ -Daudacity_has_vst3="off" \ -Daudacity_use_expat="system" \ -Daudacity_use_lame="off" \ -Daudacity_use_ffmpeg="off" \ -Daudacity_conan_enabled="off" \ -Daudacity_has_networking="off" \ -Daudacity_has_crashreports="off" \ -Daudacity_has_updates_check="off" \ -Daudacity_has_sentry_reporting="off" \ -Daudacity_obey_system_dependencies="on" \ -Daudacity_lib_preference="system" \ -Daudacity_use_wxwidgets="system" \ -DwxWidgets_CONFIG_EXECUTABLE=/usr/bin/wx-config \ -DwxWidgets_wxrc_EXECUTABLE=/usr/bin/wxrc \ -DCMAKE_BUILD_TYPE=Release .. make mod-openvino make install/strip DESTDIR=$PKG/tmpxxx mkdir -p $PKG/usr/lib$LIBDIRSUFFIX/audacity/modules mv $PKG/tmpxxx/usr/lib$LIBDIRSUFFIX/audacity/modules/mod-openvino.so $PKG/usr/lib$LIBDIRSUFFIX/audacity/modules/mod-openvino.so patchelf --add-rpath "$INTEL_OPENVINO_DIR/runtime/lib/intel64/" $PKG/usr/lib$LIBDIRSUFFIX/audacity/modules/mod-openvino.so rm -rf $PKG/tmpxxx cd .. cd .. # Provide openvino models mkdir -p $PKG/usr/lib/openvino-models unzip $CWD/deepfilternet2.zip -d $PKG/usr/lib/openvino-models unzip $CWD/deepfilternet3.zip -d $PKG/usr/lib/openvino-models cp $CWD/htdemucs_v4.bin $PKG/usr/lib/openvino-models cp $CWD/htdemucs_v4.xml $PKG/usr/lib/openvino-models mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION cp -a LICENSE.txt README.md doc/feature_doc $PKG/usr/doc/$PRGNAM-$VERSION cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild mkdir -p $PKG/install cat $CWD/slack-desc > $PKG/install/slack-desc cd $PKG /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE