commit:     78d9044fad10c24e960c3daa1595c51a0db94fa4
Author:     Stephen Shkardoon <ss23 <AT> ss23 <DOT> geek <DOT> nz>
AuthorDate: Sat Jun 30 04:11:12 2018 +0000
Commit:     Jason Zaman <perfinion <AT> gentoo <DOT> org>
CommitDate: Tue Jul  3 05:57:03 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78d9044f

net-libs/libtorrent: Fix configure checks to allow cross compiling

Already patched in upstream:
https://github.com/rakshasa/libtorrent/pull/174
https://github.com/rakshasa/libtorrent/pull/175

Closes: https://bugs.gentoo.org/show_bug.cgi?id=446184
Package-Manager: Portage-2.3.40, Repoman-2.3.9

 .../libtorrent-0.13.7-execinfo-configure.patch     | 24 ++++++++
 .../files/libtorrent-0.13.7-kqueue-configure.patch | 46 ++++++++++++++
 net-libs/libtorrent/libtorrent-0.13.7-r1.ebuild    | 70 ++++++++++++++++++++++
 3 files changed, 140 insertions(+)

diff --git 
a/net-libs/libtorrent/files/libtorrent-0.13.7-execinfo-configure.patch 
b/net-libs/libtorrent/files/libtorrent-0.13.7-execinfo-configure.patch
new file mode 100644
index 00000000000..1865e48992c
--- /dev/null
+++ b/net-libs/libtorrent/files/libtorrent-0.13.7-execinfo-configure.patch
@@ -0,0 +1,24 @@
+From f4dadb3850ef15dd7898d07fca72d2fa7e32ca6f Mon Sep 17 00:00:00 2001
+From: Stephen Shkardoon <[email protected]>
+Date: Mon, 25 Jun 2018 20:05:18 +1200
+Subject: [PATCH] Use AC_COMPILE instead of AC_RUN to check for execinfo.h
+
+This way enables cross compiling, since we don't need to run anything
+during the configure script.
+---
+ scripts/common.m4 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/scripts/common.m4 b/scripts/common.m4
+index ff023928..b6d051f5 100644
+--- a/scripts/common.m4
++++ b/scripts/common.m4
+@@ -153,7 +153,7 @@ dnl   Need to fix this so that it uses the stuff defined 
by the system.
+ AC_DEFUN([TORRENT_CHECK_EXECINFO], [
+   AC_MSG_CHECKING(for execinfo.h)
+ 
+-  AC_RUN_IFELSE([AC_LANG_SOURCE([
++  AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+       #include <execinfo.h>
+       int main() { backtrace((void**)0, 0); backtrace_symbols((char**)0, 0); 
return 0;}
+       ])],

diff --git a/net-libs/libtorrent/files/libtorrent-0.13.7-kqueue-configure.patch 
b/net-libs/libtorrent/files/libtorrent-0.13.7-kqueue-configure.patch
new file mode 100644
index 00000000000..af8e53ddd23
--- /dev/null
+++ b/net-libs/libtorrent/files/libtorrent-0.13.7-kqueue-configure.patch
@@ -0,0 +1,46 @@
+From 755daf78769b048c868e6b62c68b4e545494c181 Mon Sep 17 00:00:00 2001
+From: Stephen Shkardoon <[email protected]>
+Date: Thu, 21 Jun 2018 14:38:30 +1200
+Subject: [PATCH] Modify configure to prevent unnecessary kqueue checks
+
+By only running the TORRENT_CHECK_KQUEUE_SOCKET_ONLY check if kqueue support
+is already detected, we increase the number of platforms that we can
+cross compile on.
+Otherwise, the cross compilation fails due to TORRENT_CHECK_KQUEUE_SOCKET_ONLY
+using AC_RUN_IFELSE, which fails during cross compilation.
+---
+ scripts/checks.m4 | 4 +---
+ 1 file changed, 1 insertion(+), 3 deletions(-)
+
+diff --git a/scripts/checks.m4 b/scripts/checks.m4
+index 8d77fc5e..c9333561 100644
+--- a/scripts/checks.m4
++++ b/scripts/checks.m4
+@@ -88,6 +88,7 @@ AC_DEFUN([TORRENT_CHECK_KQUEUE], [
+     [
+       AC_DEFINE(USE_KQUEUE, 1, Use kqueue.)
+       AC_MSG_RESULT(yes)
++      TORRENT_CHECK_KQUEUE_SOCKET_ONLY
+     ], [
+       AC_MSG_RESULT(no)
+     ])
+@@ -137,7 +138,6 @@ AC_DEFUN([TORRENT_WITH_KQUEUE], [
+     [
+         if test "$withval" = "yes"; then
+           TORRENT_CHECK_KQUEUE
+-          TORRENT_CHECK_KQUEUE_SOCKET_ONLY
+         fi
+     ])
+ ])
+@@ -149,11 +149,9 @@ AC_DEFUN([TORRENT_WITHOUT_KQUEUE], [
+     [
+       if test "$withval" = "yes"; then
+         TORRENT_CHECK_KQUEUE
+-        TORRENT_CHECK_KQUEUE_SOCKET_ONLY
+       fi
+     ], [
+         TORRENT_CHECK_KQUEUE
+-        TORRENT_CHECK_KQUEUE_SOCKET_ONLY
+     ])
+ ])
+ 

diff --git a/net-libs/libtorrent/libtorrent-0.13.7-r1.ebuild 
b/net-libs/libtorrent/libtorrent-0.13.7-r1.ebuild
new file mode 100644
index 00000000000..9b0f0ae7df4
--- /dev/null
+++ b/net-libs/libtorrent/libtorrent-0.13.7-r1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools toolchain-funcs
+
+DESCRIPTION="BitTorrent library written in C++ for *nix"
+HOMEPAGE="https://rakshasa.github.io/rtorrent/";
+SRC_URI="http://rtorrent.net/downloads/${P}.tar.gz";
+
+LICENSE="GPL-2"
+
+# The README says that the library ABI is not yet stable and dependencies on
+# the library should be an explicit, syncronized version until the library
+# has had more time to mature. Until it matures we should not include a soname
+# subslot.
+SLOT="0"
+
+KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd 
~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos 
~sparc-solaris ~x64-solaris"
+IUSE="debug libressl ssl test"
+
+RDEPEND="
+       sys-libs/zlib
+       >=dev-libs/libsigc++-2.2.2:2
+       ssl? (
+           !libressl? ( dev-libs/openssl:0= )
+           libressl? ( dev-libs/libressl:= )
+       )"
+DEPEND="${RDEPEND}
+       virtual/pkgconfig
+       dev-util/cppunit"
+
+PATCHES=(
+       
"${FILESDIR}/${PN}-0001-Fix-the-DH-parameters-generation-with-OpenSSL-1.1.patch"
+       "${FILESDIR}/${PN}-openssl-1.1-part2.patch"
+       "${FILESDIR}/${PN}-openssl-1.1-part3.patch"
+       "${FILESDIR}/${PN}-0.13.7-kqueue-configure.patch"
+       "${FILESDIR}/${PN}-0.13.7-execinfo-configure.patch"
+)
+
+src_prepare() {
+       default
+       eautoreconf
+}
+
+src_configure() {
+       # bug 518582
+       local disable_instrumentation
+       echo -e "#include <inttypes.h>\nint main(){ int64_t var = 7; 
__sync_add_and_fetch(&var, 1); return 0;}" > "${T}/sync_add_and_fetch.c" || die
+       $(tc-getCC) ${CFLAGS} -o /dev/null -x c "${T}/sync_add_and_fetch.c" 
>/dev/null 2>&1
+       if [[ $? -ne 0 ]]; then
+               disable_instrumentation="--disable-instrumentation"
+       fi
+
+       # configure needs bash or script bombs out on some null shift, bug 
#291229
+       CONFIG_SHELL=${BASH} econf \
+               --enable-aligned \
+               $(use_enable debug) \
+               $(use_enable ssl openssl) \
+               ${disable_instrumentation} \
+               --with-posix-fallocate \
+               --with-zlib="${EROOT%/}/usr/"
+}
+
+src_install() {
+       default
+
+       find "${D}" -name '*.la' -delete
+}

Reply via email to