summaryrefslogtreecommitdiff
blob: cdf1872d7131d0c89268a7badad7745c4f4b30c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
diff -urN transmission-2.42.old/cli/Makefile.am transmission-2.42/cli/Makefile.am
--- transmission-2.42.old/cli/Makefile.am	2012-01-25 12:30:32.737406480 +0100
+++ transmission-2.42/cli/Makefile.am	2012-01-25 15:25:14.903209957 +0100
@@ -19,7 +19,7 @@
 transmission_cli_LDADD = \
     $(top_builddir)/libtransmission/libtransmission.a \
     @LIBUPNP_LIBS@ \
-    $(top_builddir)/third-party/libnatpmp/libnatpmp.a \
+    @LIBNATPMP_LIBS@ \
     @DHT_LIBS@ \
     @LIBUTP_LIBS@ \
     @LIBEVENT_LIBS@ \
diff -urN transmission-2.42.old/configure.ac transmission-2.42/configure.ac
--- transmission-2.42.old/configure.ac	2012-01-25 12:30:32.742406446 +0100
+++ transmission-2.42/configure.ac	2012-01-25 14:45:14.264515474 +0100
@@ -302,6 +302,29 @@
 AC_SUBST(LIBUPNP_CFLAGS)
 AC_SUBST(LIBUPNP_LIBS)
 AC_SUBST(LIBUPNP_LIBS_QT)
+
+dnl ----------------------------------------------------------------------------
+dnl
+dnl  Allow usage of system natpmp library
+LIBNATPMP_CFLAGS="-I\$(top_srcdir)/third-party/libnatpmp/"
+LIBNATPMP_LIBS="\$(top_builddir)/third-party/natpmp/libnatpmp.a"
+LIBNATPMP_LIBS_QT="\$\${TRANSMISSION_TOP}/third-party/natpmp/libnatpmp.a"
+build_bundled_natpmp="yes"
+AC_ARG_ENABLE([external-natpmp],
+              AS_HELP_STRING([--enable-external-natpmp],[Use system external-natpmp]),
+              [want_external_natpmp=${enableval}],
+              [want_external_natpmp=no])
+if test "x$want_external_natpmp" != "xno" ; then
+        dnl Would be lovely if it had pkgconfig
+        LIBNATPMP_CFLAGS="" 
+        LIBNATPMP_LIBS="-lnatpmp"
+        LIBNATPMP_LIBS_QT="-lnatpmp"
+        build_bundled_natpmp="no"
+fi
+AM_CONDITIONAL([BUILD_NATPMP],[test "x$build_bundled_natpmp" = "xyes"])
+AC_SUBST(LIBNATPMP_CFLAGS)
+AC_SUBST(LIBNATPMP_LIBS)
+AC_SUBST(LIBNATPMP_LIBS_QT)
 dnl ----------------------------------------------------------------------------
 dnl
 dnl  detection for the GTK+ client
diff -urN transmission-2.42.old/daemon/Makefile.am transmission-2.42/daemon/Makefile.am
--- transmission-2.42.old/daemon/Makefile.am	2012-01-25 12:30:32.742406446 +0100
+++ transmission-2.42/daemon/Makefile.am	2012-01-25 12:48:10.476222152 +0100
@@ -21,7 +21,7 @@
 LDADD = \
     $(top_builddir)/libtransmission/libtransmission.a \
     @LIBUPNP_LIBS@ \
-    $(top_builddir)/third-party/libnatpmp/libnatpmp.a \
+    @LIBNATPMP_LIBS@ \
     @DHT_LIBS@ \
     @LIBUTP_LIBS@ \
     @LIBEVENT_LIBS@ \
diff -urN transmission-2.42.old/gtk/Makefile.am transmission-2.42/gtk/Makefile.am
--- transmission-2.42.old/gtk/Makefile.am	2012-01-25 12:30:32.742406446 +0100
+++ transmission-2.42/gtk/Makefile.am	2012-01-25 14:46:46.797886956 +0100
@@ -85,7 +85,7 @@
 transmission_gtk_LDADD = \
     $(top_builddir)/libtransmission/libtransmission.a \
     @LIBUPNP_LIBS@ \
-    $(top_builddir)/third-party/libnatpmp/libnatpmp.a \
+    @LIBNATPMP_LIBS@ \
     @DHT_LIBS@ \
     @LIBUTP_LIBS@ \
     @GTK_LIBS@ \
diff -urN transmission-2.42.old/libtransmission/Makefile.am transmission-2.42/libtransmission/Makefile.am
--- transmission-2.42.old/libtransmission/Makefile.am	2012-01-25 12:30:32.739406466 +0100
+++ transmission-2.42/libtransmission/Makefile.am	2012-01-25 15:10:54.507053909 +0100
@@ -1,7 +1,5 @@
 AM_CPPFLAGS = \
-    -I. \
     -I$(top_srcdir) \
-    -I$(top_srcdir)/third-party/ \
     -D__TRANSMISSION__ \
     -DPACKAGE_DATA_DIR=\""$(datadir)"\"
 
@@ -9,6 +7,7 @@
     @DHT_CFLAGS@ \
     @LIBUTP_CFLAGS@ \
     @LIBUPNP_CFLAGS@ \
+    @LIBNATPMP_CFLAGS@ \
     @LIBEVENT_CFLAGS@ \
     @LIBCURL_CFLAGS@ \
     @OPENSSL_CFLAGS@ \
@@ -91,7 +90,7 @@
     magnet.h \
     makemeta.h \
     metainfo.h \
-    natpmp.h \
+    natpmp_local.h \
     net.h \
     peer-common.h \
     peer-io.h \
@@ -141,7 +140,7 @@
 apps_ldadd = \
     ./libtransmission.a  \
     @LIBUPNP_LIBS@ \
-    $(top_builddir)/third-party/libnatpmp/libnatpmp.a \
+    @LIBNATPMP_LIBS@ \
     @INTLLIBS@ \
     @DHT_LIBS@ \
     @LIBUTP_LIBS@ \
diff -urN transmission-2.42.old/libtransmission/natpmp.c transmission-2.42/libtransmission/natpmp.c
--- transmission-2.42.old/libtransmission/natpmp.c	2012-01-25 12:30:32.739406466 +0100
+++ transmission-2.42/libtransmission/natpmp.c	2012-01-25 15:11:10.186947403 +0100
@@ -17,10 +17,10 @@
 #include <event2/util.h> /* evutil_inet_ntop() */
 
 #define ENABLE_STRNATPMPERR
-#include <libnatpmp/natpmp.h>
+#include "natpmp.h"
 
 #include "transmission.h"
-#include "natpmp.h"
+#include "natpmp_local.h"
 #include "net.h" /* tr_netCloseSocket */
 #include "port-forwarding.h"
 #include "utils.h"
diff -urN transmission-2.42.old/libtransmission/natpmp.h transmission-2.42/libtransmission/natpmp.h
--- transmission-2.42.old/libtransmission/natpmp.h	2012-01-25 12:30:32.739406466 +0100
+++ transmission-2.42/libtransmission/natpmp.h	1970-01-01 01:00:00.000000000 +0100
@@ -1,34 +0,0 @@
-/*
- * This file Copyright (C) Mnemosyne LLC
- *
- * This file is licensed by the GPL version 2. Works owned by the
- * Transmission project are granted a special exemption to clause 2(b)
- * so that the bulk of its code can remain under the MIT license.
- * This exemption does not extend to derived works not owned by
- * the Transmission project.
- *
- * $Id: natpmp.h 12204 2011-03-22 15:19:54Z jordan $
- */
-
-#ifndef __TRANSMISSION__
-#error only libtransmission should #include this header.
-#endif
-
-#ifndef TR_NATPMP_H
-#define TR_NATPMP_H 1
-
-/**
- * @addtogroup port_forwarding Port Forwarding
- * @{
- */
-
-typedef struct tr_natpmp tr_natpmp;
-
-tr_natpmp * tr_natpmpInit( void );
-
-void tr_natpmpClose( tr_natpmp * );
-
-int tr_natpmpPulse( tr_natpmp *, tr_port port, bool isEnabled, tr_port * public_port );
-
-/* @} */
-#endif
diff -urN transmission-2.42.old/libtransmission/natpmp_local.h transmission-2.42/libtransmission/natpmp_local.h
--- transmission-2.42.old/libtransmission/natpmp_local.h	1970-01-01 01:00:00.000000000 +0100
+++ transmission-2.42/libtransmission/natpmp_local.h	2012-01-25 12:27:55.513474369 +0100
@@ -0,0 +1,34 @@
+/*
+ * This file Copyright (C) Mnemosyne LLC
+ *
+ * This file is licensed by the GPL version 2. Works owned by the
+ * Transmission project are granted a special exemption to clause 2(b)
+ * so that the bulk of its code can remain under the MIT license.
+ * This exemption does not extend to derived works not owned by
+ * the Transmission project.
+ *
+ * $Id: natpmp.h 12204 2011-03-22 15:19:54Z jordan $
+ */
+
+#ifndef __TRANSMISSION__
+#error only libtransmission should #include this header.
+#endif
+
+#ifndef TR_NATPMP_H
+#define TR_NATPMP_H 1
+
+/**
+ * @addtogroup port_forwarding Port Forwarding
+ * @{
+ */
+
+typedef struct tr_natpmp tr_natpmp;
+
+tr_natpmp * tr_natpmpInit( void );
+
+void tr_natpmpClose( tr_natpmp * );
+
+int tr_natpmpPulse( tr_natpmp *, tr_port port, bool isEnabled, tr_port * public_port );
+
+/* @} */
+#endif
diff -urN transmission-2.42.old/libtransmission/port-forwarding.c transmission-2.42/libtransmission/port-forwarding.c
--- transmission-2.42.old/libtransmission/port-forwarding.c	2012-01-25 12:30:32.739406466 +0100
+++ transmission-2.42/libtransmission/port-forwarding.c	2012-01-25 15:19:34.684520801 +0100
@@ -18,7 +18,7 @@
 #include <event2/event.h>
 
 #include "transmission.h"
-#include "natpmp.h"
+#include "natpmp_local.h"
 #include "net.h"
 #include "peer-mgr.h"
 #include "port-forwarding.h"
diff -urN transmission-2.42.old/qt/config.in transmission-2.42/qt/config.in
--- transmission-2.42.old/qt/config.in	2012-01-25 12:30:32.741406452 +0100
+++ transmission-2.42/qt/config.in	2012-01-25 14:47:43.390502589 +0100
@@ -1,3 +1,4 @@
 LIBUTP_LIBS = @LIBUTP_LIBS_QT@
 MINIUPNP_LIBS = @LIBUPNP_LIBS_QT@
+NATPNP_LIBS = @LIBNATPNP_LIBS_QT@
 
diff -urN transmission-2.42.old/qt/qtr.pro transmission-2.42/qt/qtr.pro
--- transmission-2.42.old/qt/qtr.pro	2012-01-25 12:30:32.742406446 +0100
+++ transmission-2.42/qt/qtr.pro	2012-01-25 14:47:32.270578114 +0100
@@ -24,7 +24,7 @@
 LIBS += $${LIBUTP_LIBS}
 LIBS += $${TRANSMISSION_TOP}/third-party/dht/libdht.a
 LIBS += $${MINIUPNP_LIBS}
-LIBS += $${TRANSMISSION_TOP}/third-party/libnatpmp/libnatpmp.a
+LIBS += $${NATPNP_LIBS}
 unix: LIBS += -L$${EVENT_TOP}/lib -lz -lrt
 win32:DEFINES += QT_DBUS
 win32:LIBS += -levent-2.0 -lws2_32 -lintl
diff -urN transmission-2.42.old/third-party/Makefile.am transmission-2.42/third-party/Makefile.am
--- transmission-2.42.old/third-party/Makefile.am	2012-01-25 12:30:32.702406719 +0100
+++ transmission-2.42/third-party/Makefile.am	2012-01-25 14:45:04.312583068 +0100
@@ -4,10 +4,13 @@
 if BUILD_MINIUPNP
   MINIUPNP_DIR = miniupnp
 endif
+if BUILD_NATPMP
+  NATPMP_DIR = libnatpmp
+endif
 
 SUBDIRS = \
   dht \
-  libnatpmp \
+  $(NATPMP_DIR) \
   $(MINIUPNP_DIR) \
   $(UTP_DIR)
 
diff -urN transmission-2.42.old/utils/Makefile.am transmission-2.42/utils/Makefile.am
--- transmission-2.42.old/utils/Makefile.am	2012-01-25 12:30:32.744406434 +0100
+++ transmission-2.42/utils/Makefile.am	2012-01-25 12:48:14.787192871 +0100
@@ -27,7 +27,7 @@
 transmission_create_LDADD = \
     $(top_builddir)/libtransmission/libtransmission.a \
     @LIBUPNP_LIBS@ \
-    $(top_builddir)/third-party/libnatpmp/libnatpmp.a \
+    @LIBNATPMP_LIBS@ \
     @INTLLIBS@ \
     @DHT_LIBS@ \
     @LIBUTP_LIBS@ \