File audacity-openvino.spec of Package audacity-openvino
#
# spec file for package audacity-openvino
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%bcond_with vst3
%define whisper_ver 1.5.4
%define audacity_ver 3.7.5
Name: audacity-openvino
Version: 3.7.1R4.2+git20.c0d5115
Release: 0
Summary: A set of AI-enabled effects, generators, and analyzers for Audacity
License: GPL-3.0-only
Group: Productivity/Multimedia/Sound/Utilities
URL: https://github.com/intel/openvino-plugins-ai-audacity
Source0: https://github.com/audacity/audacity/archive/Audacity-%{audacity_ver}.tar.gz
Source1: audacity-license-nyquist
Source5: %{name}-%{version}.tar.gz
Source7: whisper-cpp-%{whisper_ver}.tar.gz
%if %{with vst3}
#Source3: vst3sdk-3.7.12_build_20.tar.xz
%endif
# PATCH-FIX-OPENSUSE audacity-no_buildstamp.patch davejplater@gmail.com -- Remove the buildstamp.
Patch0: audacity-no_buildstamp.patch
# PATCH-FIX-UPSTREAM audacity-no_return_in_nonvoid.patch - Fix false positive errors Two new gcc10 ones ignoring assert
Patch1: audacity-no_return_in_nonvoid.patch
# PATCH-FIX-OPENSUSE vst-system-path.patch - search fo vsts in /usr/lib64 in x86_64 and ARM system
Patch3: lib64-plugins-default-path.patch
Patch4: audacity-openvino-use-system-libs.patch
BuildRequires: cmake >= 3.16
BuildRequires: desktop-file-utils
%if 0%{?suse_version} < 1600
BuildRequires: gcc12
BuildRequires: gcc12-c++
%else
BuildRequires: gcc
BuildRequires: gcc-c++
%endif
#!BuildIgnore: gstreamer-0_10-plugins-base
BuildRequires: hicolor-icon-theme
BuildRequires: libmp3lame-devel
BuildRequires: portmidi-devel
BuildRequires: wxWidgets-3_2-nostl-devel
BuildRequires: xz
BuildRequires: pkgconfig(RapidJSON)
BuildRequires: pkgconfig(alsa)
BuildRequires: pkgconfig(expat)
BuildRequires: pkgconfig(flac) >= 1.3.1
BuildRequires: pkgconfig(flac++)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(gtkmm-3.0)
BuildRequires: pkgconfig(id3tag)
BuildRequires: pkgconfig(id3tag)
BuildRequires: pkgconfig(jack)
BuildRequires: pkgconfig(libavcodec) >= 51.53
BuildRequires: pkgconfig(libavformat) >= 52.12
BuildRequires: pkgconfig(libavutil)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(libmpg123)
BuildRequires: pkgconfig(lilv-0) >= 0.24.6
BuildRequires: pkgconfig(lv2) >= 1.16.0
BuildRequires: pkgconfig(mad)
BuildRequires: pkgconfig(ogg)
BuildRequires: pkgconfig(opus)
BuildRequires: pkgconfig(opusfile)
BuildRequires: pkgconfig(portaudio-2.0)
BuildRequires: pkgconfig(serd-0) >= 0.30.2
BuildRequires: pkgconfig(shared-mime-info)
BuildRequires: pkgconfig(sndfile)
BuildRequires: pkgconfig(sord-0) >= 0.16.4
BuildRequires: pkgconfig(soundtouch)
BuildRequires: pkgconfig(soxr)
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(sratom-0) >= 0.6.4
BuildRequires: pkgconfig(suil-0) >= 0.10.6
BuildRequires: pkgconfig(twolame)
BuildRequires: pkgconfig(uuid)
BuildRequires: pkgconfig(vamp-hostsdk)
BuildRequires: pkgconfig(vorbis)
BuildRequires: pkgconfig(vorbisenc)
BuildRequires: pkgconfig(vorbisfile)
BuildRequires: pkgconfig(wavpack)
BuildRequires: pkgconfig(xcb-cursor)
BuildRequires: pkgconfig(xcb-keysyms)
BuildRequires: pkgconfig(xcb-util)
BuildRequires: pkgconfig(xkbcommon-x11)
#audacity-openvino requirements:
BuildRequires: opencl-cpp-headers
BuildRequires: openvino-devel
BuildRequires: libtorch
BuildRequires: python3-torch-devel
BuildRequires: patchelf
Requires: audacity => %{audacity_ver}
%define buildsourcedir %{_builddir}/audacity-Audacity-%{audacity_ver}
%description
This plugin needs to be enabled in Edit -> Preferences -> Modules.
Also it requires some models which can be downloaded by links from this readme:
https://github.com/intel/openvino-plugins-ai-audacity/blob/main/doc/build_doc/linux/README.md#openvino-models-installation
A set of AI-enabled effects, generators, and analyzers for Audacity.
These AI features run 100% locally on your PC no internet connection necessary!
OpenVINO is used to run AI models on supported accelerators found on the user's system such as CPU, GPU, and NPU.
%prep
%setup -q -n audacity-Audacity-%{audacity_ver}
%patch -P 0 -p1
%patch -P 1 -p1
%ifarch x86_64 aarch64
%patch -P 3 -p1
%endif
cp -f %{SOURCE1} LICENSE_NYQUIST.txt
# Make sure we use the system versions.
rm -rf lib-src/{expat,libvamp,libsoxr,ffmpeg,lame}/
#Included in src/AboutDialog.cpp but not supplied
touch include/RevisionIdent.h
%if %{with vst3}
tar xf %{SOURCE3} --strip-components=1 --one-top-level=vst3sdk
%endif
tar xf %{SOURCE5} -C modules --strip-components=1
tar xf %{SOURCE7}
%patch -P 4 -p0 -d modules
sed -i -e '/sharing/a \ \ \ mod-openvino' modules/CMakeLists.txt
%build
%if 0%{?suse_version} < 1600
export CC=gcc-12
export CXX=g++-12
%endif
if ! test -e %{_libdir}/pkgconfig/lame.pc
then
export PKG_CONFIG_PATH="`echo $PWD`:%{_libdir}/pkgconfig"
fi
export CFLAGS="%{optflags} -fno-strict-aliasing -ggdb $(wx-config --cflags)"
#Prepare OpenVINO stuff
cd %{buildsourcedir}/whisper-cpp-%{whisper_ver}
%cmake -DBUILD_SHARED_LIBS=OFF -DWHISPER_OPENVINO=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=""
%cmake_build
cd %{buildsourcedir}/whisper-cpp-%{whisper_ver}/build
make install DESTDIR=%{buildsourcedir}/whisper_build
cd %{buildsourcedir}
export WHISPERCPP_ROOTDIR=%{buildsourcedir}/whisper_build
%cmake \
-DAUDACITY_REV_TIME=$(date -u -d "@${SOURCE_DATE_EPOCH}" "+%Y-%m-%dT%H:%M:%SZ") \
-DAUDACITY_REV_LONG=%{version} \
-DAUDACITY_BUILD_LEVEL=2 \
-DCMAKE_MODULE_LINKER_FLAGS:STRING="$(wx-config --libs)" \
-DCMAKE_SHARED_LINKER_FLAGS:STRING="$(wx-config --libs)" \
-Daudacity_conan_enabled=Off \
-Daudacity_has_networking:BOOL=Off \
-Daudacity_lib_preference:STRING=system \
-Duse_lame:STRING=system \
-Daudacity_use_ffmpeg:STRING=loaded \
-DCMAKE_PREFIX_PATH=%{python_sitearch}/torch/share/cmake/Torch \
%if %{without vst3}
-Daudacity_has_vst3=off \
%endif
-DVST3_DEFAULT_INSTALL_PATH=%{_libdir}/vst3/
%cmake_build
%install
mkdir -p %{buildroot}%{_libdir}/audacity/modules
install build/RelWithDebInfo/lib64/audacity/modules/mod-openvino.so %{buildroot}%{_libdir}/audacity/modules
patchelf --shrink-rpath --allowed-rpath-prefixes /usr/lib64 %{buildroot}%{_libdir}/audacity/modules/mod-openvino.so
%files
%defattr(-,root,root)
%doc README.md
%license LICENSE.txt
%dir %{_libdir}/audacity
%dir %{_libdir}/audacity/modules
%{_libdir}/audacity/modules/mod-openvino.so
%changelog