File Temperament.spec of Package Temperament

#
# spec file for package Temperament
#
# Copyright (c) 2024 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:           Temperament
Version:        1.0.1
Release:        0
Summary:        Temperament Synthesiser Plugin
License:        MIT
Group:          Productivity/Multimedia/Sound/Utilities
URL:            https://github.com/timcsy/Temperament
Source0:        %{name}.tar.xz
Source1:        generate-lv2-ttl.py
Source2:        LV2.mak.in
Source3:        AppConfig.h.in
Source4:        COPYING
Source5:        README_en.md
Patch0:         01-CFrac-include.patch
BuildRequires:  JUCE-Projucer
BuildRequires:  JUCE-devel
BuildRequires:  Mesa-libGL-devel
BuildRequires:  gcc-c++
BuildRequires:  ladspa-devel
BuildRequires:  libXcursor-devel
BuildRequires:  libXrandr-devel
BuildRequires:  libcurl-devel
BuildRequires:  libjack-devel
BuildRequires:  lv2-devel
BuildRequires:  pkgconfig
BuildRequires:  python3
BuildRequires:  xorg-x11-server
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xinerama)
Requires:       alsa

%description
https://github.com/timcsy/Temperament

Temperament - this synthesiser allows play with differen (or any) musical temperament, such a Pythagorean tuning or Chinese pentatonic scales.

%package -n lv2-%{name}
Summary:        Temperament Synthesiser Plugin

%description -n lv2-%{name}
https://github.com/timcsy/Temperament

Temperament - this synthesiser allows play with differen (or any) musical temperament, such a Pythagorean tuning or Chinese pentatonic scales.

%package -n vst-%{name}
Summary:        Temperament Synthesiser Plugin

%description -n vst-%{name}
https://github.com/timcsy/Temperament

Temperament - this synthesiser allows play with differen (or any) musical temperament, such a Pythagorean tuning or Chinese pentatonic scales.

%prep
%setup -q -n %{name}
%patch -P 0

%build
#cd Plug-in
mkdir -p JuceLibraryCode
cp -f %{SOURCE3} JuceLibraryCode/
cp %{SOURCE2} .
cp %{SOURCE1} .
cp %{SOURCE4} .
cp %{SOURCE5} .

#%define _lto_cflags %{nil}
%define X_display ":98"

sed -i -e /'<\/EXPORTFORMATS>/i <LINUX_MAKE targetFolder="Builds/LinuxMakefile">\ <CONFIGURATIONS>\ <CONFIGURATION isDebug="1" name="Debug"/>\ <CONFIGURATION isDebug="0" name="Release"/>\      </CONFIGURATIONS>\      <MODULEPATHS>\      </MODULEPATHS>\      </LINUX_MAKE>'  %{name}.jucer

sed -i -e 's/pluginFormats="buildAU,buildVST3"/pluginFormats="buildStandalone,buildVST"/' %{name}.jucer

sed -i -e 's/JUCEOPTIONS/JUCEOPTIONS JUCE_JACK="1" JUCE_WEB_BROWSER="0" JUCE_USE_CURL="0"/'  %{name}.jucer

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

#############################################
### Launch a virtual framebuffer X server ###
#############################################
export DISPLAY=%{X_display}
Xvfb %{X_display} >& Xvfb.log &
trap "kill $! || true" EXIT
sleep 10

Projucer --set-global-search-path linux defaultJuceModulePath %{_datadir}/juce/modules
Projucer --resave %{name}.jucer
echo "include ../../LV2.mak" >> Builds/LinuxMakefile/Makefile

cd Builds/LinuxMakefile
TARGET_ARCH=-Wl,--as-needed 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/

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

%files -n lv2-%{name}
%{_libdir}/lv2/
%doc README.md README_en.md
%license COPYING

%files -n vst-%{name}
%dir %{_libdir}/vst
%{_libdir}/vst/*
%doc README.md README_en.md
%license COPYING

%changelog
openSUSE Build Service is sponsored by