# Configuration variables
%define name            lmms
%define version         ${LMMS_VERSION}
%define rel             1
%define release         %{rel}%{?disttag}%{?repotag}

# Define what you can/want to build:
%define with_sdl        0%{nil}
%define with_jack       1%{nil}
%define with_vorbis     1%{nil}
%define with_flac       1%{nil}
%define with_sr         1%{nil}
%define with_sf         1%{nil}

# Build by setting these defines on the command line, for example:
# rpmbuild --define 'disttag .EL' --define 'repotag .fc6'
%{!?desktop_vendor:     %{expand: %%define desktop_vendor rpmfarm}}
# This can be changed at build time:
# rpmbuild --define 'desktop_vendor RPMfarm'

#--------------------------------------------------------------------

Name:		%{name}
Version:	%{version}
Release:	%{release}
Summary:	powerful sequencer-, synthesizer- and sample-studio for Linux
Summary(de):	Leistungsfaehiges Sequenzer-, Synthesizer- und Sample-Studio fuer Linux
License:	GPL
URL:		https://lmms.io/
Group:		Applications/Multimedia
Provides:	lmms = %{version}-%{release}
BuildRequires:	gcc gcc-c++ libstdc++-devel autoconf automake libtool make
BuildRequires:	alsa-lib-devel
BuildRequires:	qt-devel > 3.0
# ------------- BuildRequires:
%if %{with_vorbis}
BuildRequires:  libvorbis libvorbis-devel
%endif
%if %{with_sdl}
BuildRequires:	SDL SDL-devel SDL_sound
%endif
%if %{with_sr}
BuildRequires:	libsamplerate libsamplerate-devel
%endif
%if %{with_sf}
BuildRequires:  libsndfile libsndfile-devel
%endif
%if %{with_jack}
BuildRequires:	jack-audio-connection-kit-devel
%endif
%if %{with_flac}
BuildRequires:	flac-devel
%endif
# ------------- Requires:
Requires:	qt >= 3.0 alsa-lib
%if %{with_sr}
Requires:	libsamplerate
%endif
%if %{with_sf}
Requires:	libsndfile
%endif
%if %{with_jack}
Requires:	jack-audio-connection-kit
%endif
%if %{with_vorbis}
Requires:	libvorbis
%endif
%if %{with_flac}
Requires:	flac
%endif
%if %{with_sdl}
Requires:	SDL_sound
%endif

Requires:	lmms-data
Source:		%{name}-%{version}.tar.bz2
Patch1:		%{name}-%{version}-patch
BuildRoot:	%{_tmppath}/%{name}-%{version}-buildroot
Prefix:		%{_prefix}


%description
LMMS aims to be a free alternative to popular (but commercial and closed-
source) programs like FruityLoops, Cubase and Logic giving you the ability of
producing music with your computer by creating/synthesizing sounds, arranging
samples, playing live with keyboard and much more...

LMMS combines the features of a tracker-/sequencer-program (pattern-/channel-/
sample-/song-/effect-management) and those of powerful synthesizers and
samplers in a modern, user-friendly and easy to use graphical user-interface.

LMMS is still in heavy development, so with this version please don't expect a
complete, ready and bugfree program!!


%description -l de
LMMS ist eine freie Alternative zu bekannten (aber kommerziellen und
Closed-Source-) Programmen wie FruityLoops, Cubase und Logic, die Ihnen die
Moeglichkeit geben, mit Ihrem Computer Musik zu produzieren, indem Sie
Klaenge kreieren/synthetisieren, Samples anordnen, mit dem Keyboard live
spielen usw....

LMMS kombiniert die Funktionen eines Tracker-/Sequenzer-Programms (Pattern-/
Kanal-/Sample-/Song-/Effekt-Management) und die von leistungsfaehigen
Synthesizern und Samplern in einer modernen, benutzerfreundlichen und einfach zu
benutzenden grafischen Oberflaeche.

Derzeit befindet sich LMMS komplett in Entwicklung. Also erwarten Sie bitte mit
dieser Version nicht ein vollstaendiges, fertiges und fehlerfreies Programm!!


%package data
Summary:	samples, presets, demo-projects and localization-files for LMMS
Summary(de):	Samples, Presets, Demo-Projekte und Lokalisierungsdateien fuer LMMS
Group:		Applications/Multimedia
Provides:	lmms-data = %{version}-%{release}

%description data
This package contains platform-independent data and resources for LMMS, e.g.
samples, presets and demo-projects.


%description data -l de
Dieses Paket beinhaltet plattform-unabhaengige Daten und Resourcen fuer LMMS,
wie z.B. Samples, Presets und Demo-Projekte.


%prep
%setup -n %{name}-%{version}
%patch1 -p1 -b .EL

%build
%configure \
%if !%{with_jack}
    --without-jack \
%endif
%if !%{with_sdl}
    --without-sdl \
    --without-sdlsound \
%endif
%if !%{with_vorbis}
    --without-vorbis \
%endif
%if !%{with_flac}
    --without-flac \
%endif
%if !%{with_sr}
    --without-libsrc \
%endif
%if !%{with_sf}
    --without-libsf \
%endif

%{__make} %{?_smp_mflags}

# Create a desktop menu entry
%{__cat} > %{name}.desktop << EOF
[Desktop Entry]
Name=LMMS
Comment=Powerful sequencer-, synthesizer- and sample-studio for Linux
Exec=lmms
Icon=%{_datadir}/%{name}/themes/default/icon.png
Terminal=false
Type=Application
Categories=Application;AudioVideo;X-Fedora;X-RPMfarm;
Encoding=UTF-8
EOF

%install
%{__rm} -rf %{buildroot}
make DESTDIR=$RPM_BUILD_ROOT install

# Install menu entry
%{__mkdir_p} %{buildroot}%{_datadir}/applications
desktop-file-install \
    --vendor %{desktop_vendor} \
    --dir %{buildroot}%{_datadir}/applications \
    %{name}.desktop || :

%clean
%{__rm} -rf %{buildroot}

%files
%defattr(-, root, root, 0755)
%doc AUTHORS ChangeLog COPYING README TODO
%{_bindir}/lmms
%dir %{_libdir}/lmms
%{_libdir}/lmms/*
%{_mandir}/man*/lmms.*
%{_datadir}/applications/%{desktop_vendor}-%{name}.desktop

%files data
%defattr(-,root,root)
%dir %{_datadir}/lmms
%{_datadir}/lmms/*

-%changelog
-* Please see release notes (viewable online):
-- https://github.com/LMMS/lmms/releases/tag/v${LMMS_VERSION}
-
