1 |
commit: 75def684be04605c57136532039683b5dacc5fa4 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Jul 11 09:02:25 2016 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Jul 11 09:02:39 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75def684 |
7 |
|
8 |
net-analyzer/openbsd-netcat: better fix for Darwin |
9 |
|
10 |
Package-Manager: portage-2.2.28 |
11 |
|
12 |
.../files/openbsd-netcat-1.105-darwin.patch | 86 ++++++++++++++++++++++ |
13 |
.../openbsd-netcat/openbsd-netcat-1.105-r1.ebuild | 8 +- |
14 |
2 files changed, 89 insertions(+), 5 deletions(-) |
15 |
|
16 |
diff --git a/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.105-darwin.patch b/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.105-darwin.patch |
17 |
new file mode 100644 |
18 |
index 0000000..8c68a66 |
19 |
--- /dev/null |
20 |
+++ b/net-analyzer/openbsd-netcat/files/openbsd-netcat-1.105-darwin.patch |
21 |
@@ -0,0 +1,86 @@ |
22 |
+Allow compilation on Darwin |
23 |
+ |
24 |
+--- netcat.c |
25 |
++++ netcat.c |
26 |
+@@ -43,11 +43,13 @@ |
27 |
+ #include <arpa/telnet.h> |
28 |
+ #include <arpa/inet.h> |
29 |
+ |
30 |
++#ifndef IPTOS_LOWCOST |
31 |
++# define IPTOS_LOWCOST 0x02 |
32 |
++#endif |
33 |
+ #ifndef IPTOS_LOWDELAY |
34 |
+ # define IPTOS_LOWDELAY 0x10 |
35 |
+ # define IPTOS_THROUGHPUT 0x08 |
36 |
+ # define IPTOS_RELIABILITY 0x04 |
37 |
+-# define IPTOS_LOWCOST 0x02 |
38 |
+ # define IPTOS_MINCOST IPTOS_LOWCOST |
39 |
+ #endif /* IPTOS_LOWDELAY */ |
40 |
+ |
41 |
+@@ -96,8 +98,9 @@ |
42 |
+ #include <unistd.h> |
43 |
+ #include <fcntl.h> |
44 |
+ #include <limits.h> |
45 |
+-#include <bsd/stdlib.h> |
46 |
+-#include <bsd/string.h> |
47 |
++#include <stdlib.h> |
48 |
++#include <string.h> |
49 |
++#include <ctype.h> |
50 |
+ #include "atomicio.h" |
51 |
+ |
52 |
+ #ifndef SUN_LEN |
53 |
+@@ -169,6 +172,43 @@ |
54 |
+ socklen_t salen, int ctimeout); |
55 |
+ static void quit(); |
56 |
+ |
57 |
++static char* strtonumerrs[] = { |
58 |
++ "too large", |
59 |
++ "too small", |
60 |
++ "invalid" |
61 |
++}; |
62 |
++ |
63 |
++static long long |
64 |
++strtonum( |
65 |
++ const char *nptr, |
66 |
++ long long minval, |
67 |
++ long long maxval, |
68 |
++ const char **errstr) |
69 |
++{ |
70 |
++ long long val; |
71 |
++ |
72 |
++ while (*nptr != '\0' && isspace(*nptr)) |
73 |
++ nptr++; |
74 |
++ if (*nptr == '\0') { |
75 |
++ if (errstr != NULL) |
76 |
++ *errstr = strtonumerrs[2]; |
77 |
++ return 0; |
78 |
++ } |
79 |
++ val = atoll(nptr); |
80 |
++ if (val < minval) { |
81 |
++ if (errstr != NULL) |
82 |
++ *errstr = strtonumerrs[1]; |
83 |
++ return 0; |
84 |
++ } |
85 |
++ if (val > maxval) { |
86 |
++ if (errstr != NULL) |
87 |
++ *errstr = strtonumerrs[0]; |
88 |
++ return 0; |
89 |
++ } |
90 |
++ *errstr = NULL; |
91 |
++ return val; |
92 |
++} |
93 |
++ |
94 |
+ int |
95 |
+ main(int argc, char *argv[]) |
96 |
+ { |
97 |
+--- socks.c |
98 |
++++ socks.c |
99 |
+@@ -38,7 +38,7 @@ |
100 |
+ #include <string.h> |
101 |
+ #include <unistd.h> |
102 |
+ #include <resolv.h> |
103 |
+-#include <bsd/readpassphrase.h> |
104 |
++#include <readpassphrase.h> |
105 |
+ #include "atomicio.h" |
106 |
+ |
107 |
+ #define SOCKS_PORT "1080" |
108 |
|
109 |
diff --git a/net-analyzer/openbsd-netcat/openbsd-netcat-1.105-r1.ebuild b/net-analyzer/openbsd-netcat/openbsd-netcat-1.105-r1.ebuild |
110 |
index f20c5c3..e80ac3a 100644 |
111 |
--- a/net-analyzer/openbsd-netcat/openbsd-netcat-1.105-r1.ebuild |
112 |
+++ b/net-analyzer/openbsd-netcat/openbsd-netcat-1.105-r1.ebuild |
113 |
@@ -4,7 +4,7 @@ |
114 |
|
115 |
EAPI=6 |
116 |
|
117 |
-inherit toolchain-funcs flag-o-matic |
118 |
+inherit toolchain-funcs eutils |
119 |
|
120 |
DESCRIPTION="The OpenBSD network swiss army knife" |
121 |
HOMEPAGE="http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/nc/" |
122 |
@@ -29,10 +29,8 @@ PATCHES=( "${WORKDIR}/debian/patches" ) |
123 |
src_prepare() { |
124 |
default |
125 |
if [[ ${CHOST} == *-darwin* ]] ; then |
126 |
- # Darwin = BSD, so remove libbsd dependency |
127 |
- sed -i -e '/#include/s|bsd/||' -e 's/strtonum/strtoimax/' *.[ch] || die |
128 |
- # Clang defaults to C99, but strtoimax isn't in C99 |
129 |
- append-flags -DIPTOS_LOWCOST=0x02 -std=c89 |
130 |
+ # this undoes some of the Debian/Linux changes |
131 |
+ epatch "${FILESDIR}"/${P}-darwin.patch |
132 |
fi |
133 |
} |