2008-06-18 Albert Lee <[email protected]>
authortrisk
Wed, 18 Jun 2008 20:12:36 +0000
changeset 1210 ab05acbf6dd4
parent 1209 007521a9cc42
child 1211 f155ce621e00
2008-06-18 Albert Lee <[email protected]> * SFElibtorrent-gpp.spec: Deleted, only exists in base-spec form * SFErtorrent.spec: Use static Rakshasa libtorrent instead of depending on SFElibtorrent-gpp * SFEsongbird.spec: Merge with alfred's SFEsongbird-06.spec (yay 0.6) * base-specs/rlibtorrent.spec: Renamed from libtorrent.spec * patches/rlibtorrent-01-madvise.diff: Renamed from libtorrent-01-madvise.diff * patches/rlibtorrent-02-event-ports.diff: Renamed from libtorrent-02-event-ports.diff * patches/songbird-01-menu-item.diff: Add menu entry * patches/songbird-02-taglib.diff: TagLib Studio compat from alfred
ChangeLog
SFElibtorrent-gpp.spec
SFErtorrent.spec
SFEsongbird.spec
base-specs/rlibtorrent.spec
base-specs/rtorrent.spec
patches/libtorrent-01-madvise.diff
patches/libtorrent-02-event-ports.diff
patches/rlibtorrent-01-madvise.diff
patches/rlibtorrent-02-event-ports.diff
patches/songbird-01-menu-item.diff
patches/songbird-02-taglib.diff
--- a/ChangeLog	Wed Jun 18 11:36:31 2008 +0000
+++ b/ChangeLog	Wed Jun 18 20:12:36 2008 +0000
@@ -1,3 +1,17 @@
+2008-06-18  Albert Lee <[email protected]>
+
+	* SFElibtorrent-gpp.spec: Deleted, only exists in base-spec form
+	* SFErtorrent.spec: Use static Rakshasa libtorrent instead of depending
+	  on SFElibtorrent-gpp
+	* SFEsongbird.spec: Merge with alfred's SFEsongbird-06.spec (yay 0.6)
+	* base-specs/rlibtorrent.spec: Renamed from libtorrent.spec
+	* patches/rlibtorrent-01-madvise.diff: Renamed from
+	  libtorrent-01-madvise.diff
+	* patches/rlibtorrent-02-event-ports.diff: Renamed from
+	  libtorrent-02-event-ports.diff
+	* patches/songbird-01-menu-item.diff: Add menu entry
+	* patches/songbird-02-taglib.diff: TagLib Studio compat from alfred
+
 2008-06-18  Damien Carbery <[email protected]>
 
 	* SFEperl-soap-lite.spec: Added. Provides multiple modules e.g.
--- a/SFElibtorrent-gpp.spec	Wed Jun 18 11:36:31 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-#
-# spec file for package SFElibtorrent-gpp
-#
-# includes module(s): libtorrent
-#
-%include Solaris.inc
-
-%define cc_is_gcc 1
-%define _gpp /usr/sfw/bin/g++
-%include base.inc
-
-%use libtorrent = libtorrent.spec
-
-Name:		SFElibtorrent-gpp
-Summary:	%{libtorrent.summary}
-Version:	%{libtorrent.version}
-SUNW_BaseDir:	%{_basedir}
-BuildRoot:	%{_tmppath}/%{name}-%{version}-build
-%include default-depend.inc
-BuildRequires:  SFEsigcpp-gpp-devel
-Requires:  SFEsigcpp-gpp
-
-%package devel
-Summary:         %{summary} - development files
-SUNW_BaseDir:    %{_basedir}
-%include default-depend.inc
-Requires: %name
-
-%prep
-rm -rf %name-%version
-mkdir %name-%version
-
-mkdir %name-%version/%{base_arch}
-%libtorrent.prep -d %name-%version/%{base_arch}
-
-%build
-export CC=/usr/sfw/bin/gcc
-export CXX=/usr/sfw/bin/g++
-export CXXFLAGS="%{gcc_cxx_optflags}"
-export LDFLAGS="%_ldflags -L/usr/gnu/lib -R/usr/gnu/lib -R%{_cxx_libdir}"
-export PKG_CONFIG_PATH="%{_cxx_libdir}/pkgconfig"
-%libtorrent.build -d %name-%version/%{base_arch}
-
-%install
-rm -rf $RPM_BUILD_ROOT
-%libtorrent.install -d %name-%version/%{base_arch}
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%files
-%defattr (-, root, bin)
-%dir %attr (0755, root, bin) %{_cxx_libdir}
-%{_cxx_libdir}/lib*.so*
-
-%files devel
-%defattr (-, root, bin)
-%{_includedir}
-%dir %attr (0755, root, bin) %{_cxx_libdir}
-%dir %attr (0755, root, other) %{_cxx_libdir}/pkgconfig
-%{_cxx_libdir}/pkgconfig/*
-
-%changelog
-* Sat May 24 2008 - [email protected].
-- Link correct libsigc++ at runtime
-* Fri May  9 2008 - [email protected]
-- Initial version
--- a/SFErtorrent.spec	Wed Jun 18 11:36:31 2008 +0000
+++ b/SFErtorrent.spec	Wed Jun 18 20:12:36 2008 +0000
@@ -10,6 +10,8 @@
 %include base.inc
 
 %use rtorrent = rtorrent.spec
+%use rlibtorrent = rlibtorrent.spec
+
 
 Name:		SFErtorrent
 Summary:	%{rtorrent.summary}
@@ -18,9 +20,7 @@
 BuildRoot:	%{_tmppath}/%{name}-%{version}-build
 %include default-depend.inc
 Requires: SFEsigcpp-gpp
-Requires: SFElibtorrent-gpp
 BuildRequires: SFEsigcpp-gpp-devel
-BuildRequires: SFElibtorrent-gpp-devel
 Requires: SFExmlrpc-c-gpp
 BuildRequires: SFExmlrpc-c-gpp-devel
 Requires: SUNWcurl
@@ -32,14 +32,17 @@
 mkdir %name-%version
 
 mkdir %name-%version/%{base_arch}
+%rlibtorrent.prep -d %name-%version/%{base_arch}
 %rtorrent.prep -d %name-%version/%{base_arch}
 
 %build
+LIBTORRENT_ROOT=%{_builddir}/%name-%version/%{base_arch}/%{rlibtorrent.name}-%{rlibtorrent.version}
 export CC=/usr/sfw/bin/gcc
 export CXX=/usr/sfw/bin/g++
-export LDFLAGS="%_ldflags -L/usr/gnu/lib -R/usr/gnu/lib -R%{_cxx_libdir}"
-export CXXFLAGS="%{gcc_cxx_optflags} -I/usr/gnu/include -I/usr/gnu/include/ncurses"
-export PKG_CONFIG_PATH="%{_cxx_libdir}/pkgconfig"
+export CXXFLAGS="%{gcc_cxx_optflags} -I/usr/gnu/include -I/usr/gnu/include/ncurses -I$LIBTORRENT_ROOT"/src
+export LDFLAGS="%_ldflags -L/usr/gnu/lib -R/usr/gnu/lib -R%{_cxx_libdir} -L$LIBTORRENT_ROOT/src/.libs"
+export PKG_CONFIG_PATH="%{_cxx_libdir}/pkgconfig:$LIBTORRENT_ROOT"
+%rlibtorrent.build -d %name-%version/%{base_arch}
 %rtorrent.build -d %name-%version/%{base_arch}
 
 %install
--- a/SFEsongbird.spec	Wed Jun 18 11:36:31 2008 +0000
+++ b/SFEsongbird.spec	Wed Jun 18 20:12:36 2008 +0000
@@ -30,17 +30,19 @@
 
 Name:          SFEsongbird
 Summary:       The desktop media player mashed-up with the Web.
-Version:       0.5
-Source:        http://releases.mozilla.com/sun/songbird-%{version}-solaris-patched.tar.bz2
+Version:       0.6
+Source:        http://releases.mozilla.com/sun/songbird-%{version}-source.tar.bz2
 %if %without_vendor_binary
-Source1:       http://releases.mozilla.com/sun/xulrunner-20080211-for-songbird-05.tar.bz2
+Source1:       http://releases.mozilla.com/sun/xulrunner-3.0rc1-source-patched-for-songbird.tar.bz2
 %else
 %if %with_debug
-Source1:       http://releases.mozilla.com/sun/solaris-vendor-binaries/songbird-vendor-binary-solaris-%{arch}-20080211-for-05-debug.tar.bz2
+Source1:       http://releases.mozilla.com/sun/solaris-vendor-binaries/songbird-vendor-binary-solaris-%{arch}-firefox30rc1tag-debug.tar.bz2
 %else
-Source1:       http://releases.mozilla.com/sun/solaris-vendor-binaries/songbird-vendor-binary-solaris-%{arch}-20080211-for-05.tar.bz2
+Source1:       http://releases.mozilla.com/sun/solaris-vendor-binaries/songbird-vendor-binary-solaris-%{arch}-firefox30rc1tag.tar.bz2
 %endif
 %endif
+Patch1:        songbird-01-menu-item.diff
+Patch2:        songbird-02-taglib.diff
 URL:           http://www.songbirdnest.com/
 SUNW_BaseDir:  %{_basedir}
 BuildRoot:     %{_tmppath}/%{name}-%{version}-build
@@ -55,9 +57,12 @@
 
 %prep
 %setup -q -n %name-%version -c -a1
+cd songbird%version
+%patch1 -p1
+%patch2 -p0
 %if %without_vendor_binary
 %else
-mv solaris-%arch songbird%version/dependencies/
+mv ../solaris-%{arch} dependencies/
 %endif
 
 %build
@@ -71,14 +76,12 @@
 export CXX="${CXX} -norunpath"
 %endif
 
-%if %without_vendor_binary
 # Build the vendor libraries(zlib, taglib)
 cd songbird%version/dependencies/vendor/zlib
 ./songbird_zlib_make.sh
 cd ../taglib/
 ./songbird_taglib_make.sh
-cd ../../../../mozilla
-%endif
+cd ../../../../
 
 export LDFLAGS="-z ignore -L%{_libdir} -L/usr/sfw/lib -R'\$\$ORIGIN:\$\$ORIGIN/..' -R%{_libdir}/mps"
 export CFLAGS="-xlibmil"
@@ -95,6 +98,7 @@
 %endif
 
 %if %without_vendor_binary
+cd mozilla
 # Build XULRunner
 cat << "EOF" > .mozconfig
 MOZILLA_OFFICIAL=1
@@ -120,6 +124,7 @@
 ac_add_options --disable-auto-deps
 ac_add_options --disable-crashreporter
 ac_add_options --disable-javaxpcom
+ac_add_options --disable-updater
 ac_add_options --disable-installer
 ac_add_options --enable-extensions=default,inspector,venkman
 ac_add_options --disable-dbus
@@ -136,12 +141,12 @@
 # Package XULRunner
 cd ../songbird%version
 
-mkdir -p dependencies/solaris-%arch/mozilla/%build_type
-mkdir -p dependencies/solaris-%arch/xulrunner/%build_type
+mkdir -p dependencies/solaris-i386/mozilla/%build_type
+mkdir -p dependencies/solaris-i386/xulrunner/%build_type
 
 cd tools/scripts
-./make-mozilla-sdk.sh ../../../mozilla ../../../mozilla/compiled/xulrunner ../../dependencies/solaris-%arch/mozilla/%build_type
-./make-xulrunner-tarball.sh ../../../mozilla/compiled/xulrunner/dist/bin ../../dependencies/solaris-%arch/xulrunner/%build_type xulrunner.tar.gz
+./make-mozilla-sdk.sh ../../../mozilla ../../../mozilla/compiled/xulrunner ../../dependencies/solaris-i386/mozilla/%build_type
+./make-xulrunner-tarball.sh ../../../mozilla/compiled/xulrunner/dist/bin ../../dependencies/solaris-i386/xulrunner/%build_type xulrunner.tar.gz
 
 cd ../../
 %else
@@ -166,16 +171,17 @@
 %endif
 
 %install
-/bin/rm -rf $RPM_BUILD_ROOT
+rm -rf $RPM_BUILD_ROOT
 
 cd %{_builddir}/%name-%version/songbird%version/compiled
-mkdir -p $RPM_BUILD_ROOT/usr/lib
-mkdir -p $RPM_BUILD_ROOT/usr/bin
-cp -R dist $RPM_BUILD_ROOT/usr/lib/songbird-%version
-touch $RPM_BUILD_ROOT/usr/lib/songbird-%version/extensions/[email protected]/chrome.manifest
-touch $RPM_BUILD_ROOT/usr/lib/songbird-%version/extensions/[email protected]/chrome.manifest
-cd $RPM_BUILD_ROOT/usr/bin
-ln -s ../lib/songbird-%version/songbird .
+mkdir -p $RPM_BUILD_ROOT%{_libdir}
+mkdir -p $RPM_BUILD_ROOT%{_bindir}
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
+cp -R dist $RPM_BUILD_ROOT%{_libdir}/songbird-%version
+cp ../app/branding/icon64.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/songbird.png
+cp ../app/branding/songbird.desktop $RPM_BUILD_ROOT%{_datadir}/applications
+ln -s ../lib/songbird-%version/songbird $RPM_BUILD_ROOT%{_bindir}/songbird
 
 %{?pkgbuild_postprocess: %pkgbuild_postprocess -v -c "%{version}:%{jds_version}:%{name}:$RPM_ARCH:%(date +%%Y-%%m-%%d):%{support_level}" $RPM_BUILD_ROOT}
 
@@ -188,8 +194,15 @@
 %{_bindir}/songbird
 %dir %attr (0755, root, bin) %{_libdir}
 %{_libdir}/songbird-%{version}
+%dir %attr (0755, root, sys) %{_datadir}
+%dir %attr (0755, root, other) %{_datadir}/applications
+%{_datadir}/applications/songbird.desktop
+%dir %attr (0755, root, other) %{_datadir}/pixmaps
+%{_datadir}/pixmaps/songbird.png
 
 %changelog
+* Wed Jun 18 2008 - [email protected]
+- Merge with alfred's SFEsongbird-06.spec (yay 0.6)
 * Fri May 09 2008 - [email protected]
 - cmake is needed for building taglib
 - gawk is needed for building Songbird
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/base-specs/rlibtorrent.spec	Wed Jun 18 20:12:36 2008 +0000
@@ -0,0 +1,57 @@
+#
+# spec file for package rlibtorrent
+#
+# includes module(s): libtorrent
+#
+
+Name:		libtorrent
+Summary:	BitTorrent library written in C++
+Version:	0.12.2
+Source:		http://libtorrent.rakshasa.no/downloads/libtorrent-%{version}.tar.gz
+Patch1:         rlibtorrent-01-madvise.diff
+Patch2:         rlibtorrent-02-event-ports.diff
+BuildRoot:	%{_tmppath}/%{name}-%{version}-build
+
+%prep
+%setup -q -n %{name}-%{version}
+%patch1 -p1
+%patch2 -p1
+
+%build
+CPUS=`/usr/sbin/psrinfo | grep on-line | wc -l | tr -d ' '`
+if test "x$CPUS" = "x" -o $CPUS = 0; then
+    CPUS=1
+fi
+
+aclocal -I ./scripts
+autoheader
+libtoolize --automake --copy --force
+automake
+autoconf
+./configure --prefix=%{_prefix}		\
+	    --bindir=%{_bindir}		\
+	    --mandir=%{_mandir}		\
+            --libdir=%{_cxx_libdir}     \
+            --libexecdir=%{_libexecdir}	\
+            --sysconfdir=%{_sysconfdir}	\
+            --disable-shared		\
+	    --enable-static		\
+	    --with-ports
+
+make -j$CPUS
+
+%install
+make install DESTDIR=$RPM_BUILD_ROOT
+rm $RPM_BUILD_ROOT%{_cxx_libdir}/lib*.*a
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%changelog
+* Mon Jun 16 2008 - [email protected]
+- Rename to rlibtorrent
+- Make static library for SFErtorrent
+* Sat May 24 2008 - [email protected].
+- Enable ports, add patch2
+* Fri May  9 2008 - [email protected]
+- Initial base spec file
--- a/base-specs/rtorrent.spec	Wed Jun 18 11:36:31 2008 +0000
+++ b/base-specs/rtorrent.spec	Wed Jun 18 20:12:36 2008 +0000
@@ -10,12 +10,14 @@
 Source:		http://libtorrent.rakshasa.no/downloads/rtorrent-%{version}.tar.gz
 Patch1:         rtorrent-01-solaris.diff
 Patch2:         rtorrent-02-event-ports.diff
+Patch3:         rtorrent-03-curl-event.diff
 BuildRoot:	%{_tmppath}/%{name}-%{version}-build
 
 %prep
 %setup -q -n %{name}-%{version}
-%patch1 -p1 -b .orig
+%patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %build
 CPUS=`/usr/sbin/psrinfo | grep on-line | wc -l | tr -d ' '`
@@ -47,6 +49,8 @@
 rm -rf $RPM_BUILD_ROOT
 
 %changelog
+* Tue Jun 10 2008 - [email protected]
+- Add patch3 for scalable curl events
 * Sat May 24 2008 - [email protected]
 - Enable XML-RPC, add patch2
 * Fri May  9 2008 - [email protected]
--- a/patches/libtorrent-01-madvise.diff	Wed Jun 18 11:36:31 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-Index: libtorrent/src/data/memory_chunk.cc
-===================================================================
---- libtorrent/src/data/memory_chunk.cc	(revision 1060)
-+++ libtorrent/src/data/memory_chunk.cc	(working copy)
-@@ -41,6 +41,14 @@
- #include <unistd.h>
- #include <sys/types.h>
- #include <sys/mman.h>
-+#if defined(__sun) && defined(__SVR4)
-+/* Ugly hack to make this compile on Solaris. See
-+ * http://www.opensolaris.org/jive/thread.jspa?threadID=21035&tstart=0
-+ */
-+extern "C" {
-+extern int madvise(caddr_t, size_t, int);
-+}
-+#endif
- #include <rak/error_number.h>
- 
- #include "torrent/exceptions.h"
--- a/patches/libtorrent-02-event-ports.diff	Wed Jun 18 11:36:31 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,514 +0,0 @@
-diff -x configure -x aclocal.m4 -ru libtorrent-0.11.9/config.h.in libtorrent-0.11.9-new/config.h.in
---- libtorrent-0.11.9/config.h.in	2007-10-25 09:51:00.000000000 +0000
-+++ libtorrent-0.11.9-new/config.h.in	2008-01-13 17:17:20.030864435 +0000
-@@ -141,6 +141,9 @@
- /* Using OpenSSL's SHA1 implementation. */
- #undef USE_OPENSSL_SHA
- 
-+/* Enable ports. */
-+#undef USE_PORTS
-+
- /* posix_fallocate supported. */
- #undef USE_POSIX_FALLOCATE
- 
-diff -x configure -x aclocal.m4 -ru libtorrent-0.11.9/configure.ac libtorrent-0.11.9-new/configure.ac
---- libtorrent-0.11.9/configure.ac	2007-10-25 09:48:32.000000000 +0000
-+++ libtorrent-0.11.9-new/configure.ac	2008-01-13 17:13:30.892756466 +0000
-@@ -43,6 +43,7 @@
- 
- dnl TORRENT_WITH_XFS
- TORRENT_WITH_KQUEUE
-+TORRENT_WITH_PORTS
- TORRENT_WITHOUT_EPOLL
- TORRENT_WITH_POSIX_FALLOCATE
- TORRENT_WITH_ADDRESS_SPACE
-diff -x configure -x aclocal.m4 -ru libtorrent-0.11.9/scripts/checks.m4 libtorrent-0.11.9-new/scripts/checks.m4
---- libtorrent-0.11.9/scripts/checks.m4	2007-10-09 01:41:07.000000000 +0000
-+++ libtorrent-0.11.9-new/scripts/checks.m4	2008-01-13 17:04:39.692325909 +0000
-@@ -85,6 +85,15 @@
-     ])
- ])
- 
-+AC_DEFUN([TORRENT_WITH_PORTS], [
-+  AC_ARG_WITH(ports,
-+    [  --with-ports            enable Solaris ports. [[default=no]]],
-+    [
-+        if test "$withval" = "yes"; then
-+            AC_DEFINE(USE_PORTS, 1, Enable ports.)
-+        fi
-+    ])
-+])
- 
- AC_DEFUN([TORRENT_WITHOUT_VARIABLE_FDSET], [
-   AC_ARG_WITH(variable-fdset,
-diff -x configure -x aclocal.m4 -ru libtorrent-0.11.9/src/data/memory_chunk.cc libtorrent-0.11.9-new/src/data/memory_chunk.cc
---- libtorrent-0.11.9/src/data/memory_chunk.cc	2007-07-19 21:23:06.000000000 +0000
-+++ libtorrent-0.11.9-new/src/data/memory_chunk.cc	2008-01-13 15:25:19.923524858 +0000
-@@ -121,7 +121,7 @@
- #if USE_MADVISE
-   align_pair(&offset, &length);
- 
--  if (madvise(m_ptr + offset, length, advice) == 0)
-+  if (::madvise(m_ptr + offset, length, advice) == 0)
-     return true;
- 
-   else if (errno == EINVAL || (errno == ENOMEM && advice != advice_willneed) || errno == EBADF)
-diff -x configure -x aclocal.m4 -ru libtorrent-0.11.9/src/torrent/Makefile.am libtorrent-0.11.9-new/src/torrent/Makefile.am
---- libtorrent-0.11.9/src/torrent/Makefile.am	2007-02-02 11:09:56.000000000 +0000
-+++ libtorrent-0.11.9-new/src/torrent/Makefile.am	2008-01-13 17:51:02.471766611 +0000
-@@ -33,6 +33,8 @@
- 	poll_epoll.h \
- 	poll_kqueue.h \
- 	poll_kqueue.cc \
-+	poll_ports.cc \
-+	poll_ports.h \
- 	poll_select.h \
- 	poll_select.cc \
- 	rate.cc \
-@@ -65,6 +67,7 @@
- 	path.h \
- 	poll.h \
- 	poll_epoll.h \
-+	poll_ports.h \
- 	poll_kqueue.h \
- 	poll_select.h \
- 	rate.h \
-diff -urN libtorrent.orig/src/torrent/poll_ports.cc libtorrent/src/torrent/poll_ports.cc
---- libtorrent.orig/src/torrent/poll_ports.cc	1969-12-31 19:00:00.000000000 -0500
-+++ libtorrent/src/torrent/poll_ports.cc	2008-06-10 14:48:05.000000000 -0400
-@@ -0,0 +1,331 @@
-+// libTorrent - BitTorrent library
-+// Copyright (C) 2005-2007, Jari Sundell
-+//
-+// This program is free software; you can redistribute it and/or modify
-+// it under the terms of the GNU General Public License as published by
-+// the Free Software Foundation; either version 2 of the License, or
-+// (at your option) any later version.
-+// 
-+// This program is distributed in the hope that it will be useful,
-+// but WITHOUT ANY WARRANTY; without even the implied warranty of
-+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+// GNU General Public License for more details.
-+// 
-+// You should have received a copy of the GNU General Public License
-+// along with this program; if not, write to the Free Software
-+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+//
-+// In addition, as a special exception, the copyright holders give
-+// permission to link the code of portions of this program with the
-+// OpenSSL library under certain conditions as described in each
-+// individual source file, and distribute linked combinations
-+// including the two.
-+//
-+// You must obey the GNU General Public License in all respects for
-+// all of the code used other than OpenSSL.  If you modify file(s)
-+// with this exception, you may extend this exception to your version
-+// of the file(s), but you are not obligated to do so.  If you do not
-+// wish to do so, delete this exception statement from your version.
-+// If you delete this exception statement from all source files in the
-+// program, then also delete it here.
-+//
-+// Contact:  Jari Sundell <[email protected]>
-+//
-+//           Skomakerveien 33
-+//           3185 Skoppum, NORWAY
-+
-+#include "config.h"
-+
-+#include <cerrno>
-+#include <iostream>
-+
-+#include <unistd.h>
-+#include <torrent/exceptions.h>
-+#include <torrent/event.h>
-+
-+#include "poll_ports.h"
-+
-+#ifdef USE_PORTS
-+/*
-+ * We should use <poll.h> here, but it seems to conflict with the
-+ * <torrent/poll.h> header, so use <sys/poll.h> instead.  Since all
-+ * poll.h does is include sys/poll.h, this shouldn't cause any
-+ * problems.
-+ */
-+# include <sys/poll.h>
-+# include <port.h>
-+#endif
-+
-+namespace torrent {
-+
-+#ifdef USE_PORTS
-+
-+inline uint32_t
-+PollPorts::event_mask(Event* e) {
-+  return m_table[e->file_descriptor()];
-+}
-+
-+inline void
-+PollPorts::set_event_mask(Event* e, uint32_t m) {
-+  m_table[e->file_descriptor()] = m;
-+}
-+
-+inline void
-+PollPorts::modify(Event* event, uint32_t mask) {
-+  if (event_mask(event) == mask)
-+    return;
-+
-+  port_dissociate(m_fd, PORT_SOURCE_FD, event->file_descriptor());
-+
-+  set_event_mask(event, mask);
-+
-+  if (mask == 0)
-+    return;
-+
-+  if (port_associate(m_fd, PORT_SOURCE_FD, event->file_descriptor(),
-+		  mask, event) == -1)
-+	  throw internal_error("PollPorts::modify(...) port_associate failed");
-+}
-+
-+PollPorts*
-+PollPorts::create(int maxOpenSockets) {
-+  int fd = port_create();
-+
-+  if (fd == -1)
-+    return NULL;
-+
-+  return new PollPorts(fd, 1024, maxOpenSockets);
-+}
-+
-+PollPorts::PollPorts(int fd, int maxEvents, int maxOpenSockets) :
-+  m_fd(fd),
-+  m_maxEvents(maxEvents),
-+  m_waitingEvents(0),
-+  m_events(new port_event_t[maxEvents]) {
-+
-+  m_table.resize(maxOpenSockets); 
-+}
-+
-+PollPorts::~PollPorts() {
-+  m_table.clear();
-+
-+  ::close(m_fd);
-+}
-+
-+int
-+PollPorts::poll(int msec) {
-+  timespec_t timeout;
-+  timeout.tv_sec = msec / 1000;
-+  timeout.tv_nsec = (msec * 1000000L) % 1000000000L;
-+
-+  uint_t nfds = 1;
-+
-+  int ret = port_getn(m_fd, m_events, m_maxEvents, &nfds, &timeout);
-+
-+  if (ret == -1 && errno != ETIME) {
-+	  std::cerr << "error from ports, maxevents="<<m_maxEvents<<", nfds="<<nfds<<" msec="<<msec<<"\n";
-+    return -1;
-+  }
-+
-+  return m_waitingEvents = nfds;
-+}
-+
-+// We check m_table to make sure the Event is still listening to the
-+// event, so it is safe to remove Event's while in working.
-+//
-+// TODO: Do we want to guarantee if the Event has been removed from
-+// some event but not closed, it won't call that event? Think so...
-+void
-+PollPorts::perform() {
-+  for (port_event_t *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr) {
-+
-+    // Each branch must check for data.ptr != NULL to allow the socket
-+    // to remove itself between the calls.
-+    //
-+    // TODO: Make it so that it checks that read/write is wanted, that
-+    // it wasn't removed from one of them but not closed.
-+
-+    if (itr->portev_user == NULL)
-+      continue;
-+
-+    if (itr->portev_events & POLLERR 
-+        && event_mask((Event*)itr->portev_user) & POLLERR)
-+      ((Event*)itr->portev_user)->event_error();
-+
-+    if (itr->portev_user == NULL)
-+      continue;
-+
-+    if (itr->portev_events & POLLIN
-+        && event_mask((Event*)itr->portev_user) & POLLIN)
-+      ((Event*)itr->portev_user)->event_read();
-+
-+    if (itr->portev_user == NULL)
-+      continue;
-+
-+    if (itr->portev_events & POLLOUT
-+        && event_mask((Event*)itr->portev_user) & POLLOUT)
-+      ((Event*)itr->portev_user)->event_write();
-+
-+    if (itr->portev_user == NULL)
-+      continue;
-+
-+    // Since port events are one-shot, re-add the fd after we process
-+    // its events.
-+
-+    port_associate(m_fd, PORT_SOURCE_FD, itr->portev_object,
-+        event_mask((Event *)itr->portev_user), itr->portev_user);
-+  }
-+
-+  m_waitingEvents = 0;
-+}
-+
-+uint32_t
-+PollPorts::open_max() const {
-+  return m_table.size();
-+}
-+
-+void
-+PollPorts::open(Event* event) {
-+  if (event_mask(event) != 0)
-+    throw internal_error("PollPorts::open(...) called but the file descriptor is active");
-+}
-+
-+void
-+PollPorts::close(Event* event) {
-+  if (event_mask(event) != 0)
-+    throw internal_error("PollPorts::close(...) called but the file descriptor is active");
-+
-+  for (port_event_t *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr)
-+    if (itr->portev_user == event)
-+      itr->portev_user = NULL;
-+}
-+
-+bool
-+PollPorts::in_read(Event* event) {
-+  return event_mask(event) & POLLIN;
-+}
-+
-+bool
-+PollPorts::in_write(Event* event) {
-+  return event_mask(event) & POLLOUT;
-+}
-+
-+bool
-+PollPorts::in_error(Event* event) {
-+  return event_mask(event) & POLLERR;
-+}
-+
-+void
-+PollPorts::insert_read(Event* event) {
-+  modify(event, event_mask(event) | POLLIN);
-+}
-+
-+void
-+PollPorts::insert_write(Event* event) {
-+  modify(event, event_mask(event) | POLLOUT);
-+}
-+
-+void
-+PollPorts::insert_error(Event* event) {
-+  modify(event, event_mask(event) | POLLERR);
-+}
-+
-+void
-+PollPorts::remove_read(Event* event) {
-+  uint32_t mask = event_mask(event) & ~POLLIN;
-+  modify(event, mask);
-+}
-+
-+void
-+PollPorts::remove_write(Event* event) {
-+  uint32_t mask = event_mask(event) & ~POLLOUT;
-+
-+  modify(event, mask);
-+}
-+
-+void
-+PollPorts::remove_error(Event* event) {
-+  uint32_t mask = event_mask(event) & ~POLLERR;
-+
-+  modify(event, mask);
-+}
-+
-+#else // USE_PORTS
-+
-+PollPorts*
-+PollPorts::create(int maxOpenSockets) {
-+  return NULL;
-+}
-+
-+PollPorts::~PollPorts() {
-+}
-+
-+int
-+PollPorts::poll(int msec) {
-+  throw internal_error("An PollPorts function was called, but it is disabled.");
-+}
-+
-+void
-+PollPorts::perform() {
-+  throw internal_error("An PollPorts function was called, but it is disabled.");
-+}
-+
-+uint32_t
-+PollPorts::open_max() const {
-+  throw internal_error("An PollPorts function was called, but it is disabled.");
-+}
-+
-+void
-+PollPorts::open(torrent::Event* event) {
-+}
-+
-+void
-+PollPorts::close(torrent::Event* event) {
-+}
-+
-+bool
-+PollPorts::in_read(torrent::Event* event) {
-+  throw internal_error("An PollPorts function was called, but it is disabled.");
-+}
-+
-+bool
-+PollPorts::in_write(torrent::Event* event) {
-+  throw internal_error("An PollPorts function was called, but it is disabled.");
-+}
-+
-+bool
-+PollPorts::in_error(torrent::Event* event) {
-+  throw internal_error("An PollPorts function was called, but it is disabled.");
-+}
-+
-+void
-+PollPorts::insert_read(torrent::Event* event) {
-+}
-+
-+void
-+PollPorts::insert_write(torrent::Event* event) {
-+}
-+
-+void
-+PollPorts::insert_error(torrent::Event* event) {
-+}
-+
-+void
-+PollPorts::remove_read(torrent::Event* event) {
-+}
-+
-+void
-+PollPorts::remove_write(torrent::Event* event) {
-+}
-+
-+void
-+PollPorts::remove_error(torrent::Event* event) {
-+}
-+
-+PollPorts::PollPorts(int fd, int maxEvents, int maxOpenSockets) {
-+  throw internal_error("An PollPorts function was called, but it is disabled.");
-+}
-+
-+#endif // USE_PORTS
-+
-+}
-diff -urN libtorrent.orig/src/torrent/poll_ports.h libtorrent/src/torrent/poll_ports.h
---- libtorrent.orig/src/torrent/poll_ports.h	1969-12-31 19:00:00.000000000 -0500
-+++ libtorrent/src/torrent/poll_ports.h	2008-05-12 00:42:15.000000000 -0400
-@@ -0,0 +1,100 @@
-+// libTorrent - BitTorrent library
-+// Copyright (C) 2005-2007, Jari Sundell
-+//
-+// This program is free software; you can redistribute it and/or modify
-+// it under the terms of the GNU General Public License as published by
-+// the Free Software Foundation; either version 2 of the License, or
-+// (at your option) any later version.
-+// 
-+// This program is distributed in the hope that it will be useful,
-+// but WITHOUT ANY WARRANTY; without even the implied warranty of
-+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+// GNU General Public License for more details.
-+// 
-+// You should have received a copy of the GNU General Public License
-+// along with this program; if not, write to the Free Software
-+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-+//
-+// In addition, as a special exception, the copyright holders give
-+// permission to link the code of portions of this program with the
-+// OpenSSL library under certain conditions as described in each
-+// individual source file, and distribute linked combinations
-+// including the two.
-+//
-+// You must obey the GNU General Public License in all respects for
-+// all of the code used other than OpenSSL.  If you modify file(s)
-+// with this exception, you may extend this exception to your version
-+// of the file(s), but you are not obligated to do so.  If you do not
-+// wish to do so, delete this exception statement from your version.
-+// If you delete this exception statement from all source files in the
-+// program, then also delete it here.
-+//
-+// Contact:  Jari Sundell <[email protected]>
-+//
-+//           Skomakerveien 33
-+//           3185 Skoppum, NORWAY
-+
-+#ifndef LIBTORRENT_TORRENT_POLL_PORTS_H
-+#define LIBTORRENT_TORRENT_POLL_PORTS_H
-+
-+#include <vector>
-+#include <torrent/poll.h>
-+
-+struct port_event;
-+
-+namespace torrent {
-+
-+class LIBTORRENT_EXPORT PollPorts : public torrent::Poll {
-+public:
-+  typedef std::vector<uint32_t> Table;
-+
-+  static PollPorts*   create(int maxOpenSockets);
-+  virtual ~PollPorts();
-+
-+  int                 poll(int msec);
-+  void                perform();
-+
-+  int                 file_descriptor() { return m_fd; }
-+
-+  virtual uint32_t    open_max() const;
-+
-+  // torrent::Event::get_fd() is guaranteed to be valid and remain constant
-+  // from open(...) is called to close(...) returns.
-+  virtual void        open(torrent::Event* event);
-+  virtual void        close(torrent::Event* event);
-+
-+  // Functions for checking whetever the torrent::Event is listening to r/w/e?
-+  virtual bool        in_read(torrent::Event* event);
-+  virtual bool        in_write(torrent::Event* event);
-+  virtual bool        in_error(torrent::Event* event);
-+
-+  // These functions may be called on 'event's that might, or might
-+  // not, already be in the set.
-+  virtual void        insert_read(torrent::Event* event);
-+  virtual void        insert_write(torrent::Event* event);
-+  virtual void        insert_error(torrent::Event* event);
-+
-+  virtual void        remove_read(torrent::Event* event);
-+  virtual void        remove_write(torrent::Event* event);
-+  virtual void        remove_error(torrent::Event* event);
-+
-+private:
-+  PollPorts(int fd, int maxEvents, int maxOpenSockets);
-+
-+  inline uint32_t     event_mask(Event* e);
-+  inline void         set_event_mask(Event* e, uint32_t m);
-+
-+  inline void         modify(torrent::Event* event, uint32_t mask);
-+
-+  int                 m_fd;
-+
-+  int                 m_maxEvents;
-+  int                 m_waitingEvents;
-+
-+  Table               m_table;
-+  port_event*        m_events;
-+};
-+
-+}
-+
-+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/rlibtorrent-01-madvise.diff	Wed Jun 18 20:12:36 2008 +0000
@@ -0,0 +1,19 @@
+Index: libtorrent/src/data/memory_chunk.cc
+===================================================================
+--- libtorrent/src/data/memory_chunk.cc	(revision 1060)
++++ libtorrent/src/data/memory_chunk.cc	(working copy)
+@@ -41,6 +41,14 @@
+ #include <unistd.h>
+ #include <sys/types.h>
+ #include <sys/mman.h>
++#if defined(__sun) && defined(__SVR4)
++/* Ugly hack to make this compile on Solaris. See
++ * http://www.opensolaris.org/jive/thread.jspa?threadID=21035&tstart=0
++ */
++extern "C" {
++extern int madvise(caddr_t, size_t, int);
++}
++#endif
+ #include <rak/error_number.h>
+ 
+ #include "torrent/exceptions.h"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/rlibtorrent-02-event-ports.diff	Wed Jun 18 20:12:36 2008 +0000
@@ -0,0 +1,514 @@
+diff -x configure -x aclocal.m4 -ru libtorrent-0.11.9/config.h.in libtorrent-0.11.9-new/config.h.in
+--- libtorrent-0.11.9/config.h.in	2007-10-25 09:51:00.000000000 +0000
++++ libtorrent-0.11.9-new/config.h.in	2008-01-13 17:17:20.030864435 +0000
+@@ -141,6 +141,9 @@
+ /* Using OpenSSL's SHA1 implementation. */
+ #undef USE_OPENSSL_SHA
+ 
++/* Enable ports. */
++#undef USE_PORTS
++
+ /* posix_fallocate supported. */
+ #undef USE_POSIX_FALLOCATE
+ 
+diff -x configure -x aclocal.m4 -ru libtorrent-0.11.9/configure.ac libtorrent-0.11.9-new/configure.ac
+--- libtorrent-0.11.9/configure.ac	2007-10-25 09:48:32.000000000 +0000
++++ libtorrent-0.11.9-new/configure.ac	2008-01-13 17:13:30.892756466 +0000
+@@ -43,6 +43,7 @@
+ 
+ dnl TORRENT_WITH_XFS
+ TORRENT_WITH_KQUEUE
++TORRENT_WITH_PORTS
+ TORRENT_WITHOUT_EPOLL
+ TORRENT_WITH_POSIX_FALLOCATE
+ TORRENT_WITH_ADDRESS_SPACE
+diff -x configure -x aclocal.m4 -ru libtorrent-0.11.9/scripts/checks.m4 libtorrent-0.11.9-new/scripts/checks.m4
+--- libtorrent-0.11.9/scripts/checks.m4	2007-10-09 01:41:07.000000000 +0000
++++ libtorrent-0.11.9-new/scripts/checks.m4	2008-01-13 17:04:39.692325909 +0000
+@@ -85,6 +85,15 @@
+     ])
+ ])
+ 
++AC_DEFUN([TORRENT_WITH_PORTS], [
++  AC_ARG_WITH(ports,
++    [  --with-ports            enable Solaris ports. [[default=no]]],
++    [
++        if test "$withval" = "yes"; then
++            AC_DEFINE(USE_PORTS, 1, Enable ports.)
++        fi
++    ])
++])
+ 
+ AC_DEFUN([TORRENT_WITHOUT_VARIABLE_FDSET], [
+   AC_ARG_WITH(variable-fdset,
+diff -x configure -x aclocal.m4 -ru libtorrent-0.11.9/src/data/memory_chunk.cc libtorrent-0.11.9-new/src/data/memory_chunk.cc
+--- libtorrent-0.11.9/src/data/memory_chunk.cc	2007-07-19 21:23:06.000000000 +0000
++++ libtorrent-0.11.9-new/src/data/memory_chunk.cc	2008-01-13 15:25:19.923524858 +0000
+@@ -121,7 +121,7 @@
+ #if USE_MADVISE
+   align_pair(&offset, &length);
+ 
+-  if (madvise(m_ptr + offset, length, advice) == 0)
++  if (::madvise(m_ptr + offset, length, advice) == 0)
+     return true;
+ 
+   else if (errno == EINVAL || (errno == ENOMEM && advice != advice_willneed) || errno == EBADF)
+diff -x configure -x aclocal.m4 -ru libtorrent-0.11.9/src/torrent/Makefile.am libtorrent-0.11.9-new/src/torrent/Makefile.am
+--- libtorrent-0.11.9/src/torrent/Makefile.am	2007-02-02 11:09:56.000000000 +0000
++++ libtorrent-0.11.9-new/src/torrent/Makefile.am	2008-01-13 17:51:02.471766611 +0000
+@@ -33,6 +33,8 @@
+ 	poll_epoll.h \
+ 	poll_kqueue.h \
+ 	poll_kqueue.cc \
++	poll_ports.cc \
++	poll_ports.h \
+ 	poll_select.h \
+ 	poll_select.cc \
+ 	rate.cc \
+@@ -65,6 +67,7 @@
+ 	path.h \
+ 	poll.h \
+ 	poll_epoll.h \
++	poll_ports.h \
+ 	poll_kqueue.h \
+ 	poll_select.h \
+ 	rate.h \
+diff -urN libtorrent.orig/src/torrent/poll_ports.cc libtorrent/src/torrent/poll_ports.cc
+--- libtorrent.orig/src/torrent/poll_ports.cc	1969-12-31 19:00:00.000000000 -0500
++++ libtorrent/src/torrent/poll_ports.cc	2008-06-10 14:48:05.000000000 -0400
+@@ -0,0 +1,331 @@
++// libTorrent - BitTorrent library
++// Copyright (C) 2005-2007, Jari Sundell
++//
++// This program is free software; you can redistribute it and/or modify
++// it under the terms of the GNU General Public License as published by
++// the Free Software Foundation; either version 2 of the License, or
++// (at your option) any later version.
++// 
++// This program is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++// 
++// You should have received a copy of the GNU General Public License
++// along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++//
++// In addition, as a special exception, the copyright holders give
++// permission to link the code of portions of this program with the
++// OpenSSL library under certain conditions as described in each
++// individual source file, and distribute linked combinations
++// including the two.
++//
++// You must obey the GNU General Public License in all respects for
++// all of the code used other than OpenSSL.  If you modify file(s)
++// with this exception, you may extend this exception to your version
++// of the file(s), but you are not obligated to do so.  If you do not
++// wish to do so, delete this exception statement from your version.
++// If you delete this exception statement from all source files in the
++// program, then also delete it here.
++//
++// Contact:  Jari Sundell <[email protected]>
++//
++//           Skomakerveien 33
++//           3185 Skoppum, NORWAY
++
++#include "config.h"
++
++#include <cerrno>
++#include <iostream>
++
++#include <unistd.h>
++#include <torrent/exceptions.h>
++#include <torrent/event.h>
++
++#include "poll_ports.h"
++
++#ifdef USE_PORTS
++/*
++ * We should use <poll.h> here, but it seems to conflict with the
++ * <torrent/poll.h> header, so use <sys/poll.h> instead.  Since all
++ * poll.h does is include sys/poll.h, this shouldn't cause any
++ * problems.
++ */
++# include <sys/poll.h>
++# include <port.h>
++#endif
++
++namespace torrent {
++
++#ifdef USE_PORTS
++
++inline uint32_t
++PollPorts::event_mask(Event* e) {
++  return m_table[e->file_descriptor()];
++}
++
++inline void
++PollPorts::set_event_mask(Event* e, uint32_t m) {
++  m_table[e->file_descriptor()] = m;
++}
++
++inline void
++PollPorts::modify(Event* event, uint32_t mask) {
++  if (event_mask(event) == mask)
++    return;
++
++  port_dissociate(m_fd, PORT_SOURCE_FD, event->file_descriptor());
++
++  set_event_mask(event, mask);
++
++  if (mask == 0)
++    return;
++
++  if (port_associate(m_fd, PORT_SOURCE_FD, event->file_descriptor(),
++		  mask, event) == -1)
++	  throw internal_error("PollPorts::modify(...) port_associate failed");
++}
++
++PollPorts*
++PollPorts::create(int maxOpenSockets) {
++  int fd = port_create();
++
++  if (fd == -1)
++    return NULL;
++
++  return new PollPorts(fd, 1024, maxOpenSockets);
++}
++
++PollPorts::PollPorts(int fd, int maxEvents, int maxOpenSockets) :
++  m_fd(fd),
++  m_maxEvents(maxEvents),
++  m_waitingEvents(0),
++  m_events(new port_event_t[maxEvents]) {
++
++  m_table.resize(maxOpenSockets); 
++}
++
++PollPorts::~PollPorts() {
++  m_table.clear();
++
++  ::close(m_fd);
++}
++
++int
++PollPorts::poll(int msec) {
++  timespec_t timeout;
++  timeout.tv_sec = msec / 1000;
++  timeout.tv_nsec = (msec * 1000000L) % 1000000000L;
++
++  uint_t nfds = 1;
++
++  int ret = port_getn(m_fd, m_events, m_maxEvents, &nfds, &timeout);
++
++  if (ret == -1 && errno != ETIME) {
++	  std::cerr << "error from ports, maxevents="<<m_maxEvents<<", nfds="<<nfds<<" msec="<<msec<<"\n";
++    return -1;
++  }
++
++  return m_waitingEvents = nfds;
++}
++
++// We check m_table to make sure the Event is still listening to the
++// event, so it is safe to remove Event's while in working.
++//
++// TODO: Do we want to guarantee if the Event has been removed from
++// some event but not closed, it won't call that event? Think so...
++void
++PollPorts::perform() {
++  for (port_event_t *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr) {
++
++    // Each branch must check for data.ptr != NULL to allow the socket
++    // to remove itself between the calls.
++    //
++    // TODO: Make it so that it checks that read/write is wanted, that
++    // it wasn't removed from one of them but not closed.
++
++    if (itr->portev_user == NULL)
++      continue;
++
++    if (itr->portev_events & POLLERR 
++        && event_mask((Event*)itr->portev_user) & POLLERR)
++      ((Event*)itr->portev_user)->event_error();
++
++    if (itr->portev_user == NULL)
++      continue;
++
++    if (itr->portev_events & POLLIN
++        && event_mask((Event*)itr->portev_user) & POLLIN)
++      ((Event*)itr->portev_user)->event_read();
++
++    if (itr->portev_user == NULL)
++      continue;
++
++    if (itr->portev_events & POLLOUT
++        && event_mask((Event*)itr->portev_user) & POLLOUT)
++      ((Event*)itr->portev_user)->event_write();
++
++    if (itr->portev_user == NULL)
++      continue;
++
++    // Since port events are one-shot, re-add the fd after we process
++    // its events.
++
++    port_associate(m_fd, PORT_SOURCE_FD, itr->portev_object,
++        event_mask((Event *)itr->portev_user), itr->portev_user);
++  }
++
++  m_waitingEvents = 0;
++}
++
++uint32_t
++PollPorts::open_max() const {
++  return m_table.size();
++}
++
++void
++PollPorts::open(Event* event) {
++  if (event_mask(event) != 0)
++    throw internal_error("PollPorts::open(...) called but the file descriptor is active");
++}
++
++void
++PollPorts::close(Event* event) {
++  if (event_mask(event) != 0)
++    throw internal_error("PollPorts::close(...) called but the file descriptor is active");
++
++  for (port_event_t *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr)
++    if (itr->portev_user == event)
++      itr->portev_user = NULL;
++}
++
++bool
++PollPorts::in_read(Event* event) {
++  return event_mask(event) & POLLIN;
++}
++
++bool
++PollPorts::in_write(Event* event) {
++  return event_mask(event) & POLLOUT;
++}
++
++bool
++PollPorts::in_error(Event* event) {
++  return event_mask(event) & POLLERR;
++}
++
++void
++PollPorts::insert_read(Event* event) {
++  modify(event, event_mask(event) | POLLIN);
++}
++
++void
++PollPorts::insert_write(Event* event) {
++  modify(event, event_mask(event) | POLLOUT);
++}
++
++void
++PollPorts::insert_error(Event* event) {
++  modify(event, event_mask(event) | POLLERR);
++}
++
++void
++PollPorts::remove_read(Event* event) {
++  uint32_t mask = event_mask(event) & ~POLLIN;
++  modify(event, mask);
++}
++
++void
++PollPorts::remove_write(Event* event) {
++  uint32_t mask = event_mask(event) & ~POLLOUT;
++
++  modify(event, mask);
++}
++
++void
++PollPorts::remove_error(Event* event) {
++  uint32_t mask = event_mask(event) & ~POLLERR;
++
++  modify(event, mask);
++}
++
++#else // USE_PORTS
++
++PollPorts*
++PollPorts::create(int maxOpenSockets) {
++  return NULL;
++}
++
++PollPorts::~PollPorts() {
++}
++
++int
++PollPorts::poll(int msec) {
++  throw internal_error("An PollPorts function was called, but it is disabled.");
++}
++
++void
++PollPorts::perform() {
++  throw internal_error("An PollPorts function was called, but it is disabled.");
++}
++
++uint32_t
++PollPorts::open_max() const {
++  throw internal_error("An PollPorts function was called, but it is disabled.");
++}
++
++void
++PollPorts::open(torrent::Event* event) {
++}
++
++void
++PollPorts::close(torrent::Event* event) {
++}
++
++bool
++PollPorts::in_read(torrent::Event* event) {
++  throw internal_error("An PollPorts function was called, but it is disabled.");
++}
++
++bool
++PollPorts::in_write(torrent::Event* event) {
++  throw internal_error("An PollPorts function was called, but it is disabled.");
++}
++
++bool
++PollPorts::in_error(torrent::Event* event) {
++  throw internal_error("An PollPorts function was called, but it is disabled.");
++}
++
++void
++PollPorts::insert_read(torrent::Event* event) {
++}
++
++void
++PollPorts::insert_write(torrent::Event* event) {
++}
++
++void
++PollPorts::insert_error(torrent::Event* event) {
++}
++
++void
++PollPorts::remove_read(torrent::Event* event) {
++}
++
++void
++PollPorts::remove_write(torrent::Event* event) {
++}
++
++void
++PollPorts::remove_error(torrent::Event* event) {
++}
++
++PollPorts::PollPorts(int fd, int maxEvents, int maxOpenSockets) {
++  throw internal_error("An PollPorts function was called, but it is disabled.");
++}
++
++#endif // USE_PORTS
++
++}
+diff -urN libtorrent.orig/src/torrent/poll_ports.h libtorrent/src/torrent/poll_ports.h
+--- libtorrent.orig/src/torrent/poll_ports.h	1969-12-31 19:00:00.000000000 -0500
++++ libtorrent/src/torrent/poll_ports.h	2008-05-12 00:42:15.000000000 -0400
+@@ -0,0 +1,100 @@
++// libTorrent - BitTorrent library
++// Copyright (C) 2005-2007, Jari Sundell
++//
++// This program is free software; you can redistribute it and/or modify
++// it under the terms of the GNU General Public License as published by
++// the Free Software Foundation; either version 2 of the License, or
++// (at your option) any later version.
++// 
++// This program is distributed in the hope that it will be useful,
++// but WITHOUT ANY WARRANTY; without even the implied warranty of
++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++// GNU General Public License for more details.
++// 
++// You should have received a copy of the GNU General Public License
++// along with this program; if not, write to the Free Software
++// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
++//
++// In addition, as a special exception, the copyright holders give
++// permission to link the code of portions of this program with the
++// OpenSSL library under certain conditions as described in each
++// individual source file, and distribute linked combinations
++// including the two.
++//
++// You must obey the GNU General Public License in all respects for
++// all of the code used other than OpenSSL.  If you modify file(s)
++// with this exception, you may extend this exception to your version
++// of the file(s), but you are not obligated to do so.  If you do not
++// wish to do so, delete this exception statement from your version.
++// If you delete this exception statement from all source files in the
++// program, then also delete it here.
++//
++// Contact:  Jari Sundell <[email protected]>
++//
++//           Skomakerveien 33
++//           3185 Skoppum, NORWAY
++
++#ifndef LIBTORRENT_TORRENT_POLL_PORTS_H
++#define LIBTORRENT_TORRENT_POLL_PORTS_H
++
++#include <vector>
++#include <torrent/poll.h>
++
++struct port_event;
++
++namespace torrent {
++
++class LIBTORRENT_EXPORT PollPorts : public torrent::Poll {
++public:
++  typedef std::vector<uint32_t> Table;
++
++  static PollPorts*   create(int maxOpenSockets);
++  virtual ~PollPorts();
++
++  int                 poll(int msec);
++  void                perform();
++
++  int                 file_descriptor() { return m_fd; }
++
++  virtual uint32_t    open_max() const;
++
++  // torrent::Event::get_fd() is guaranteed to be valid and remain constant
++  // from open(...) is called to close(...) returns.
++  virtual void        open(torrent::Event* event);
++  virtual void        close(torrent::Event* event);
++
++  // Functions for checking whetever the torrent::Event is listening to r/w/e?
++  virtual bool        in_read(torrent::Event* event);
++  virtual bool        in_write(torrent::Event* event);
++  virtual bool        in_error(torrent::Event* event);
++
++  // These functions may be called on 'event's that might, or might
++  // not, already be in the set.
++  virtual void        insert_read(torrent::Event* event);
++  virtual void        insert_write(torrent::Event* event);
++  virtual void        insert_error(torrent::Event* event);
++
++  virtual void        remove_read(torrent::Event* event);
++  virtual void        remove_write(torrent::Event* event);
++  virtual void        remove_error(torrent::Event* event);
++
++private:
++  PollPorts(int fd, int maxEvents, int maxOpenSockets);
++
++  inline uint32_t     event_mask(Event* e);
++  inline void         set_event_mask(Event* e, uint32_t m);
++
++  inline void         modify(torrent::Event* event, uint32_t mask);
++
++  int                 m_fd;
++
++  int                 m_maxEvents;
++  int                 m_waitingEvents;
++
++  Table               m_table;
++  port_event*        m_events;
++};
++
++}
++
++#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/songbird-01-menu-item.diff	Wed Jun 18 20:12:36 2008 +0000
@@ -0,0 +1,15 @@
+Index: songbird0.6/app/branding/songbird.desktop
+===================================================================
+--- songbird0.6/app/branding/songbird.desktop	(revision 0)
++++ songbird0.6/app/branding/songbird.desktop	(revision 0)
+@@ -0,0 +1,10 @@
++[Desktop Entry]
++Encoding=UTF-8
++Name=Songbird
++Comment=The desktop media player mashed-up with the Web
++Exec=songbird
++Icon=songbird.png
++Terminal=false
++Type=Application
++Categories=Application;AudioVideo;
++StartupNotify=true
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/songbird-02-taglib.diff	Wed Jun 18 20:12:36 2008 +0000
@@ -0,0 +1,11 @@
+--- dependencies/vendor/taglib/taglib/ape/apetag.h.orig	Wed Jun 18 15:40:12 2008
++++ dependencies/vendor/taglib/taglib/ape/apetag.h	Wed Jun 18 15:40:16 2008
+@@ -49,7 +49,7 @@
+      *
+      * \see APE::Tag::itemListMap()
+      */
+-    typedef Map<const String, Item> ItemListMap;
++    typedef Map<String, Item> ItemListMap;
+ 
+ 
+     //! An APE tag implementation