Gentoo Archives: gentoo-commits

From: Jason Zaman <perfinion@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-libs/libtorrent/, net-libs/libtorrent/files/
Date: Tue, 03 Jul 2018 06:04:34
Message-Id: 1530597423.78d9044fad10c24e960c3daa1595c51a0db94fa4.perfinion@gentoo
1 commit: 78d9044fad10c24e960c3daa1595c51a0db94fa4
2 Author: Stephen Shkardoon <ss23 <AT> ss23 <DOT> geek <DOT> nz>
3 AuthorDate: Sat Jun 30 04:11:12 2018 +0000
4 Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 3 05:57:03 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=78d9044f
7
8 net-libs/libtorrent: Fix configure checks to allow cross compiling
9
10 Already patched in upstream:
11 https://github.com/rakshasa/libtorrent/pull/174
12 https://github.com/rakshasa/libtorrent/pull/175
13
14 Closes: https://bugs.gentoo.org/show_bug.cgi?id=446184
15 Package-Manager: Portage-2.3.40, Repoman-2.3.9
16
17 .../libtorrent-0.13.7-execinfo-configure.patch | 24 ++++++++
18 .../files/libtorrent-0.13.7-kqueue-configure.patch | 46 ++++++++++++++
19 net-libs/libtorrent/libtorrent-0.13.7-r1.ebuild | 70 ++++++++++++++++++++++
20 3 files changed, 140 insertions(+)
21
22 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
23 new file mode 100644
24 index 00000000000..1865e48992c
25 --- /dev/null
26 +++ b/net-libs/libtorrent/files/libtorrent-0.13.7-execinfo-configure.patch
27 @@ -0,0 +1,24 @@
28 +From f4dadb3850ef15dd7898d07fca72d2fa7e32ca6f Mon Sep 17 00:00:00 2001
29 +From: Stephen Shkardoon <ss23@×××××××××.nz>
30 +Date: Mon, 25 Jun 2018 20:05:18 +1200
31 +Subject: [PATCH] Use AC_COMPILE instead of AC_RUN to check for execinfo.h
32 +
33 +This way enables cross compiling, since we don't need to run anything
34 +during the configure script.
35 +---
36 + scripts/common.m4 | 2 +-
37 + 1 file changed, 1 insertion(+), 1 deletion(-)
38 +
39 +diff --git a/scripts/common.m4 b/scripts/common.m4
40 +index ff023928..b6d051f5 100644
41 +--- a/scripts/common.m4
42 ++++ b/scripts/common.m4
43 +@@ -153,7 +153,7 @@ dnl Need to fix this so that it uses the stuff defined by the system.
44 + AC_DEFUN([TORRENT_CHECK_EXECINFO], [
45 + AC_MSG_CHECKING(for execinfo.h)
46 +
47 +- AC_RUN_IFELSE([AC_LANG_SOURCE([
48 ++ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
49 + #include <execinfo.h>
50 + int main() { backtrace((void**)0, 0); backtrace_symbols((char**)0, 0); return 0;}
51 + ])],
52
53 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
54 new file mode 100644
55 index 00000000000..af8e53ddd23
56 --- /dev/null
57 +++ b/net-libs/libtorrent/files/libtorrent-0.13.7-kqueue-configure.patch
58 @@ -0,0 +1,46 @@
59 +From 755daf78769b048c868e6b62c68b4e545494c181 Mon Sep 17 00:00:00 2001
60 +From: Stephen Shkardoon <ss23@×××××××××.nz>
61 +Date: Thu, 21 Jun 2018 14:38:30 +1200
62 +Subject: [PATCH] Modify configure to prevent unnecessary kqueue checks
63 +
64 +By only running the TORRENT_CHECK_KQUEUE_SOCKET_ONLY check if kqueue support
65 +is already detected, we increase the number of platforms that we can
66 +cross compile on.
67 +Otherwise, the cross compilation fails due to TORRENT_CHECK_KQUEUE_SOCKET_ONLY
68 +using AC_RUN_IFELSE, which fails during cross compilation.
69 +---
70 + scripts/checks.m4 | 4 +---
71 + 1 file changed, 1 insertion(+), 3 deletions(-)
72 +
73 +diff --git a/scripts/checks.m4 b/scripts/checks.m4
74 +index 8d77fc5e..c9333561 100644
75 +--- a/scripts/checks.m4
76 ++++ b/scripts/checks.m4
77 +@@ -88,6 +88,7 @@ AC_DEFUN([TORRENT_CHECK_KQUEUE], [
78 + [
79 + AC_DEFINE(USE_KQUEUE, 1, Use kqueue.)
80 + AC_MSG_RESULT(yes)
81 ++ TORRENT_CHECK_KQUEUE_SOCKET_ONLY
82 + ], [
83 + AC_MSG_RESULT(no)
84 + ])
85 +@@ -137,7 +138,6 @@ AC_DEFUN([TORRENT_WITH_KQUEUE], [
86 + [
87 + if test "$withval" = "yes"; then
88 + TORRENT_CHECK_KQUEUE
89 +- TORRENT_CHECK_KQUEUE_SOCKET_ONLY
90 + fi
91 + ])
92 + ])
93 +@@ -149,11 +149,9 @@ AC_DEFUN([TORRENT_WITHOUT_KQUEUE], [
94 + [
95 + if test "$withval" = "yes"; then
96 + TORRENT_CHECK_KQUEUE
97 +- TORRENT_CHECK_KQUEUE_SOCKET_ONLY
98 + fi
99 + ], [
100 + TORRENT_CHECK_KQUEUE
101 +- TORRENT_CHECK_KQUEUE_SOCKET_ONLY
102 + ])
103 + ])
104 +
105
106 diff --git a/net-libs/libtorrent/libtorrent-0.13.7-r1.ebuild b/net-libs/libtorrent/libtorrent-0.13.7-r1.ebuild
107 new file mode 100644
108 index 00000000000..9b0f0ae7df4
109 --- /dev/null
110 +++ b/net-libs/libtorrent/libtorrent-0.13.7-r1.ebuild
111 @@ -0,0 +1,70 @@
112 +# Copyright 1999-2018 Gentoo Foundation
113 +# Distributed under the terms of the GNU General Public License v2
114 +
115 +EAPI=6
116 +
117 +inherit autotools toolchain-funcs
118 +
119 +DESCRIPTION="BitTorrent library written in C++ for *nix"
120 +HOMEPAGE="https://rakshasa.github.io/rtorrent/"
121 +SRC_URI="http://rtorrent.net/downloads/${P}.tar.gz"
122 +
123 +LICENSE="GPL-2"
124 +
125 +# The README says that the library ABI is not yet stable and dependencies on
126 +# the library should be an explicit, syncronized version until the library
127 +# has had more time to mature. Until it matures we should not include a soname
128 +# subslot.
129 +SLOT="0"
130 +
131 +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"
132 +IUSE="debug libressl ssl test"
133 +
134 +RDEPEND="
135 + sys-libs/zlib
136 + >=dev-libs/libsigc++-2.2.2:2
137 + ssl? (
138 + !libressl? ( dev-libs/openssl:0= )
139 + libressl? ( dev-libs/libressl:= )
140 + )"
141 +DEPEND="${RDEPEND}
142 + virtual/pkgconfig
143 + dev-util/cppunit"
144 +
145 +PATCHES=(
146 + "${FILESDIR}/${PN}-0001-Fix-the-DH-parameters-generation-with-OpenSSL-1.1.patch"
147 + "${FILESDIR}/${PN}-openssl-1.1-part2.patch"
148 + "${FILESDIR}/${PN}-openssl-1.1-part3.patch"
149 + "${FILESDIR}/${PN}-0.13.7-kqueue-configure.patch"
150 + "${FILESDIR}/${PN}-0.13.7-execinfo-configure.patch"
151 +)
152 +
153 +src_prepare() {
154 + default
155 + eautoreconf
156 +}
157 +
158 +src_configure() {
159 + # bug 518582
160 + local disable_instrumentation
161 + 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
162 + $(tc-getCC) ${CFLAGS} -o /dev/null -x c "${T}/sync_add_and_fetch.c" >/dev/null 2>&1
163 + if [[ $? -ne 0 ]]; then
164 + disable_instrumentation="--disable-instrumentation"
165 + fi
166 +
167 + # configure needs bash or script bombs out on some null shift, bug #291229
168 + CONFIG_SHELL=${BASH} econf \
169 + --enable-aligned \
170 + $(use_enable debug) \
171 + $(use_enable ssl openssl) \
172 + ${disable_instrumentation} \
173 + --with-posix-fallocate \
174 + --with-zlib="${EROOT%/}/usr/"
175 +}
176 +
177 +src_install() {
178 + default
179 +
180 + find "${D}" -name '*.la' -delete
181 +}