Summary:	Portable Tools Library
Name:		ptlib
Version:	2.6.7
Release:        2%{?_dist_release}
URL:		http://www.opalvoip.org/
Source0:	ftp://ftp.gnome.org/pub/gnome/sources/ptlib/2.6/%{name}-%{version}.tar.bz2
License:	MPLv1.0
Group:		System Environment/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

BuildRequires:	expat openssl-devel pkgconfig
BuildRequires:  alsa-lib-devel, libstdc++3-devel, libv4l-devel
BuildRequires:  openldap-devel, expat-devel, SDL-devel, flex, bison
BuildRequires:  libraw1394-devel, libdv-devel, libavc1394-devel
BuildRequires:	expat-devel
Obsoletes:      pwlib, pwlib-alsa, pwlib-avc, pwlib-dc, pwlib-oss, pwlib-v4l

%description
PTLib (Portable Tools Library) is a moderately large class library that 
has it's genesis many years ago as PWLib (portable Windows Library), a 
method to product applications to run on both Microsoft Windows and Unix 
systems. It has also been ported to other systems such as Mac OSX, VxWorks 
and other embedded systems.

It is supplied mainly to support the OPAL project, but that shouldn't stop
you from using it in whatever project you have in mind if you so desire. 

%package devel
Summary:	Development package for ptlib
Group:		Development/Libraries
Requires:	ptlib = %{version}-%{release}
Requires:	pkgconfig
Requires:	cyrus-sasl-devel
Requires:	openldap-devel
Requires:	openssl-devel
Requires:	expat-devel
Requires:	SDL-devel
Obsoletes:      pwlib-devel

%description devel
The ptlib-devel package includes the libraries and header files for ptlib.

%prep
%setup -q 

%build
export CFLAGS="$CFLAGS -DLDAP_DEPRECATED"
%configure --prefix=%{_prefix} --disable-static \
	   --enable-plugins \
	   --disable-oss \
	   --enable-v4l2 \
	   --enable-avc
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

make PREFIX=$RPM_BUILD_ROOT%{_prefix} LIBDIR=$RPM_BUILD_ROOT%{_libdir} install

perl -pi -e 's@PTLIBDIR.*=.*@PTLIBDIR = /usr/share/ptlib@' $RPM_BUILD_ROOT%{_datadir}/ptlib/make/ptbuildopts.mak

# hack to fixup things for bug 197318
find $RPM_BUILD_ROOT%{_libdir} -name '*.so*' -type f -exec chmod +x {} \;

# Remove empty include file
rm -rf $RPM_BUILD_ROOT%{_includedir}/ptlib/devplugin.h

#
rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.a

%clean
rm -rf $RPM_BUILD_ROOT

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

%files
%defattr(-,root,root)
%doc History.txt ReadMe.txt mpl-1.0.htm
%attr(755,root,root) %{_libdir}/libpt*.so.*
%dir %{_libdir}/ptlib-%{version}
%dir %{_libdir}/ptlib-%{version}/devices
%dir %{_libdir}/ptlib-%{version}/devices/sound
%dir %{_libdir}/ptlib-%{version}/devices/videoinput
# List these explicitly so we don't get any surprises
%attr(755,root,root) %{_libdir}/ptlib-%{version}/devices/sound/alsa_pwplugin.so
%attr(755,root,root) %{_libdir}/ptlib-%{version}/devices/videoinput/v4l2_pwplugin.so
%attr(755,root,root) %{_libdir}/ptlib-%{version}/devices/videoinput/avc_pwplugin.so

%files devel
%defattr(-,root,root)
%{_libdir}/libpt*.so
%{_includedir}/*
%{_datadir}/ptlib
%{_libdir}/pkgconfig/ptlib.pc
%attr(755,root,root) %{_bindir}/*

%changelog
* Mon Jan 10 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.6.7-2
- rebuild with openssl-1.0.0c

* Mon Jun 21 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.6.7-1
- new upstream release
- add Requires: cyrus-sasl-devel, openldap-devel, openssl-devel, expat-devel, SDL-devel (devel package)

* Sun Mar 21 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.6.6-1
- new upstream release
- add BuildRequires: expat-devel
- remove configure option (--enable-opal)

* Sun Mar 14 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.6.5-1
- new upstream release
- add BuildRequires: libavc1394-devel
- add configure option (--enable-avc)

* Wed Jun 24 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.6.2-3
- rebuilt on ppc w/o libdc1394-devel

* Sun Jun 14 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.6.2-2
- remove dc_pwplugin
- remove BR: libdc1394-devel

* Thu May 28 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.6.2-1
- new upstream release

* Sat Apr  4 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.4.4-1
- new upstream release

* Wed Oct 29 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.4.2-1
- new upstream release

* Mon Sep 29 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 	2.4.1-1
- initial build for Vine Linux
- Obsoletes: pwlib, pwlib-{alsa,v4l,dc,avc}

* Wed Sep 10 2008 Peter Robinson <pbrobinson@gmail.com> - 2.3.1-2
- Build fixes from package review

* Sun Jun 8 2008 Peter Robinson <pbrobinson@gmail.com> - 2.3.1-1
- Initial version of ptlib
