%define _ftgl_ver	2.1.2

Summary:	projectM music visualization library
Name:		libprojectm
Version:	2.0.1
Release:	6%{?_dist_release}
License:	LGPLv2
Group:		System Environment/Libraries
URL:		http://xmms-projectm.sourceforge.net/

Source0:	http://prdownloads.sourceforge.net/xmms-projectm/libprojectM-%{version}.tar.bz2
#Remove fonts from package:
Patch0:     libprojectM-fonts.patch
#Bump soname
Patch1:     libprojectM-soname.patch
#Turn off USE_THREADS until the bug is fixed upstream
Patch2:     libprojectM-USE_THREADS.patch

Patch3:     libprojectM-freetype25.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:	ftgl-devel >= %{_ftgl_ver}, cmake, glew-devel, pkgconfig
Requires:	TrueType-bitstream-vera

Vendor:		Project Vine
Distribution:	Vine Linux
Packager:	daisuke

%description
projectM is a music visualization library that allows applications
to display interesting moving images while playing music. It is a
reimplementation of Milkdrop under OpenGL.

%package devel
Summary:	Development files for libprojectM
Group:		Development/Libraries
Requires:	%{name} = %{version}-%{release}
Requires:	mesa-libGL-devel
Requires:	pkgconfig

%description devel
projectM is a music visualization library that allows applications
to display interesting moving images while playing music. It is a
reimplementation of Milkdrop under OpenGL.

This package contains the libraries and header files necessary to
develop applications with projectM.

%prep
%setup -q -n libprojectM-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
sed -i 's/\r//' ChangeLog

%build
%cmake \
%if %{?_dist_release} == "vl5" || %{_dist_release} == "vl4"
    -DUSE_OPENMP:BOOL=OFF \
%endif
    -DCMAKE_INSTALL_PREFIX=%{_prefix} 
make %{?_smp_mflags} VERBOSE=1

%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
mkdir $RPM_BUILD_ROOT/%{_datadir}/projectM/fonts

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%clean
%__rm -rf %{buildroot}

%files
%defattr(-,root,root)
%{_libdir}/lib*.so.*
%{_datadir}/projectM

%files devel
%defattr(-,root,root)
%{_includedir}/libprojectM
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*.pc

%changelog
* Sun Jul 10 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.1-6
- rebuild with gcc-5.4.0

* Thu Oct 15 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.1-5
- rebuild with glew-1.13.0
- add Patch3 (libprojectM-freetype25.patch) from fedora

* Tue Jan 10 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.1-4
- rebuild with glew-1.7.0

* Sun Sep 26 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.0.1-3
- rebuild with rpm-4.8.1 for pkg-config file

* Tue Jun  1 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.0.1-2
- added -DUSE_OPENMP:BOOL=OFF not to use -fopenmp on VineLinux 5
- fixed typo at changelog

* Mon May 17 2010 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0.1-1
- update to 2.0.1
- add patch0: do not install fonts
  - add R: TrueType-bitstream-vera
- add patch1: bump soname
- add patch2: disable USE_THREADS

* Sun Sep 14 2008 Shu KONNO <owa@bg.wakwak.com> 0.99-1vl5
- applied new versioning policy
- excluded lib*.la

* Sat Aug 18 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.99-0vl2
- rebuilt with new toolchain

* Thu Feb 08 2007 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 0.99-0vl1
- initial build for Vine Linux

* Fri Jan 26 2007 Götz Waschk <waschk@mandriva.org> 0.99-2mdv2007.0
+ Revision: 113965
- bump
- Import libprojectm

* Fri Jan 26 2007 Götz Waschk <waschk@mandriva.org> 0.99-1mdv2007.1
- initial package
