Skip to content

Commit

Permalink
libtorrent: backport 1.0.9 recipe.
Browse files Browse the repository at this point in the history
  • Loading branch information
pulkomandy committed Aug 21, 2016
1 parent 93c5f5a commit 0aef285
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 11 deletions.
Expand Up @@ -11,20 +11,20 @@ The main goals of libtorrent are:
* to be memory efficient
* to be very easy to use"
HOMEPAGE="http://www.libtorrent.org/"
COPYRIGHT="2003-2015 Arvid Norberg"
COPYRIGHT="2003-2016 Arvid Norberg"
LICENSE="BSD (2-clause)"
SOURCE_URI="https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_0_6/libtorrent-rasterbar-$portVersion.tar.gz"
REVISION="1"
SOURCE_URI="https://github.com/arvidn/libtorrent/releases/download/libtorrent-${portVersion//./_}/libtorrent-rasterbar-$portVersion.tar.gz"
CHECKSUM_SHA256="11a93125ed49f796fca83da925ab7dc29e91d88b915f078caaddaaf559d63db6"
SOURCE_DIR="libtorrent-rasterbar-$portVersion"
CHECKSUM_SHA256="c97de804b77f44591801631aca3869567671df2d3e2afe7f5453d8db2478fd61"
PATCHES="libtorrent_rasterbar_x86-1.0.6.patchset"
REVISION="2"
PATCHES="libtorrent_rasterbar-$portVersion.patchset"

ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64"
SECONDARY_ARCHITECTURES="x86 !x86_gcc2"
ARCHITECTURES="!x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="!x86_gcc2 x86"

PROVIDES="
libtorrent_rasterbar${secondaryArchSuffix} = $portVersion
lib:libtorrent_rasterbar$secondaryArchSuffix = $portVersion
lib:libtorrent_rasterbar$secondaryArchSuffix = 8 compat >= 8
"
REQUIRES="
haiku$secondaryArchSuffix
Expand All @@ -37,7 +37,7 @@ REQUIRES="

PROVIDES_devel="
libtorrent_rasterbar${secondaryArchSuffix}_devel = $portVersion
devel:libtorrent_rasterbar$secondaryArchSuffix = $portVersion
devel:libtorrent_rasterbar$secondaryArchSuffix = 8 compat >= 8
"
REQUIRES_devel="
libtorrent_rasterbar$secondaryArchSuffix == $portVersion base
Expand Down Expand Up @@ -70,8 +70,10 @@ INSTALL()
make install

mv $prefix/include/libtorrent $includeDir
mv $prefix/lib/*.so* $libDir
mv $prefix/lib/pkgconfig $libDir
if [ -n "$secondaryArchSuffix" ]; then
mv $prefix/lib/*.so* $libDir
mv $prefix/lib/pkgconfig $libDir
fi
rm -r $prefix/include
strip $libDir/libtorrent-rasterbar.so.8

Expand Down
@@ -0,0 +1,117 @@
From 7258de8d1f9af649bc829b447c93e0f835602d0b Mon Sep 17 00:00:00 2001
From: Sergei Reznikov <diver@gelios.net>
Date: Tue, 9 Jun 2015 08:26:30 +0300
Subject: Replace BeOS support code with Haiku


diff --git a/include/libtorrent/config.hpp b/include/libtorrent/config.hpp
index 1f17426..c8f36f3 100644
--- a/include/libtorrent/config.hpp
+++ b/include/libtorrent/config.hpp
@@ -250,14 +250,15 @@ POSSIBILITY OF SUCH DAMAGE.
#define TORRENT_USE_IFCONF 1
#define TORRENT_HAS_SALEN 0

-// ==== BEOS ===
-#elif defined __BEOS__ || defined __HAIKU__
-#define TORRENT_BEOS
-#include <storage/StorageDefs.h> // B_PATH_NAME_LENGTH
+// ==== Haiku ===
+#elif defined __HAIKU__
+#define TORRENT_HAIKU
+#include <StorageDefs.h> // B_PATH_NAME_LENGTH
#define TORRENT_HAS_FALLOCATE 0
#define TORRENT_USE_MLOCK 0
#ifndef TORRENT_USE_ICONV
#define TORRENT_USE_ICONV 0
+#define TORRENT_USE_IFCONF 1
#endif

// ==== GNU/Hurd ===
diff --git a/include/libtorrent/thread.hpp b/include/libtorrent/thread.hpp
index 70a2b85..9bc9ee3 100644
--- a/include/libtorrent/thread.hpp
+++ b/include/libtorrent/thread.hpp
@@ -41,10 +41,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include <winsock2.h>
#endif

-#if defined TORRENT_BEOS
-#include <kernel/OS.h>
-#endif
-
#include <memory> // for auto_ptr required by asio

#include <boost/asio/detail/thread.hpp>
@@ -75,7 +71,6 @@ namespace libtorrent
HANDLE m_sem;
mutex m_mutex;
int m_num_waiters;
-#elif defined TORRENT_BEOS
sem_id m_sem;
mutex m_mutex;
int m_num_waiters;
diff --git a/src/allocator.cpp b/src/allocator.cpp
index 310cf0b..4cb2aa8 100644
--- a/src/allocator.cpp
+++ b/src/allocator.cpp
@@ -42,7 +42,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <unistd.h> // _SC_PAGESIZE
#endif

-#if TORRENT_USE_MEMALIGN || TORRENT_USE_POSIX_MEMALIGN || defined TORRENT_WINDOWS
+#if TORRENT_USE_MEMALIGN || TORRENT_USE_POSIX_MEMALIGN || defined TORRENT_WINDOWS || defined TORRENT_HAIKU
#include <malloc.h> // memalign and _aligned_malloc
#include <stdlib.h> // _aligned_malloc on mingw
#endif
diff --git a/src/enum_net.cpp b/src/enum_net.cpp
index 0994a63..a66d20b 100644
--- a/src/enum_net.cpp
+++ b/src/enum_net.cpp
@@ -92,6 +92,10 @@ POSSIBILITY OF SUCH DAMAGE.
#define IF_NAMESIZE IFNAMSIZ
#endif

+#if defined __HAIKU__
+#include <sys/sockio.h>
+#endif
+
namespace libtorrent { namespace
{

diff --git a/src/thread.cpp b/src/thread.cpp
index c22aeb0..2490d20 100644
--- a/src/thread.cpp
+++ b/src/thread.cpp
@@ -33,10 +33,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/thread.hpp"
#include "libtorrent/assert.hpp"

-#ifdef TORRENT_BEOS
-#include <kernel/OS.h>
-#endif
-
#ifdef BOOST_HAS_PTHREADS
#include <sys/time.h> // for gettimeofday()
#include <boost/cstdint.hpp>
@@ -48,8 +44,6 @@ namespace libtorrent
{
#if defined TORRENT_WINDOWS || defined TORRENT_CYGWIN
Sleep(milliseconds);
-#elif defined TORRENT_BEOS
- snooze_until(system_time() + boost::int64_t(milliseconds) * 1000, B_SYSTEM_TIMEBASE);
#else
usleep(milliseconds * 1000);
#endif
@@ -129,7 +123,7 @@ namespace libtorrent
{
ReleaseSemaphore(m_sem, m_num_waiters, 0);
}
-#elif defined TORRENT_BEOS
+#elif defined TORRENT_HAIKU
condition_variable::condition_variable()
: m_num_waiters(0)
{
--
2.2.2

0 comments on commit 0aef285

Please sign in to comment.