%undefine __cmake_in_source_build

Name:    vst3sdk
Version: 3.7.11
Release: 1%{dist}
URL:     https://github.com/steinbergmedia/vst3sdk
License: LicenseRef-Proprietary-Steinberg-VST3-License OR GPL-3.0-only
Summary: VST 3 Plug-In SDK

# upstream does not provide proper tarballs, so we had to make them manually:
# git clone https://github.com/steinbergmedia/vst3sdk.git
# mv vst3sdk vst3sdk-%{version}
# cd vst3sdk-%{version}
# git submodule init
# git submodule update
# cd ..
# tar -cJf vst3sdk-%{version}.tar.xz vst3sdk-%{version}

Source0: vst3sdk-%{version}.tar.xz
Source1: vst3sdk.pc

Patch0:  vst3sdk-buildfix.patch

BuildRequires: rsync

Requires: %{name}-filesystem >= %{version}-%{release}

%description
This package provides the 'base', 'pluginterfaces' and 'public.sdk'
source modules only, necessary for Steinberg VST3 Plug-in and Host application.

%package -n vstsdk-filesystem
Summary: Common directories for VST2 and VST3 SDKs
Provides: vst2sdk-filesystem = %{version}-%{release}
Provides: vst3sdk-filesystem = %{version}-%{release}

%description -n vstsdk-filesystem
%{summary}.

%prep
%autosetup -p1

%build


%install
mkdir -p %{buildroot}%{_datadir}/vstsdk
mkdir -p %{buildroot}%{_libdir}/cmake/%{name}
install -vDm 644 cmake/modules/*.cmake -t "%{buildroot}%{_libdir}/cmake/%{name}/"
rsync -r --exclude doc --exclude .git --exclude .github --exclude .gitignore --exclude .gitattributes . %{buildroot}%{_datadir}/vstsdk/

install -vDm 644 %{SOURCE1} -t "%{buildroot}%{_libdir}/pkgconfig/"
sed -e "s/VERSION/%{version}/" -i %{buildroot}%{_libdir}/pkgconfig/%{name}.pc


%files
%{_libdir}/cmake/
%{_libdir}/pkgconfig/%{name}.pc
%{_datadir}/vstsdk

%files -n vstsdk-filesystem
%license LICENSE.txt
%dir %{_datadir}/vstsdk/pluginterfaces
%dir %{_datadir}/vstsdk/public.sdk/source
