File HISE.spec of Package HISE

#
# spec file for package HISE
#
# 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/
#


Name:           HISE
Version:        4.1.0+git1.32a3397
Release:        0
Summary:        The open source framework for sample based instruments
License:        GPL-3.0-only
Group:          Productivity/Multimedia/Sound/Midi
URL:            https://github.com/christophhart/HISE
Source0:        https://github.com/christophhart/HISE/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        %{name}.desktop
Source2:        juce_VSTInterface.h
Source3:        perfetto.tar.gz
Patch1:         HISE-JUCE-old-VST.patch
Patch2:         HISE-set-default-path.patch
Patch3:         HISE-ignore-CI-mode-data-path.patch
Patch4:         HISE-jucer.patch
BuildRequires:  JUCE7_05-Projucer
BuildRequires:  gcc-c++
BuildRequires:  faust-devel
BuildRequires:  pkgconfig(webkit2gtk-4.1)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(alsa)
BuildRequires:  icoutils
BuildRequires:  fdupes
%if %{defined fedora}
BuildRequires:  jack-audio-connection-kit-devel
%else
BuildRequires:  pkgconfig(jack)
%endif
Requires:  HISE-JUCE7-Projucer

%description
HISE is a cross-platform open source audio application for building virtual instruments. It emphasizes on sampling,
but includes some basic synthesis features for making hybrid instruments as well as audio effects. You can export the
instruments as VST / AU / AAX plugins or as standalone application for Linux / Windows / macOS or iOS.

%package -n vst3-%{name}
Summary:       The open source framework for sample based instruments (VST3)

%description -n vst3-%{name}

HISE is a cross-platform open source audio application for building virtual instruments. It emphasizes on sampling,
but includes some basic synthesis features for making hybrid instruments as well as audio effects. You can export the
instruments as VST / AU / AAX plugins or as standalone application for Linux / Windows / macOS or iOS.

%prep
%setup -q
%autopatch -p1
cp %{SOURCE2} JUCE/modules/juce_audio_processors/format_types/
mkdir -p tools/SDK
tar xf %{SOURCE3} -C tools/SDK/
%build

cd projects/standalone
sed -i 's/linkTimeOptimisation="1"/linkTimeOptimisation="0"/' "HISE Standalone.jucer"
Projucer --resave "HISE Standalone.jucer"

%if 0%{?sle_version} != 150300
sed -i 's/webkit2gtk-4.0/webkit2gtk-4.1/' Builds/LinuxMakefile/Makefile
%endif

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

cd ../plugin
sed -i 's/linkTimeOptimisation="1"/linkTimeOptimisation="0"/' "HISE.jucer"
Projucer --resave "HISE.jucer"

%if 0%{?sle_version} != 150300
sed -i 's/webkit2gtk-4.0/webkit2gtk-4.1/' Builds/LinuxMakefile/Makefile
%endif

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

%install

mkdir -p %{buildroot}%{_bindir}
install projects/standalone/Builds/LinuxMakefile/build/HISE\ Standalone %{buildroot}%{_bindir}/%{name}
mkdir -p %{buildroot}%{_libdir}/%{name}

for dir in customized_JUCE_files \
                          extras \
                      hi_backend \
                         hi_core \
                  hi_dsp_library \
                        hi_faust \
                    hi_faust_jit \
                    hi_faust_lib \
                  hi_faust_types \
                     hi_frontend \
                          hi_lac \
                        hi_loris \
                      hi_rlottie \
                    hi_scripting \
                         hi_snex \
                    hi_streaming \
                        hi_tools \
                         hi_zstd \
                  melatonin_blur \
                            JUCE; do cp -r $dir %{buildroot}%{_libdir}/%{name}/; done
mkdir -p %{buildroot}%{_libdir}/%{name}/tools/SDK
ln -s ../../JUCE/modules/juce_audio_processors/format_types/VST3_SDK %{buildroot}%{_libdir}/%{name}/tools/SDK/VST3\ SDK

mkdir -p %{buildroot}%{_libdir}/vst3
cp -r projects/plugin/Builds/LinuxMakefile/build/*.vst3 %{buildroot}%{_libdir}/vst3/

icotool -x projects/standalone/Builds/VisualStudio2022/icon.ico

var=1
for icondir in 16x16 32x32 48x48 256x256; do \
                                          mkdir -p %{buildroot}%{_datadir}/icons/hicolor/$icondir/apps; \
                                          cp icon_"$var"_"$icondir"x32.png %{buildroot}%{_datadir}/icons/hicolor/$icondir/apps/HISE.png;\
                                          var=$((var + 1)); done

mkdir -p %{buildroot}%{_datadir}/applications
install %{SOURCE1} %{buildroot}%{_datadir}/applications/

%fdupes -s %{buildroot}/%{_libdir}/%{name}
chmod +x %{buildroot}%{_libdir}/%{name}/JUCE/extras/Projucer/Source/BinaryData/gradle/gradlew
chmod -x %{buildroot}%{_datadir}/applications/HISE.desktop

mkdir -p %{buildroot}%{_libdir}/%{name}/tools/projucer

%files
%{_bindir}/%{name}
%{_libdir}/%{name}
%{_datadir}/icons/hicolor/
%{_datadir}/applications/
%doc README.md
%license license.txt
%files -n vst3-%{name}
%dir %{_libdir}/vst3
%{_libdir}/vst3/*
%license license.txt

%changelog
openSUSE Build Service is sponsored by