summaryrefslogtreecommitdiffstats
path: root/meta-openembedded/meta-oe/recipes-connectivity/libtorrent
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openembedded/meta-oe/recipes-connectivity/libtorrent')
-rw-r--r--meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/0001-Define-64bit-atomic-helpers-for-ppc-32-bit.patch30
-rw-r--r--meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/0001-implement-64bit-atomic-for-mips.patch263
-rw-r--r--meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/don-t-run-code-while-configuring-package.patch94
-rw-r--r--meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent_git.bb26
4 files changed, 413 insertions, 0 deletions
diff --git a/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/0001-Define-64bit-atomic-helpers-for-ppc-32-bit.patch b/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/0001-Define-64bit-atomic-helpers-for-ppc-32-bit.patch
new file mode 100644
index 000000000..4d0979710
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/0001-Define-64bit-atomic-helpers-for-ppc-32-bit.patch
@@ -0,0 +1,30 @@
+From c9859a38a58996b8767a30e14febc03845f66f95 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Sat, 1 Jul 2017 13:10:53 -0700
+Subject: [PATCH] Define 64bit atomic helpers for ppc 32-bit
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/atomic64.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/atomic64.c b/src/atomic64.c
+index f841b39b..35c7c9d8 100644
+--- a/src/atomic64.c
++++ b/src/atomic64.c
+@@ -18,10 +18,10 @@
+ #include <stdbool.h>
+
+ /*
+- * only need these on MIPS, since it lacks hardware 64-bit atomics,
++ * only need these on MIPS & PPC32, since it lacks hardware 64-bit atomics,
+ * unlike x86 and ARM.
+ */
+-#if defined(__mips__) || defined(__mipsel__)
++#if defined(__mips__) || defined(__mipsel__) || defined(__powerpc__)
+
+ static void __spin_lock(volatile int *lock) {
+ while (__sync_lock_test_and_set(lock, 1))
+--
+2.13.2
+
diff --git a/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/0001-implement-64bit-atomic-for-mips.patch b/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/0001-implement-64bit-atomic-for-mips.patch
new file mode 100644
index 000000000..84e0772a7
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/0001-implement-64bit-atomic-for-mips.patch
@@ -0,0 +1,263 @@
+From d7b6df5808e7bef5930b61a82e880699a9f9e208 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 29 Jun 2017 15:39:19 -0700
+Subject: [PATCH] implement 64bit atomic for mips
+
+GCC does not provide 64bit atomics for mips32
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/Makefile.am | 1 +
+ src/atomic64.c | 228 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 229 insertions(+)
+ create mode 100644 src/atomic64.c
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 99aaace0..cbbbbee9 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -27,6 +27,7 @@ libtorrent_la_LIBADD = \
+ utils/libsub_utils.la
+
+ libtorrent_la_SOURCES = \
++ atomic64.c \
+ globals.cc \
+ globals.h \
+ manager.cc \
+diff --git a/src/atomic64.c b/src/atomic64.c
+new file mode 100644
+index 00000000..f841b39b
+--- /dev/null
++++ b/src/atomic64.c
+@@ -0,0 +1,228 @@
++/*===----- atomic64.c - Support functions for 64-bit atomic operations.-----===
++ *
++ * The LLVM Compiler Infrastructure
++ *
++ * This file is dual licensed under the MIT and the University of Illinois Open
++ * Source Licenses. See LICENSE.TXT for details.
++ *
++ *===-----------------------------------------------------------------------===
++ *
++ * atomic64.c defines a set of functions for performing atomic accesses on
++ * 64-bit memory locations. It also implements spinlock synchronization
++ * operations.
++ *
++ *===-----------------------------------------------------------------------===
++ */
++
++#include <stdint.h>
++#include <stdbool.h>
++
++/*
++ * only need these on MIPS, since it lacks hardware 64-bit atomics,
++ * unlike x86 and ARM.
++ */
++#if defined(__mips__) || defined(__mipsel__)
++
++static void __spin_lock(volatile int *lock) {
++ while (__sync_lock_test_and_set(lock, 1))
++ while (*lock) {}
++}
++
++static void __spin_unlock(volatile int *lock) {
++ __sync_lock_release(lock);
++}
++
++/*
++ * Make sure the lock is on its own cache line to prevent false sharing.
++ * Put it inside a struct that is aligned and padded to the typical MIPS
++ * cacheline which is 32 bytes.
++ */
++static struct {
++ int lock;
++ char pad[32 - sizeof(int)];
++} __attribute__((aligned (32))) lock = { 0 };
++
++
++uint64_t __sync_fetch_and_add_8(volatile uint64_t *ptr, uint64_t val) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr;
++ *ptr = ret + val;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++uint64_t __sync_fetch_and_sub_8(volatile uint64_t *ptr, uint64_t val) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr;
++ *ptr = ret - val;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++uint64_t __sync_fetch_and_and_8(volatile uint64_t *ptr, uint64_t val) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr;
++ *ptr = ret & val;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++uint64_t __sync_fetch_and_or_8(volatile uint64_t *ptr, uint64_t val) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr;
++ *ptr = ret | val;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++uint64_t __sync_fetch_and_xor_8(volatile uint64_t *ptr, uint64_t val) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr;
++ *ptr = ret ^ val;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++uint64_t __sync_add_and_fetch_8(volatile uint64_t *ptr, uint64_t val) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr + val;
++ *ptr = ret;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++uint64_t __sync_sub_and_fetch_8(volatile uint64_t *ptr, uint64_t val) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr - val;
++ *ptr = ret;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++uint64_t __sync_and_and_fetch_8(volatile uint64_t *ptr, uint64_t val) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr & val;
++ *ptr = ret;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++uint64_t __sync_or_and_fetch_8(volatile uint64_t *ptr, uint64_t val) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr | val;
++ *ptr = ret;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++uint64_t __sync_xor_and_fetch_8(volatile uint64_t *ptr, uint64_t val) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr ^ val;
++ *ptr = ret;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++bool __sync_bool_compare_and_swap_8(volatile uint64_t *ptr,
++ uint64_t oldval, uint64_t newval) {
++ bool ret = false;
++
++ __spin_lock(&lock.lock);
++
++ if (*ptr == oldval) {
++ *ptr = newval;
++ ret = true;
++ }
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++uint64_t __sync_val_compare_and_swap_8(volatile uint64_t *ptr,
++ uint64_t oldval, uint64_t newval) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr;
++ if (ret == oldval)
++ *ptr = newval;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++uint64_t __sync_lock_test_and_set_8(volatile uint64_t *ptr, uint64_t val) {
++ uint64_t ret;
++
++ __spin_lock(&lock.lock);
++
++ ret = *ptr;
++ *ptr = val;
++
++ __spin_unlock(&lock.lock);
++
++ return ret;
++}
++
++void __sync_lock_release_8(volatile uint64_t *ptr) {
++ __spin_lock(&lock.lock);
++
++ *ptr = 0;
++
++ __spin_unlock(&lock.lock);
++}
++
++#endif
+--
+2.13.2
+
diff --git a/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/don-t-run-code-while-configuring-package.patch b/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/don-t-run-code-while-configuring-package.patch
new file mode 100644
index 000000000..79d4f29fa
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent/don-t-run-code-while-configuring-package.patch
@@ -0,0 +1,94 @@
+Using AC_RUN_IFELSE prevent people from configuring package for
+cross-compiling. Don't run code while configuring package.
+
+Upstream-Status: Pending
+Signed-off-by: Andrei Gherzan <andrei@gherzan.ro>
+
+Index: libtorrent-0.13.3/scripts/checks.m4
+===================================================================
+--- libtorrent-0.13.3.orig/scripts/checks.m4 2012-05-14 14:17:04.000000000 +0300
++++ libtorrent-0.13.3/scripts/checks.m4 2013-02-10 15:28:37.414445524 +0200
+@@ -95,40 +95,6 @@
+
+ AC_DEFUN([TORRENT_CHECK_KQUEUE_SOCKET_ONLY], [
+ AC_MSG_CHECKING(whether kqueue supports pipes and ptys)
+-
+- AC_RUN_IFELSE([AC_LANG_SOURCE([
+- #include <fcntl.h>
+- #include <stdlib.h>
+- #include <unistd.h>
+- #include <sys/event.h>
+- #include <sys/time.h>
+- int main() {
+- struct kevent ev@<:@2@:>@, ev_out@<:@2@:>@;
+- struct timespec ts = { 0, 0 };
+- int pfd@<:@2@:>@, pty@<:@2@:>@, kfd, n;
+- char buffer@<:@9001@:>@;
+- if (pipe(pfd) == -1) return 1;
+- if (fcntl(pfd@<:@1@:>@, F_SETFL, O_NONBLOCK) == -1) return 2;
+- while ((n = write(pfd@<:@1@:>@, buffer, sizeof(buffer))) == sizeof(buffer));
+- if ((pty@<:@0@:>@=posix_openpt(O_RDWR | O_NOCTTY)) == -1) return 3;
+- if ((pty@<:@1@:>@=grantpt(pty@<:@0@:>@)) == -1) return 4;
+- EV_SET(ev+0, pfd@<:@1@:>@, EVFILT_WRITE, EV_ADD | EV_ENABLE, 0, 0, NULL);
+- EV_SET(ev+1, pty@<:@1@:>@, EVFILT_READ, EV_ADD | EV_ENABLE, 0, 0, NULL);
+- if ((kfd = kqueue()) == -1) return 5;
+- if ((n = kevent(kfd, ev, 2, NULL, 0, NULL)) == -1) return 6;
+- if (ev_out@<:@0@:>@.flags & EV_ERROR) return 7;
+- if (ev_out@<:@1@:>@.flags & EV_ERROR) return 8;
+- read(pfd@<:@0@:>@, buffer, sizeof(buffer));
+- if ((n = kevent(kfd, NULL, 0, ev_out, 2, &ts)) < 1) return 9;
+- return 0;
+- }
+- ])],
+- [
+- AC_MSG_RESULT(yes)
+- ], [
+- AC_DEFINE(KQUEUE_SOCKET_ONLY, 1, kqueue only supports sockets.)
+- AC_MSG_RESULT(no)
+- ])
+ ])
+
+ AC_DEFUN([TORRENT_WITH_KQUEUE], [
+Index: libtorrent-0.13.3/scripts/common.m4
+===================================================================
+--- libtorrent-0.13.3.orig/scripts/common.m4 2012-05-14 14:17:04.000000000 +0300
++++ libtorrent-0.13.3/scripts/common.m4 2013-02-10 15:27:55.874446741 +0200
+@@ -222,38 +222,10 @@
+
+ AC_DEFUN([TORRENT_CHECK_EXECINFO], [
+ AC_MSG_CHECKING(for execinfo.h)
+-
+- AC_RUN_IFELSE([AC_LANG_SOURCE([
+- #include <execinfo.h>
+- int main() { backtrace((void**)0, 0); backtrace_symbols((char**)0, 0); return 0;}
+- ])],
+- [
+- AC_MSG_RESULT(yes)
+- AC_DEFINE(USE_EXECINFO, 1, Use execinfo.h)
+- ], [
+- AC_MSG_RESULT(no)
+- ])
+ ])
+
+ AC_DEFUN([TORRENT_CHECK_ALIGNED], [
+ AC_MSG_CHECKING(the byte alignment)
+-
+- AC_RUN_IFELSE([AC_LANG_SOURCE([
+- #include <inttypes.h>
+- int main() {
+- char buf@<:@8@:>@ = { 0, 0, 0, 0, 1, 0, 0, 0 };
+- int i;
+- for (i = 1; i < 4; ++i)
+- if (*(uint32_t*)(buf + i) == 0) return -1;
+- return 0;
+- }
+- ])],
+- [
+- AC_MSG_RESULT(none needed)
+- ], [
+- AC_DEFINE(USE_ALIGNED, 1, Require byte alignment)
+- AC_MSG_RESULT(required)
+- ])
+ ])
+
+
diff --git a/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent_git.bb b/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent_git.bb
new file mode 100644
index 000000000..92e65289a
--- /dev/null
+++ b/meta-openembedded/meta-oe/recipes-connectivity/libtorrent/libtorrent_git.bb
@@ -0,0 +1,26 @@
+DESCRIPTION = "libTorrent is a BitTorrent library written in C++ for *nix, \
+with a focus on high performance and good code."
+HOMEPAGE = "http://libtorrent.rakshasa.no/"
+LICENSE = "GPL-2.0"
+LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
+
+DEPENDS = "zlib libsigc++-2.0 openssl cppunit"
+
+SRC_URI = "git://github.com/rakshasa/libtorrent \
+ file://don-t-run-code-while-configuring-package.patch \
+ file://0001-implement-64bit-atomic-for-mips.patch \
+ file://0001-Define-64bit-atomic-helpers-for-ppc-32-bit.patch \
+ "
+SRCREV = "c167c5a9e0bcf0df23ae5efd91396aae0e37eb87"
+
+PV = "0.13.6+git${SRCPV}"
+
+S = "${WORKDIR}/git"
+
+inherit autotools pkgconfig
+
+EXTRA_OECONF = "--with-zlib=${STAGING_EXECPREFIXDIR}"
+
+do_configure_prepend() {
+ (cd ${S}; ./autogen.sh; cd -)
+}
OpenPOWER on IntegriCloud