30e9aaf
%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
30e9aaf
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
30e9aaf
d215b49
Name:		rb_libtorrent
d8e0261
Version:	0.13.1
22e7ea4
Release:	3%{?dist}
d215b49
Summary:	A C++ BitTorrent library aiming to be the best alternative
d215b49
d215b49
Group:		System Environment/Libraries
d215b49
License:	BSD
d215b49
URL:		http://www.rasterbar.com/products/libtorrent/
d215b49
d8e0261
Source0:	http://www.libtorrent.org/libtorrent-rasterbar-%{version}.tar.gz
d215b49
Source1:	%{name}-README-renames.Fedora
d215b49
Source2:	%{name}-COPYING.Boost
d215b49
Source3:	%{name}-COPYING.zlib
30e9aaf
## Sent upstream via the libtorrent-discuss ML.
30e9aaf
## Message-Id: <1216701448.24546.11.camel@tuxhugs>
30e9aaf
Source4: 	%{name}-python-setup.py
d215b49
d215b49
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
d215b49
d8e0261
BuildRequires:	asio-devel
d215b49
BuildRequires:	boost-devel
09cc6b2
BuildRequires:	libtool
30e9aaf
BuildRequires:	python-devel
30e9aaf
BuildRequires:	python-setuptools
30e9aaf
BuildRequires:	zlib-devel
041e2cb
## Necessary for 'rename'...
041e2cb
BuildRequires:	util-linux-ng
d215b49
d215b49
## The following is taken from it's website listing...mostly.
d215b49
%description
d215b49
%{name} is a C++ library that aims to be a good alternative to all
d215b49
the other BitTorrent implementations around. It is a library and not a full
fe12745
featured client, although it comes with a few working example clients.
d215b49
d215b49
Its main goals are to be very efficient (in terms of CPU and memory usage) as
09cc6b2
well as being very easy to use both as a user and developer. 
d215b49
d215b49
09cc6b2
%package 	devel
d215b49
Summary:	Development files for %{name}
d215b49
Group:		Development/Libraries
22e7ea4
License:	BSD and zlib and Boost
d215b49
Requires:	%{name} = %{version}-%{release}
d215b49
Requires:	pkgconfig
d8e0261
## Same include directory. :(
a5f2397
Conflicts:	libtorrent-devel
fe12745
## Needed for various headers used via #include directives...
d215b49
Requires:	boost-devel
d215b49
Requires:	openssl-devel
d215b49
09cc6b2
%description	devel
d215b49
The %{name}-devel package contains libraries and header files for
d215b49
developing applications that use %{name}.
d215b49
d215b49
The various source and header files included in this package are licensed
d215b49
under the revised BSD, zlib/libpng, and Boost Public licenses. See the various
d215b49
COPYING files in the included documentation for the full text of these
d215b49
licenses, as well as the comments blocks in the source code for which license
d215b49
a given source or header file is released under.
d215b49
d215b49
d8e0261
#package	examples
d8e0261
#Summary:	Example clients using %{name}
d8e0261
#Group:		Applications/Internet
d8e0261
#License:	BSD
d8e0261
#Requires:	%{name} = %{version}-%{release}
d8e0261
d8e0261
#description	examples
d8e0261
#The %{name}-examples package contains example clients which intend to
d8e0261
#show how to make use of its various features. (Due to potential
d8e0261
#namespace conflicts, a couple of the examples had to be renamed. See the
d8e0261
#included documentation for more details.)
09cc6b2
09cc6b2
30e9aaf
%package	python
30e9aaf
Summary:	Python bindings for %{name}
30e9aaf
Group:		Development/Languages
22e7ea4
License:	Boost
30e9aaf
Requires:	%{name} = %{version}-%{release}
30e9aaf
30e9aaf
%description	python
30e9aaf
The %{name}-python package contains Python language bindings (the 'libtorrent'
30e9aaf
module) that allow it to be used from within Python applications.
30e9aaf
30e9aaf
d215b49
%prep
d8e0261
%setup -q -n "libtorrent-rasterbar-%{version}"
d215b49
## The RST files are the sources used to create the final HTML files; and are
d215b49
## not needed.
d215b49
rm -f docs/*.rst
d215b49
## Ensure that we get the licenses installed appropriately.
d215b49
install -p -m 0644 COPYING COPYING.BSD
d215b49
install -p -m 0644 %{SOURCE2} COPYING.Boost
d215b49
install -p -m 0644 %{SOURCE3} COPYING.zlib
d8e0261
## Finally, ensure that everything is UTF-8, as it should be.
d8e0261
iconv -t UTF-8 -f ISO_8859-15 AUTHORS -o AUTHORS.iconv
d8e0261
mv AUTHORS.iconv AUTHORS
30e9aaf
## Install the necessary build script for the python bindings module...
30e9aaf
install -p -m 0755 %{SOURCE4} bindings/python/setup.py
d215b49
d215b49
d215b49
%build
d8e0261
## XXX: Even with the --with-asio=system configure option, the stuff in
d8e0261
## the local include directory overrides that of the system. We don't like
d8e0261
## local copies of system code. :)
d8e0261
rm -rf include/libtorrent/asio*
d8e0261
## FIXME: The examples currently fail to build (missing Makefile.in)
d8e0261
%configure --disable-static --with-zlib=system		\
d8e0261
	--with-boost-date-time=mt 			\
d8e0261
	--with-boost-thread=mt				\
d8e0261
	--with-boost-regex=mt				\
d8e0261
	--with-boost-program_options=mt			\
d8e0261
	--with-boost-filesystem=mt			\
d8e0261
	--with-asio=system
09cc6b2
## Use the system libtool to ensure that we don't get unnecessary RPATH
09cc6b2
## hacks in our final build.
09cc6b2
make %{?_smp_mflags} LIBTOOL=%{_bindir}/libtool
30e9aaf
## Finally, build the python module.
30e9aaf
pushd bindings/python
30e9aaf
	CFLAGS="%{optflags}" %{__python} setup.py build
30e9aaf
	## Fix the interpreter for the example clients
30e9aaf
	sed -i -e 's:^#!/bin/python$:#!/usr/bin/python:' {simple_,}client.py 
30e9aaf
popd
d215b49
d215b49
d215b49
%check
d215b49
make check
d215b49
d215b49
d215b49
%install
d215b49
rm -rf %{buildroot}
a5f2397
## Ensure that we preserve our timestamps properly.
d215b49
export CPPROG="%{__cp} -p"
d215b49
make install DESTDIR=%{buildroot} INSTALL="%{__install} -c -p"
d215b49
## Do the renaming due to the somewhat limited %%_bindir namespace. 
30e9aaf
#rename client torrent_client %{buildroot}%{_bindir}/*
30e9aaf
#install -p -m 0644 %{SOURCE1} ./README-renames.Fedora
30e9aaf
## Install the python binding module.
30e9aaf
pushd bindings/python
30e9aaf
	%{__python} setup.py install -O1 --skip-build --root %{buildroot}
30e9aaf
popd 
d215b49
d215b49
d215b49
%clean
d215b49
rm -rf %{buildroot}
d215b49
d215b49
d215b49
%post -p /sbin/ldconfig
d215b49
d215b49
d215b49
%postun -p /sbin/ldconfig
d215b49
d215b49
d215b49
%files
d215b49
%defattr(-,root,root,-)
09cc6b2
%doc AUTHORS ChangeLog COPYING README
d215b49
%exclude %{_libdir}/*.la
d8e0261
%{_libdir}/libtorrent-rasterbar.so.*
09cc6b2
## Unfortunately (even with the "--disable-static" option to the %%configure
09cc6b2
## invocation) our use of the system libtool creates static libraries at build
09cc6b2
## time, so we must exclude them here.
09cc6b2
%exclude %{_libdir}/*.a
09cc6b2
30e9aaf
%files	devel
d215b49
%defattr(-,root,root,-)
d215b49
%doc COPYING.Boost COPYING.BSD COPYING.zlib docs/ 
d8e0261
%{_libdir}/pkgconfig/libtorrent-rasterbar.pc
d215b49
%{_includedir}/libtorrent/
d8e0261
%{_libdir}/libtorrent-rasterbar.so
d215b49
d8e0261
## Build failures...
d8e0261
#files examples
d8e0261
#doc COPYING README-renames.Fedora
d8e0261
#{_bindir}/*torrent*
09cc6b2
30e9aaf
%files	python
30e9aaf
%defattr(-,root,root,-)
30e9aaf
%doc AUTHORS ChangeLog COPYING.Boost bindings/python/{simple_,}client.py
30e9aaf
%{python_sitearch}/libtorrent-%{version}-py2.5.egg-info
30e9aaf
%{python_sitearch}/libtorrent.so
30e9aaf
d215b49
d215b49
%changelog
22e7ea4
* Wed Sep  3 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 0.13.1-3
22e7ea4
- fix license tag
22e7ea4
30e9aaf
* Mon Jul 14 2008 Peter Gordon <peter@thecodergeek.com> - 0.13.1-2
30e9aaf
- Add python bindings in a -python subpackage. 
30e9aaf
d8e0261
* Mon Jul 14 2008 Peter Gordon <peter@thecodergeek.com> - 0.13.1-1
d8e0261
- Update to new upstream release (0.13.1): Contains an incompatible ABI/API
d8e0261
  bump.
d8e0261
- Drop GCC 4.3 patch (fixed upstream):
d8e0261
  - gcc43.patch
d8e0261
- Disable building the examples for now. (Attempted builds fail due to missing
d8e0261
  Makefile support.) 
d8e0261
- Drop the source permissions and pkgconfig file tweaks (fixed upstream).
d8e0261
e8448fe
* Sat Feb 09 2008 Peter Gordon <peter@thecodergeek.com> - 0.12.1-1
e8448fe
- Update to new upstream bug-fix release (0.12.1)
e8448fe
- Rebuild for GCC 4.3
e8448fe
- Drop security fix patch (merged upstream):
e8448fe
  - svn1968-bdecode_recursive-security-fix.patch
e8448fe
- Add GCC 4.3 build fixes (based on patch from Adel Gadllah, bug 432778):
e8448fe
  + gcc43.patch
e8448fe
b0cd9d6
* Mon Jan 28 2008 Peter Gordon <peter@thecodergeek.com> - 0.12-3
b0cd9d6
- Add upstream patch (changeset 1968) to fix potential security vulnerability:
b0cd9d6
  malformed messages passed through the bdecode_recursive routine could cause
b0cd9d6
  a potential stack overflow.
b0cd9d6
  + svn1968-bdecode_recursive-security-fix.patch
b0cd9d6
02269b3
* Fri Aug 03 2007 Peter Gordon <peter@thecodergeek.com> - 0.12-2
02269b3
- Rebuild against new Boost libraries.
02269b3
09cc6b2
* Thu Jun 07 2007 Peter Gordon <peter@thecodergeek.com> - 0.12-1
09cc6b2
- Update to new upstream release (0.12 Final)
09cc6b2
- Split examples into a subpackage. Applications that use rb_libtorrent
fe12745
  don't need the example binaries installed; and splitting the package in this
fe12745
  manner is a bit more friendly to multilib environments.  
09cc6b2
09cc6b2
* Sun Mar 11 2007 Peter Gordon <peter@thecodergeek.com> - 0.12-0.rc1
09cc6b2
- Update to new upstream release (0.12 RC).
09cc6b2
- Forcibly use the system libtool to ensure that we remove any RPATH hacks.
09cc6b2
f319952
* Sun Jan 28 2007 Peter Gordon <peter@thecodergeek.com> - 0.11-5
f319952
- Fix installed pkgconfig file: Strip everything from Libs except for
f319952
  '-ltorrent', as its [libtorrent's] DSO will ensure proper linking to other
f319952
  needed libraries such as zlib and boost_thread. (Thanks to Michael Schwendt
f319952
  and Mamoru Tasaka; bug #221372)
f319952
d215b49
* Sat Jan 27 2007 Peter Gordon <peter@thecodergeek.com> - 0.11-4
d215b49
- Clarify potential licensing issues in the -devel subpackage:
d215b49
  + COPYING.zlib
d215b49
  + COPYING.Boost
d215b49
- Add my name in the Fedora-specific documentation (README-renames.Fedora) and
d215b49
  fix some spacing issues in it.
d215b49
- Strip the @ZLIB@ (and thus, the extra '-lz' link option) from the installed
d215b49
  pkgconfig file, as that is only useful when building a statically-linked
d215b49
  libtorrent binary. 
a5f2397
- Fix conflict: The -devel subpackage should conflict with the -devel
a5f2397
  subpackage of libtorrent, not the main package.
a5f2397
- Preserve timestamps in %%install.
d215b49
d215b49
* Wed Jan 17 2007 Peter Gordon <peter@thecodergeek.com> - 0.11-3
d215b49
- Fix License (GPL -> BSD)
d215b49
- Don't package RST (docs sources) files.
d215b49
- Only make the -devel subpackage conflict with libtorrent-devel.
d215b49
- Rename some of the examples more appropriately; and add the
d215b49
  README-renames.Fedora file to %%doc which explains this.
d215b49
d215b49
* Fri Jan 05 2007 Peter Gordon <peter@thecodergeek.com> - 0.11-2
d215b49
- Add Requires: pkgconfig to the -devel subpackage since it installs a .pc
d215b49
  file. 
d215b49
d215b49
* Wed Jan 03 2007 Peter Gordon <peter@thecodergeek.com> - 0.11-1
d215b49
- Initial packaging for Fedora Extras