%define _prefix	/usr
%define _SONr	1_4

Summary:	CLAM - C++ Library for Audio and Music
Name:		libclam_core%{_SONr}
Version:	1.4.0
Release:	2.sl.fc12
License:	GPL
URL:		http://clam.iua.upf.edu
Group:		System/Libraries
Source0:	CLAM-%{version}.tar.gz
Source90:	clam-rpmlintrc
Patch1:		clam-qt4.patch
Patch2:		clam-gcc44.patch
Patch3:		clam-no-return-in-nonvoid-function.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-buildroot

BuildRequires:	alsa-lib-devel
BuildRequires:	desktop-file-utils
BuildRequires:	doxygen
BuildRequires:	fftw-devel >= 3.0
BuildRequires:	gcc-c++
BuildRequires:	ghostscript-devel
BuildRequires:	hpijs
BuildRequires:	graphviz
BuildRequires:	id3lib-devel
BuildRequires:	jack-audio-connection-kit-devel
BuildRequires:	ladspa-devel
BuildRequires:	libjpeg-devel
BuildRequires:	liblo-devel
BuildRequires:	libogg-devel
BuildRequires:	libsamplerate-devel
BuildRequires:	libsndfile-devel
BuildRequires:	libvorbis-devel
BuildRequires:	libmad-devel
BuildRequires:	mesa-libGL-devel
BuildRequires:	mesa-libGLU-devel
BuildRequires:	mesa-libGLw-devel
BuildRequires:	mesa-libOSMesa-devel
BuildRequires:	oscpack
BuildRequires:	pkgconfig
BuildRequires:	portaudio-devel
BuildRequires:	qt-devel >= 4.4
BuildRequires:	scons >= 0.96.92
BuildRequires:	texlive-latex
BuildRequires:	xerces-c-devel

Requires:	alsa-lib
Requires:	jack-audio-connection-kit
Requires:	libmad
Requires:	xerces-c
Obsoletes:	libclam1 < 1.2.0
Provides:	libclam1 = 1.2.0
Obsoletes:	libclam13 < 1.3.0
Provides:	libclam13 = 1.3.0

%description
CLAM stands for C++ Library for Audio and Music and in Catalan means
something like a 'continuous sound produced by a large number of
people as to show approval or disapproval of a given event' It is
the best name we could find after long discussions and it is
certainly much better than its original name (MTG-Classes).

CLAM is a framework to develop audio and music applications in C++.

It provides tools to perform advanced analysis, transformations and
synthesis, visualization for audio and music related objects, and
other tools that are useful to abstract target platform for most
tasks in an audio applications such as audio devices, file formats,
threading...

%package -n libclam-devel
Summary:	CLAM - C++ Library for Audio and Music - development files
Group:		Development/Libraries/C and C++
Requires:	fftw-devel >= 3.0
Requires:	gcc-c++
Requires:	id3lib-devel
Requires:	jack-audio-connection-kit-devel
Requires:	ladspa-devel
Requires:	libclam_audioio%{_SONr} = %{version}
Requires:	libclam_core%{_SONr} = %{version}
Requires:	libclam_processing%{_SONr} = %{version}
Requires:	libogg-devel
Requires:	libsamplerate-devel
Requires:	libsndfile-devel
Requires:	libvorbis-devel
Requires:	libmad-devel
Requires:	oscpack
Requires:	pkgconfig
Requires:	portaudio-devel
Requires:	qt-devel >= 4.4

%description -n libclam-devel
CLAM is a framework to develop audio and music applications in C++.
It provides tools to perform advanced analysis, transformations and
synthesis, visualization for audio and music related objects, and
other tools that are useful to abstract target platform for most
tasks in an audio applications such as audio devices, file formats,
threading...

This package contains the files needed to develop programs with the
clam library.

%package -n clam-doc
Summary:	Contains the clam-framework documentation and some example programs
Group:		Documentation/Other
Provides:	libclam-doc = 1.3.0
Obsoletes:	libclam-doc < 1.3.0

%description -n clam-doc
This package contains the framework documentation and some example
programs.

%package -n libclam_audioio%{_SONr}
Summary:	Shared library for CLAM
Group:		System/Libraries

%description -n libclam_audioio%{_SONr}
Shared library for package CLAM.

%package -n libclam_processing%{_SONr}
Summary:	Shared library for CLAM
Group:		System/Libraries

%description -n libclam_processing%{_SONr}
Shared library for package CLAM.

%package -n libclam_filterspkg%{_SONr}
Summary:	Shared library for CLAM
Group:		System/Libraries

%description -n libclam_filterspkg%{_SONr}
Shared library for package CLAM.

%package -n libclam_guitareffects%{_SONr}
Summary:	Shared library for CLAM
Group:		System/Libraries

%description -n libclam_guitareffects%{_SONr}
Shared library for package CLAM.

%package -n libclam_midi%{_SONr}
Summary:	Shared library for CLAM
Group:		System/Libraries

%description -n libclam_midi%{_SONr}
Shared library for package CLAM.

%package -n libclam_osc%{_SONr}
Summary:	Shared library for CLAM
Group:		System/Libraries

%description -n libclam_osc%{_SONr}
Shared library for package CLAM.

%package -n libclam_resampling%{_SONr}
Summary:	Shared library for CLAM
Group:		System/Libraries

%description -n libclam_resampling%{_SONr}
Shared library for package CLAM.

%package -n libclam_samplebysample%{_SONr}
Summary:	Shared library for CLAM
Group:		System/Libraries

%description -n libclam_samplebysample%{_SONr}
Shared library for package CLAM.

%package -n libclam_sndfile%{_SONr}
Summary:	Shared library for CLAM
Group:		System/Libraries

%description -n libclam_sndfile%{_SONr}
Shared library for package CLAM.

%package -n libclam_spacialization%{_SONr}
Summary:	Shared library for CLAM
Group:		System/Libraries

%description -n libclam_spacialization%{_SONr}
Shared library for package CLAM.

%package -n libclam_speech%{_SONr}
Summary:	Shared library for CLAM
Group:		System/Libraries

%description -n libclam_speech%{_SONr}
Shared library for package CLAM.

%package -n clam-plugins
Summary:	Plugins for CLAM
Group:		System/Libraries

%description -n clam-plugins
Plugins for package CLAM.

%prep
%setup -q -n CLAM-%{version}
%patch1
%patch2 -p1
%patch3 -p1

%__sed -i -e 's|/lib|/%{_lib}|g' \
	scons/libs/clam_build_helpers.py

%build

%install
%__rm -rf %{buildroot}
%__install -dm 755 %{buildroot}%{_prefix}

scons \
	prefix=%{buildroot}%{_prefix} \
	release=1 \
	double=0 \
	xmlbackend=xercesc \
	with_ladspa=1 \
	with_osc=1 \
	with_jack=1 \
	with_fftw3=1 \
	with_fftw=0 \
	with_nr_fft=1 \
	with_sndfile=1 \
	with_oggvorbis=1 \
	with_mad=1 \
	with_id3=1 \
	with_portaudio=1 \
	with_alsa=1 \
	with_portmidi=0

scons
scons install

%__sed -i -e 's|#include <fstream>|#include <fstream>\n#include <cstdlib>|g' \
	plugins/temporal_oboeSynthesizer/TestScore.cxx

for i in Filters GuitarEffects MIDI resampling samplebysample \
	sndfile spacialization speech osc; do
	pushd plugins/$i
		export PKG_CONFIG_PATH=%{buildroot}%{_libdir}/pkgconfig
		scons \
			clam_prefix=%{buildroot}%{_prefix} \
			prefix=%{buildroot}%{_prefix}
		scons install
	popd
done

doxygen ./doxygen.cfg
%__rm -f doxygen/html/installdox

%__sed -i -e 's|%{buildroot}||g' \
	%{buildroot}%{_libdir}/pkgconfig/*.pc

%clean
%__rm -rf %{buildroot}

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%post -n libclam_processing%{_SONr} -p /sbin/ldconfig
%postun -n libclam_processing%{_SONr} -p /sbin/ldconfig

%post -n libclam_audioio%{_SONr} -p /sbin/ldconfig
%postun -n libclam_audioio%{_SONr} -p /sbin/ldconfig

%post -n libclam_filterspkg%{_SONr} -p /sbin/ldconfig
%postun -n libclam_filterspkg%{_SONr} -p /sbin/ldconfig

%post -n libclam_guitareffects%{_SONr} -p /sbin/ldconfig
%postun -n libclam_guitareffects%{_SONr} -p /sbin/ldconfig

%post -n libclam_midi%{_SONr} -p /sbin/ldconfig
%postun -n libclam_midi%{_SONr} -p /sbin/ldconfig

%post -n libclam_osc%{_SONr} -p /sbin/ldconfig
%postun -n libclam_osc%{_SONr} -p /sbin/ldconfig

%post -n libclam_resampling%{_SONr} -p /sbin/ldconfig
%postun -n libclam_resampling%{_SONr} -p /sbin/ldconfig

%post -n libclam_samplebysample%{_SONr} -p /sbin/ldconfig
%postun -n libclam_samplebysample%{_SONr} -p /sbin/ldconfig

%post -n libclam_sndfile%{_SONr} -p /sbin/ldconfig
%postun -n libclam_sndfile%{_SONr} -p /sbin/ldconfig

%post -n libclam_spacialization%{_SONr} -p /sbin/ldconfig
%postun -n libclam_spacialization%{_SONr} -p /sbin/ldconfig

%post -n libclam_speech%{_SONr} -p /sbin/ldconfig
%postun -n libclam_speech%{_SONr} -p /sbin/ldconfig

%files
%defattr(-,root,root)
%{_libdir}/libclam_core.so.*

%files -n libclam_processing%{_SONr}
%defattr(-,root,root)
%{_libdir}/libclam_processing.so.*

%files -n libclam_audioio%{_SONr}
%defattr(-,root,root)
%{_libdir}/libclam_audioio.so.*

%files -n libclam_filterspkg%{_SONr}
%defattr(-,root,root)
%{_libdir}/libclam_filterspkg.so.*

%files -n libclam_guitareffects%{_SONr}
%defattr(-,root,root)
%{_libdir}/libclam_guitareffects.so.*

%files -n libclam_midi%{_SONr}
%defattr(-,root,root)
%{_libdir}/libclam_midi.so.*

%files -n libclam_osc%{_SONr}
%defattr(-,root,root)
%{_libdir}/libclam_osc.so.*

%files -n libclam_resampling%{_SONr}
%defattr(-,root,root)
%{_libdir}/libclam_resampling.so.*

%files -n libclam_samplebysample%{_SONr}
%defattr(-,root,root)
%{_libdir}/libclam_samplebysample.so.*

%files -n libclam_sndfile%{_SONr}
%defattr(-,root,root)
%{_libdir}/libclam_sndfile.so.*

%files -n libclam_spacialization%{_SONr}
%defattr(-,root,root)
%{_libdir}/libclam_spacialization.so.*

%files -n libclam_speech%{_SONr}
%defattr(-,root,root)
%{_libdir}/libclam_speech.so.*

%files -n libclam-devel
%defattr(-,root,root)
%dir %{_includedir}/CLAM
%{_includedir}/CLAM/*
%{_libdir}/libclam_*.so
%{_libdir}/pkgconfig/clam_*.pc
%dir %{_datadir}/clam
%dir %{_datadir}/clam/sconstools
%{_datadir}/clam/sconstools/*.py*

%files -n clam-doc
%defattr(-,root,root)
%doc CHANGES
%doc doxygen/*

%files -n clam-plugins
%defattr(-,root,root)
%dir %{_libdir}/clam
%{_libdir}/clam/libclam_*_plugin.so*
%dir %{_datadir}/networkeditor
%{_datadir}/networkeditor/*

%changelog
* Sun Apr 25 2010 Simon Lewis <simon.lewis@slnet-online.de> - 1.4.0-2.sl.fc12
- Build 1
* Sun Mar 06 2010 Toni Graffy <toni@links2linux.de> - 1.4.0-1.pm.1
- added clam-plugins
* Sat Mar 06 2010 Toni Graffy <toni@links2linux.de> - 1.4.0-0.pm.1
- update to 1.4.0 "3D molluscs on the space release"
- split off lib* in own packages
- new SO-name ==> libclam1_4_0
* Wed Aug 13 2008 Toni Graffy <toni@links2linux.de> - 1.3.0-0.pm.1
- update to 1.3.0
- new SO-name ==> libclam13
* Fri Feb 08 2008 Toni Graffy <toni@links2linux.de> - 1.2.0-0.pm.1
- update to 1.2.0
* Fri Sep 28 2007 Toni Graffy <toni@links2linux.de> - 1.1.0-0.pm.3
- rebuild to sync repos and force pm-name libclam
* Tue Aug 28 2007 Toni Graffy <toni@links2linux.de> - 1.1.0-0.pm.2
- fixed 64bit build
* Mon Jun 11 2007 Toni Graffy <toni@links2linux.de> - 1.1.0-0.pm.1
- splitted off sub-packages: clam-networkeditor, clam-annotator, clam-smstools
- update to CLAM-1.1.0
- renamed package to libclam1, libclam-devel, libclam-doc
* Wed Mar 21 2007 Toni Graffy <toni@links2linux.de> - 1.0.0-0.pm.1
- update to CLAM-1.0.0, NetworkEditor-1.0.0, SMSTools-0.4.7, Annotator-0.3.8
* Tue Mar 20 2007 Toni Graffy <toni@links2linux.de> - 0.99.0-0.pm.1
- update to 0.99
- NetworkEditor-0.4.4, SMSTools-0.4.6, Annotator-0.3.7
* Wed Feb 14 2007 Toni Graffy <toni@links2linux.de> - 0.98.0-0.pm.1
- update to 0.98
* Wed Jan 31 2007 Toni Graffy <toni@links2linux.de> - 0.97.0-0.pm.1
- initial build 0.97.0
