File Songbird.spec of Package Songbird

#
# spec file for package Songbird
#
# Copyright (c) 2022 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/
#


%define wecore_ver 0.2.5
Name:           Songbird
Version:        2.3.0
Release:        0
Summary:        Modulated Vowel Filter
License:        GPL-3.0-only
Group:          Productivity/Multimedia/Sound/Midi
URL:            https://github.com/jd-13/Songbird-Formant-Filter
Source0:        Songbird-Formant-Filter-%{version}.tar.xz
Source1:        generate-lv2-ttl.py
Source2:        LV2.mak.in
Source3:        AppConfig.h.in
Source4:        WE-Core-%{wecore_ver}.tar.xz
Source6:        Montserrat-Regular.ttf
Patch0:         fix-standalone-run.patch
BuildRequires:  JUCE6-Projucer
BuildRequires:  JUCE6-devel
BuildRequires:  Mesa-libGL-devel
BuildRequires:  gcc-c++
BuildRequires:  libXcursor-devel
BuildRequires:  libXrandr-devel
BuildRequires:  libjack-devel
BuildRequires:  lv2-devel
BuildRequires:  pkgconfig
BuildRequires:  python3
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xinerama)

%description
Songbird is a modulated vowel/formant filter. Select two vowels and then modulate between them using either the manual slider or the LFO.

%package -n lv2-%{name}
Summary:        Modulated Vowel Filter (LV2)

%description -n lv2-%{name}
Songbird is a modulated vowel/formant filter. Select two vowels and then modulate between them using either the manual slider or the LFO.

%package -n vst3-%{name}
Summary:        Modulated Vowel Filter (VST3)

%description -n vst3-%{name}
Songbird is a modulated vowel/formant filter. Select two vowels and then modulate between them using either the manual slider or the LFO.

%package -n vst-%{name}
Summary:        Modulated Vowel Filter (VST)

%description -n vst-%{name}
Songbird is a modulated vowel/formant filter. Select two vowels and then modulate between them using either the manual slider or the LFO.

%prep
%setup -q -n Songbird-Formant-Filter-%{version}

#mkdir -p JuceLibraryCode
tar xf %{SOURCE4}
rm -rf ../WECore
mv WE-Core-%{wecore_ver} ../WECore
mkdir -p JuceLibraryCode
cp -f %{SOURCE3} JuceLibraryCode/
cp %{SOURCE2} .
cp %{SOURCE1} .
cp %{SOURCE6} Source/Graphics/

sed -i -e 's/pluginFormats="buildAU,buildVST3"/pluginFormats="buildStandalone,buildVST,buildVST3"/' %{name}.jucer
sed -i -e 's/buildVST="0"/buildVST="1"/' %{name}.jucer
sed -i -e 's/buildStandalone="0"/buildStandalone="1"/' %{name}.jucer
sed -i -e 's/LINUX_MAKE targetFolder="Builds\/LinuxMakefile"/LINUX_MAKE targetFolder="Builds\/LinuxMakefile" extraCompilerFlags="-fvisibility=hidden" extraLinkerFlags="-fdata-sections -ffunction-sections -Wl,--gc-sections -Wl,--strip-all"/' %{name}.jucer
sed -i -e 's/JUCEOPTIONS/JUCEOPTIONS JUCE_JACK="1" JUCE_WEB_BROWSER="0" JUCE_USE_CURL="0"/'  %{name}.jucer
sed -i -e 's/name="Release"/name="Release" headerPath="..\/..\/..\/WECore\/WECore\/;..\/..\/..\/WECore\/DSPFilters\/shared\/DSPFilters\/include"/'   %{name}.jucer
sed -i -e 's/useLocalCopy="0"/useLocalCopy="0" useGlobalPath="1"/' %{name}.jucer
sed -i -e '/<MODULE id="juce_video" showAllCode="1" useLocalCopy="0" useGlobalPath="1"\/>/a <MODULES id="juce_audio_utils" showAllCode="1" useLocalCopy="0" useGlobalPath="1"\/>'  %{name}.jucer


lv2uri="https://whiteelephantaudio.com/plugins/Songbird/"
sed "s/_lv2uri_pattern_/${lv2uri//\//\\/}/g" JuceLibraryCode/AppConfig.h.in >JuceLibraryCode/AppConfig.h
sed "s/_juce_target_/Songbird/g" LV2.mak.in >LV2.mak

%build

%define JUCE_VERSION `ls %{_libdir}/juce/include/`
Projucer --set-global-search-path linux defaultJuceModulePath %{_libdir}/juce/include/%{JUCE_VERSION}/modules

Projucer --resave %{name}.jucer
echo "include ../../LV2.mak" >> Builds/LinuxMakefile/Makefile

cd Builds/LinuxMakefile
CONFIG=Release make %{?_smp_mflags}

%install

mkdir -p %{buildroot}%{_bindir}
install Builds/LinuxMakefile/build/%{name} %{buildroot}%{_bindir}/
mkdir -p %{buildroot}%{_libdir}/vst
install Builds/LinuxMakefile/build/%{name}.so %{buildroot}%{_libdir}/vst/
mkdir -p %{buildroot}%{_libdir}/lv2
cp -r Builds/LinuxMakefile/build/*.lv2 %{buildroot}%{_libdir}/lv2/
mkdir -p %{buildroot}%{_libdir}/vst3
cp -r Builds/LinuxMakefile/build/*.vst3 %{buildroot}%{_libdir}/vst3/


%files
%{_bindir}/%{name}
%doc README.md
%license LICENSE

%files -n vst-%{name}
%dir %{_libdir}/vst
%{_libdir}/vst/%{name}.so
%doc README.md
%license LICENSE

%files -n lv2-%{name}
%dir %{_libdir}/lv2
%{_libdir}/lv2/*
%doc README.md
%license LICENSE

%files -n vst3-%{name}
%dir %{_libdir}/vst3
%{_libdir}/vst3/*
%doc README.md
%license LICENSE

%changelog
openSUSE Build Service is sponsored by