File protoplug.spec of Package protoplug

#
# spec file for package protoplug-free
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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:           protoplug
Version:        1.4.0
Release:        0
Summary:        Create audio plugins on-the-fly with LuaJIT
License:        MIT
Group:          Productivity/Multimedia/Sound/Midi
URL:            https://github.com/pluginguru/protoplug-free
Source0:        %{name}-%{version}.tar.gz
Source1:        CMakeLists.txt
Source2:        ProtoplugFiles.tar.gz
Source10:       %{name}-rpmlintrc
Patch0:         protoplug-climits.patch
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xinerama)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  Mesa-libGL-devel
BuildRequires:  libXrandr-devel
BuildRequires:  libXcursor-devel
BuildRequires:	libjack-devel
BuildRequires:	libcurl-devel
BuildRequires:	JUCE6-devel
BuildRequires:	cmake
BuildRequires:  lv2-devel
BuildRequires:  lv2_ttl_generator
Requires:       %{name}-common

%description

Protoplug is a VST/LV2 plug-in that lets you load and edit Lua scripts as audio (or MIDI) effects and instruments.
The original version was developed by Pierre Cusa and can be found on GitHub at https://github.com/pac-dev/protoplug. 

%package common
Summary:       Create audio plugins on-the-fly with LuaJIT (Documentation and scripts)
Buildarch: noarch

%description common

This package contains Documentation and LUA examples (with includes) for protoplug.
They're taken from https://github.com/pac-dev/protoplug and https://github.com/Sin-tel/protoplug

Add the path to /usr/share/ProtoplugFiles at the first ProtoPlug run.

%package -n vst3-%{name}
Summary:       Create audio plugins on-the-fly with LuaJIT (VST3)
Requires:       %{name}-common

%description -n vst3-%{name}

Protoplug is a VST/LV2 plug-in that lets you load and edit Lua scripts as audio (or MIDI) effects and instruments.
The original version was developed by Pierre Cusa and can be found on GitHub at https://github.com/pac-dev/protoplug. 

%package -n vst-%{name}
Summary:        Create audio plugins on-the-fly with LuaJIT (VST)
Requires:       %{name}-common

%description -n vst-%{name}

Protoplug is a VST/LV2 plug-in that lets you load and edit Lua scripts as audio (or MIDI) effects and instruments.
The original version was developed by Pierre Cusa and can be found on GitHub at https://github.com/pac-dev/protoplug. 

%package -n lv2-%{name}
Summary:        Create audio plugins on-the-fly with LuaJIT (LV2)
Requires:       %{name}-common

%description -n lv2-%{name}

Protoplug is a VST/AU plug-in that lets you load and edit Lua scripts as audio (or MIDI) effects and instruments.
The original version was developed by Pierre Cusa and can be found on GitHub at https://github.com/pac-dev/protoplug. 

%prep
%setup -q
%autopatch -p1

cp %{SOURCE1} ./

%build
cmake -B cmake-build -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/usr/lib64/juce -DLV2_TTL_GENERATOR=/usr/bin/lv2_ttl_generator
# FIXME: you should use the %%cmake macros
cmake --build cmake-build %{?_smp_mflags}

%install
mkdir -p %{buildroot}%{_libdir}/vst
install cmake-build/%{name}_["fx","gen"]*_artefacts/Release/VST/* %{buildroot}%{_libdir}/vst/
mkdir -p %{buildroot}%{_libdir}/vst3
cp -r cmake-build/%{name}_["fx","gen"]*_artefacts/Release/VST3/*.vst3 %{buildroot}%{_libdir}/vst3/
mkdir -p %{buildroot}%{_libdir}/lv2
cp -r cmake-build/%{name}_["fx","gen"]*_artefacts/Release/LV2/*.lv2 %{buildroot}%{_libdir}/lv2/

rm "%{buildroot}%{_libdir}/lv2/protoplug_fx.lv2/protoplug last compile.lua" "%{buildroot}%{_libdir}/lv2/protoplug_gen.lv2/protoplug last compile.lua"

mkdir -p %{buildroot}%{_datadir}
tar xf %{SOURCE2} -C %{buildroot}%{_datadir}/

%files -n vst-%{name}
%dir %{_libdir}/vst
%{_libdir}/vst/*
%doc README.md
%license LICENSE
%files -n vst3-%{name}
%dir %{_libdir}/vst3
%{_libdir}/vst3/*
%doc README.md
%license LICENSE
%files -n lv2-%{name}
%dir %{_libdir}/lv2
%{_libdir}/lv2/*
%doc README.md
%license LICENSE
%files common
%{_datadir}/ProtoplugFiles

%changelog
openSUSE Build Service is sponsored by