d215b49
Name:		rb_libtorrent
e8448fe
Version:	0.12.1
e8448fe
Release:	1%{?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
09cc6b2
Source0:	http://www.libtorrent.org/libtorrent-%{version}.tar.gz
d215b49
Source1:	%{name}-README-renames.Fedora
d215b49
Source2:	%{name}-COPYING.Boost
d215b49
Source3:	%{name}-COPYING.zlib
d215b49
e8448fe
Patch0: 	%{name}-gcc43.patch
b0cd9d6
d215b49
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
d215b49
d215b49
BuildRequires:	boost-devel
d215b49
BuildRequires:	zlib-devel
09cc6b2
BuildRequires:	libtool
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
02269b3
License:	BSD and zlib/libpng License and Boost Software License
d215b49
Requires:	%{name} = %{version}-%{release}
d215b49
Requires:	pkgconfig
a5f2397
## Same pkgconfig file, and unsuffixed shared library symlink. :(
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
09cc6b2
%package	examples
09cc6b2
Summary:	Example clients using %{name}
09cc6b2
Group:		Applications/Internet
09cc6b2
License:	BSD
09cc6b2
Requires:	%{name} = %{version}-%{release}
09cc6b2
09cc6b2
%description	examples
09cc6b2
The %{name}-examples package contains example clients which intend to
09cc6b2
show how to make use of its various features. (Due to potential
09cc6b2
namespace conflicts, a couple of the examples had to be renamed. See the
09cc6b2
included documentation for more details.)
09cc6b2
09cc6b2
d215b49
%prep
d215b49
%setup -q -n "libtorrent-%{version}"
e8448fe
%patch0 -p0 -b .gcc43
d215b49
## Some of the sources and docs are executable, which makes rpmlint against
d215b49
## the resulting -debuginfo and -devel packages, respectively, quite angry. :]
d215b49
find src/ docs/ -type f -exec chmod a-x '{}' \;
d215b49
find . -type f -regex '.*\.[hc]pp' -exec chmod a-x '{}' \;
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
f319952
## Fix the installed pkgconfig file: we don't need linkage that the
09cc6b2
## libtorrent DSO already ensures. 
f319952
sed -i -e 's/^Libs:.*$/Libs: -L${libdir} -ltorrent/' libtorrent.pc.in 
d215b49
d215b49
d215b49
%build
7f5c666
%configure --disable-static --enable-examples --with-zlib=system	\
7f5c666
	--with-boost-date-time=boost_date_time-mt 			\
7f5c666
	--with-boost-filesystem=boost_filesystem-mt			\
7f5c666
	--with-boost-thread=boost_thread-mt				\
7f5c666
	--with-boost-regex=boost_regex-mt				\
7f5c666
	--with-boost-program_options=boost_program_options-mt
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
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. 
d215b49
rename client torrent_client %{buildroot}%{_bindir}/*
09cc6b2
install -p -m 0644 %{SOURCE1} ./README-renames.Fedora 
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
e8448fe
%{_libdir}/libtorrent-%{version}.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
d215b49
%files devel
d215b49
%defattr(-,root,root,-)
d215b49
%doc COPYING.Boost COPYING.BSD COPYING.zlib docs/ 
d215b49
%{_libdir}/pkgconfig/libtorrent.pc
d215b49
%{_includedir}/libtorrent/
d215b49
%{_libdir}/libtorrent.so
d215b49
09cc6b2
%files examples
09cc6b2
%doc COPYING README-renames.Fedora
09cc6b2
%{_bindir}/*torrent*
09cc6b2
d215b49
d215b49
%changelog
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