File ob-xf-nightly.spec of Package ob-xf-nightly

#
# spec file for package ob-xf-nightly
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2025 Konstantin Voinov konstantin.voinov@gmail.com
#
# 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 obxfname ob-xf
%define plugname OB-Xf
%define packagesuffix nightly
%define conflictsuffix release
Name:           %{obxfname}-%{packagesuffix}
Version:        20251028~fc0a828
Release:        0
Summary:        Software synthesizer inspired by the venerable Oberheim OB-X
License:        GPL-3.0-only
Group:          Productivity/Multimedia/Sound/Midi
URL:            https://surge-synth-team.org/ob-xf/
Source0:        %{obxfname}-%{version}.tar.gz
Patch0:         ob-xf-cmakelists.patch
BuildRequires:  cmake >= 3.22
BuildRequires:  git
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(fftw3f)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(gl)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xcursor)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xinerama)
BuildRequires:  pkgconfig(xrandr)
Requires:       %{name}-standalone = %{version}
Requires:       clap-%{name} = %{version}
Requires:       lv2-%{name} = %{version}
Requires:       vst3-%{name} = %{version}
Conflicts:      %{obxfname}-%{conflictsuffix}
%if 0%{?is_opensuse} && 0%{?suse_version} < 1600
BuildRequires:  gcc14
BuildRequires:  gcc14-c++
%else
BuildRequires:  gcc-c++
%endif
%if %{defined fedora}
BuildRequires:  jack-audio-connection-kit-devel
%else
BuildRequires:  libjack-devel
%endif

%description
OB-Xf is a continuation of the last open source version of OB-Xd by 2DaT and later discoDSP,
bringing together several efforts going on in the audio space and combining them inside the Surge Synth Team infrastructure.

This is a full installer meta-package, providing rpms of all OB-Xf binaries (or each can be installed separately):

ob-xf-nightly-standalone
ob-xf-fx-nightly-standalone

clap-ob-xf-nightly
lv2-ob-xf-nightly
vst3-ob-xf-nightly

clap-ob-xf-fx-nightly
lv2-ob-xf-fx-nightly
vst3-ob-xf-fx-nightly

%package standalone
Summary:        Software synthesizer inspired by the venerable Oberheim OB-X (Standalone JACK/ALSA)
Requires:       %{name}-common
Conflicts:      %{obxfname}-%{conflictsuffix}-standalone

%description standalone
OB-Xf is a continuation of the last open source version of OB-Xd by 2DaT and later discoDSP,
bringing together several efforts going on in the audio space and combining them inside the Surge Synth Team infrastructure.


%package common
Summary:        Common files for ob-xf
Conflicts:      %{obxfname}-%{conflictsuffix}-common
BuildArch:      noarch

%description common
Data files for ob-xf (Presets, Skins)

%package -n vst3-%{name}
Summary:        Software synthesizer inspired by the venerable Oberheim OB-X (VST3)
Requires:       %{name}-common
Conflicts:      vst3-%{obxfname}-%{conflictsuffix}

%description -n vst3-%{name}
OB-Xf is a continuation of the last open source version of OB-Xd by 2DaT and later discoDSP,
bringing together several efforts going on in the audio space and combining them inside the Surge Synth Team infrastructure.

%package -n clap-%{name}
Summary:        Software synthesizer inspired by the venerable Oberheim OB-X (CLAP)
Requires:       %{name}-common
Conflicts:      clap-%{obxfname}-%{conflictsuffix}

%description -n clap-%{name}
OB-Xf is a continuation of the last open source version of OB-Xd by 2DaT and later discoDSP,
bringing together several efforts going on in the audio space and combining them inside the Surge Synth Team infrastructure.

%package -n lv2-%{name}
Summary:        SSoftware synthesizer inspired by the venerable Oberheim OB-X (LV2)
Requires:       %{name}-common
Conflicts:      lv2-%{obxfname}-%{conflictsuffix}

%description -n lv2-%{name}
OB-Xf is a continuation of the last open source version of OB-Xd by 2DaT and later discoDSP,
bringing together several efforts going on in the audio space and combining them inside the Surge Synth Team infrastructure.

%prep
%setup -q -n %{obxfname}-%{version}
%autopatch -p1

# OBS getting commit hash hack
%define GIT_COMMIT_HASH %(echo %{version} |awk -F '~' '{ print $2 }')
%define GIT_TAG %(echo %{version} |awk -F'[+.]' '{ print $1"."$2"."$3 }')
%define GIT_BRANCH main/%{GIT_TAG}

sed -i -e 's/deadbeef/%{GIT_COMMIT_HASH}/' CMakeLists.txt

%build
%cmake -DBUILD_SHARED_LIBS:BOOL=OFF \
%if 0%{?is_opensuse} && 0%{?suse_version} < 1600
                     -DCMAKE_CXX_COMPILER=g++-14
%endif

%cmake_build

%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_libdir}/clap
mkdir -p %{buildroot}%{_libdir}/vst3
mkdir -p %{buildroot}%{_libdir}/lv2
mkdir -p "%{buildroot}%{_datadir}/Surge Synth Team/OB-Xf"


%if %{defined fedora}
cp redhat-linux-build/OB-Xf_artefacts/Standalone/* %{buildroot}%{_bindir}
cp -r redhat-linux-build/OB-Xf_artefacts/CLAP/* %{buildroot}%{_libdir}/clap
cp -r redhat-linux-build/OB-Xf_artefacts/VST3/* %{buildroot}%{_libdir}/vst3
cp -r redhat-linux-build/OB-Xf_artefacts/LV2/* %{buildroot}%{_libdir}/lv2
%else
cp build/OB-Xf_artefacts/RelWithDebInfo/Standalone/* %{buildroot}%{_bindir}
cp -r build/OB-Xf_artefacts/RelWithDebInfo/CLAP/* %{buildroot}%{_libdir}/clap
cp -r build/OB-Xf_artefacts/RelWithDebInfo/VST3/* %{buildroot}%{_libdir}/vst3
cp -r build/OB-Xf_artefacts/RelWithDebInfo/LV2/* %{buildroot}%{_libdir}/lv2
%endif

cp -r ./assets/installer/Surge\ Synth\ Team/OB-Xf/* "%{buildroot}%{_datadir}/Surge Synth Team/OB-Xf/"

# Readme for main meta-package.
install -m 755 -d %{buildroot}%{_docdir}/%{name}
cat > %{buildroot}%{_docdir}/%{name}/%{name}.txt <<EOF
This is a full installer meta-package, providing rpms of all OB-Xf binaries (or each can be installed separately):

ob-xf-nightly-standalone

clap-ob-xf-nightly
lv2-ob-xf-nightly
vst3-ob-xf-nightly

EOF

%files
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/%{name}.txt

%files standalone
%{_bindir}/

%files common
%doc README.md
%license LICENSE
%dir "%{_datadir}/Surge Synth Team"
%dir "%{_datadir}/Surge Synth Team/OB-Xf/"
"%{_datadir}/Surge Synth Team/OB-Xf/"

%files -n vst3-%{name}
%license LICENSE
%dir %{_libdir}/vst3
%{_libdir}/vst3/

%files -n clap-%{name}
%license LICENSE
%dir %{_libdir}/clap
%{_libdir}/clap/

%files -n lv2-%{name}
%license LICENSE
%dir %{_libdir}/lv2
%{_libdir}/lv2/

%changelog
openSUSE Build Service is sponsored by