Work-In-Progress -- actually stalled due to lack of IPv6 :

Patch for Transmission 1.51+ svn revision 8039
Building on Haiku gcc2 revision 29322
This commit is contained in:
Matt Madia
2009-03-07 07:39:14 +00:00
parent a30d63e506
commit 0a45dff888

View File

@@ -0,0 +1,296 @@
diff -Naur transmission-1.51+-orig/configure.ac transmission-1.51+/configure.ac
--- transmission-1.51+-orig/configure.ac 2009-03-07 01:50:35.000000000 +0000
+++ transmission-1.51+/configure.ac 2009-03-07 02:01:02.000000000 +0000
@@ -62,7 +62,7 @@
AC_C_INLINE
if test "x$GCC" = "xyes" ; then
- CFLAGS="$CFLAGS -std=gnu99 -ggdb3 -Wall -W -Wpointer-arith -Wformat-security -Wcast-align -Wundef -Wcast-align -Wstrict-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wredundant-decls -Wnested-externs -Wunused-parameter -Wwrite-strings"
+ CFLAGS="$CFLAGS -ggdb3 -Wall -W -Wpointer-arith -Wformat-security -Wcast-align -Wundef -Wcast-align -Wstrict-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Wwrite-strings"
dnl figure out gcc version
AC_MSG_CHECKING([gcc version])
@@ -74,7 +74,7 @@
AC_MSG_RESULT($GCC_VERSION)
if test $GCC_VERSION_NUM -ge 304; then
dnl these were added in 3.4
- CFLAGS="$CFLAGS -Wextra -Wdeclaration-after-statement -Winit-self"
+ CFLAGS="$CFLAGS"
fi
fi
diff -Naur transmission-1.51+-orig/libtransmission/platform.c transmission-1.51+/libtransmission/platform.c
--- transmission-1.51+-orig/libtransmission/platform.c 2009-03-07 01:50:34.000000000 +0000
+++ transmission-1.51+/libtransmission/platform.c 2009-03-07 02:08:38.000000000 +0000
@@ -16,6 +16,8 @@
#else
#ifdef SYS_DARWIN
#include <CoreFoundation/CoreFoundation.h>
+ #elif defined(__HAIKU__)
+ #include <FindDirectory.h>
#endif
#define _XOPEN_SOURCE 500 /* needed for recursive locks. */
@@ -263,6 +265,12 @@
if( !path )
{
+#if defined(__HAIKU__)
+ char buf[MAX_PATH_LENGTH];
+ find_directory( B_USER_SETTINGS_DIRECTORY,
+ dev_for_path( "/boot" ), true,
+ buf, sizeof( buf ) );
+ path = tr_buildPath( buf, "Transmission", NULL );
#ifdef SYS_DARWIN
path = tr_buildPath( getHomeDir( ), "Library",
"Application Support",
@@ -305,7 +313,7 @@
if( !path )
{
-#if defined( WIN32 )
+#if defined(__HAIKU__) || defined( WIN32 )
path = tr_buildPath( getOldConfigDir( ), "Cache", NULL );
#elif defined( SYS_DARWIN )
path = tr_buildPath( getHomeDir( ), "Library", "Caches", "Transmission", NULL );
@@ -427,6 +435,9 @@
#ifdef SYS_DARWIN
s = tr_buildPath( getHomeDir( ), "Library", "Application Support",
appname, NULL );
+#elif defined(__HAIKU__)
+ s = tr_buildPath( getHomeDir( ), "config",
+ "settings", "Transmission", NULL );
#elif defined( WIN32 )
char appdata[MAX_PATH]; /* SHGetFolderPath() requires MAX_PATH */
SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata );
diff -Naur transmission-1.51+-orig/third-party/libnatpmp/getgateway.c transmission-1.51+/third-party/libnatpmp/getgateway.c
--- transmission-1.51+-orig/third-party/libnatpmp/getgateway.c 2009-03-07 01:50:34.000000000 +0000
+++ transmission-1.51+/third-party/libnatpmp/getgateway.c 2009-03-07 02:11:30.000000000 +0000
@@ -37,6 +37,18 @@
#undef USE_SYSCTL_NET_ROUTE
#endif
+#ifdef __HAIKU__
+#undef USE_PROC_NET_ROUTE
+#undef USE_SOCKET_ROUTE
+#undef USE_SYSCTL_NET_ROUTE
+/* Note: 2009-jan-10
+ *
+ * Haiku uses a BSD-like network stack.
+ * However its network stack is not yet feature complete.
+ * So for now, a workaround is needed */
+#define USE_HAIKU_WORKAROUND
+#endif
+
#ifdef __APPLE__
#undef USE_PROC_NET_ROUTE
#undef USE_SOCKET_ROUTE
@@ -82,6 +94,13 @@
#define FAILED (-1)
#endif
+#ifdef USE_HAIKU_WORKAROUND
+int getdefaultgateway(in_addr_t * addr)
+{
+ return FAILED;
+}
+#endif
+
#ifdef USE_PROC_NET_ROUTE
int getdefaultgateway(in_addr_t * addr)
{
diff -Naur transmission-1.51+-orig/third-party/miniupnp/upnpreplyparse.h transmission-1.51+/third-party/miniupnp/upnpreplyparse.h
--- transmission-1.51+-orig/third-party/miniupnp/upnpreplyparse.h 2009-03-07 01:50:34.000000000 +0000
+++ transmission-1.51+/third-party/miniupnp/upnpreplyparse.h 2009-03-07 02:12:06.000000000 +0000
@@ -8,7 +8,7 @@
#ifndef __UPNPREPLYPARSE_H__
#define __UPNPREPLYPARSE_H__
-#if defined(NO_SYS_QUEUE_H) || defined(WIN32)
+#if defined(NO_SYS_QUEUE_H) || defined(WIN32) || defined(__HAIKU__)
#include "bsdqueue.h"
#else
#include <sys/queue.h>
diff -Naur transmission-1.51+-orig/transmission-1.42-haiku-gcc2-rev4.diff transmission-1.51+/transmission-1.42-haiku-gcc2-rev4.diff
--- transmission-1.51+-orig/transmission-1.42-haiku-gcc2-rev4.diff 1970-01-01 00:00:00.000000000 +0000
+++ transmission-1.51+/transmission-1.42-haiku-gcc2-rev4.diff 2009-03-07 05:43:55.000000000 +0000
@@ -0,0 +1,179 @@
+diff -Naur transmission-1.42-orig/configure.ac transmission-1.42/configure.ac
+--- transmission-1.42-orig/configure.ac 2009-03-07 00:31:25.000000000 +0000
++++ transmission-1.42/configure.ac 2009-03-07 00:31:54.000000000 +0000
+@@ -43,7 +43,7 @@
+ AC_PROG_CC
+ AC_PROG_CXX
+ if test "x$GCC" = "xyes" ; then
+- CFLAGS="-g -Wall -Wformat-security -W -Wmissing-prototypes -Wdeclaration-after-statement -O3 -funroll-loops"
++ CFLAGS="-g -Wall -Wformat-security -W -Wmissing-prototypes -O3 -funroll-loops"
+ CXXFLAGS="-g -Wall -Wformat-security -W -O3 -funroll-loops"
+ fi
+
+diff -Naur transmission-1.42-orig/libtransmission/platform.c transmission-1.42/libtransmission/platform.c
+--- transmission-1.42-orig/libtransmission/platform.c 2009-03-07 00:31:25.000000000 +0000
++++ transmission-1.42/libtransmission/platform.c 2009-03-07 00:33:53.000000000 +0000
+@@ -22,6 +22,8 @@
+ #else
+ #ifdef SYS_DARWIN
+ #include <CoreFoundation/CoreFoundation.h>
++ #elif defined(__HAIKU__)
++ #include <FindDirectory.h>
+ #endif
+
+ #define _XOPEN_SOURCE 500 /* needed for recursive locks. */
+@@ -298,7 +300,7 @@
+
+ if( !path )
+ {
+-#ifdef __BEOS__
++#if defined(__BEOS__) || defined(__HAIKU__)
+ char buf[MAX_PATH_LENGTH];
+ find_directory( B_USER_SETTINGS_DIRECTORY,
+ dev_for_path( "/boot" ), true,
+@@ -348,7 +350,7 @@
+
+ if( !path )
+ {
+-#if defined( __BEOS__ ) || defined( WIN32 )
++#if defined( __BEOS__ ) || defined(__HAIKU__) || defined( WIN32 )
+ path = tr_buildPath( getOldConfigDir( ), "Cache", NULL );
+ #elif defined( SYS_DARWIN )
+ path = tr_buildPath( getHomeDir( ), "Library", "Caches", "Transmission", NULL );
+@@ -467,6 +469,9 @@
+ #ifdef SYS_DARWIN
+ s = tr_buildPath( getHomeDir( ), "Library",
+ "Application Support", "Transmission", NULL );
++#elif defined(__HAIKU__)
++ s = tr_buildPath( getHomeDir( ), "config",
++ "settings", "Transmission", NULL );
+ #elif defined( WIN32 )
+ char appdata[MAX_PATH]; /* SHGetFolderPath() requires MAX_PATH */
+ SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata );
+diff -Naur transmission-1.42-orig/third-party/libevent/test/bench.c transmission-1.42/third-party/libevent/test/bench.c
+--- transmission-1.42-orig/third-party/libevent/test/bench.c 2009-03-07 00:31:23.000000000 +0000
++++ transmission-1.42/third-party/libevent/test/bench.c 2009-03-07 00:33:53.000000000 +0000
+@@ -44,7 +44,7 @@
+ #include <windows.h>
+ #else
+ #include <sys/socket.h>
+-#include <sys/signal.h>
++#include <signal.h>
+ #include <sys/resource.h>
+ #endif
+ #include <fcntl.h>
+diff -Naur transmission-1.42-orig/third-party/libevent/test/regress.c transmission-1.42/third-party/libevent/test/regress.c
+--- transmission-1.42-orig/third-party/libevent/test/regress.c 2009-03-07 00:31:23.000000000 +0000
++++ transmission-1.42/third-party/libevent/test/regress.c 2009-03-07 00:33:53.000000000 +0000
+@@ -43,7 +43,7 @@
+ #ifndef WIN32
+ #include <sys/socket.h>
+ #include <sys/wait.h>
+-#include <sys/signal.h>
++#include <signal.h>
+ #include <unistd.h>
+ #include <netdb.h>
+ #endif
+diff -Naur transmission-1.42-orig/third-party/libevent/test/regress_dns.c transmission-1.42/third-party/libevent/test/regress_dns.c
+--- transmission-1.42-orig/third-party/libevent/test/regress_dns.c 2009-03-07 00:31:23.000000000 +0000
++++ transmission-1.42/third-party/libevent/test/regress_dns.c 2009-03-07 00:33:53.000000000 +0000
+@@ -42,7 +42,7 @@
+ #include <sys/queue.h>
+ #ifndef WIN32
+ #include <sys/socket.h>
+-#include <sys/signal.h>
++#include <signal.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
+ #include <unistd.h>
+@@ -89,7 +89,7 @@
+
+ switch (type) {
+ case DNS_IPv6_AAAA: {
+-#if defined(HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP)
++#if defined(HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP) && defined(INET6_ADDRSTRLEN)
+ struct in6_addr *in6_addrs = addresses;
+ char buf[INET6_ADDRSTRLEN+1];
+ int i;
+@@ -258,7 +258,7 @@
+ break;
+ }
+ case DNS_IPv6_AAAA: {
+-#if defined (HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP)
++#if defined (HAVE_STRUCT_IN6_ADDR) && defined(HAVE_INET_NTOP) && defined(INET6_ADDRSTRLEN)
+ struct in6_addr *in6_addrs = addresses;
+ char buf[INET6_ADDRSTRLEN+1];
+ if (memcmp(&in6_addrs[0].s6_addr, "abcdefghijklmnop", 16)
+diff -Naur transmission-1.42-orig/third-party/libevent/test/regress_http.c transmission-1.42/third-party/libevent/test/regress_http.c
+--- transmission-1.42-orig/third-party/libevent/test/regress_http.c 2009-03-07 00:31:23.000000000 +0000
++++ transmission-1.42/third-party/libevent/test/regress_http.c 2009-03-07 00:33:53.000000000 +0000
+@@ -42,7 +42,7 @@
+ #include <sys/queue.h>
+ #ifndef WIN32
+ #include <sys/socket.h>
+-#include <sys/signal.h>
++#include <signal.h>
+ #include <unistd.h>
+ #include <netdb.h>
+ #endif
+diff -Naur transmission-1.42-orig/third-party/libevent/test/regress_rpc.c transmission-1.42/third-party/libevent/test/regress_rpc.c
+--- transmission-1.42-orig/third-party/libevent/test/regress_rpc.c 2009-03-07 00:31:23.000000000 +0000
++++ transmission-1.42/third-party/libevent/test/regress_rpc.c 2009-03-07 00:33:53.000000000 +0000
+@@ -42,7 +42,7 @@
+ #include <sys/queue.h>
+ #ifndef WIN32
+ #include <sys/socket.h>
+-#include <sys/signal.h>
++#include <signal.h>
+ #include <unistd.h>
+ #include <netdb.h>
+ #endif
+diff -Naur transmission-1.42-orig/third-party/libnatpmp/getgateway.c transmission-1.42/third-party/libnatpmp/getgateway.c
+--- transmission-1.42-orig/third-party/libnatpmp/getgateway.c 2009-03-07 00:31:23.000000000 +0000
++++ transmission-1.42/third-party/libnatpmp/getgateway.c 2009-03-07 00:33:53.000000000 +0000
+@@ -37,6 +37,18 @@
+ #undef USE_SYSCTL_NET_ROUTE
+ #endif
+
++#ifdef __HAIKU__
++#undef USE_PROC_NET_ROUTE
++#undef USE_SOCKET_ROUTE
++#undef USE_SYSCTL_NET_ROUTE
++/* Note: 2009-jan-10
++ *
++ * Haiku uses a BSD-like network stack.
++ * However its network stack is not yet feature complete.
++ * So for now, a workaround is needed */
++#define USE_HAIKU_WORKAROUND
++#endif
++
+ #ifdef __APPLE__
+ #undef USE_PROC_NET_ROUTE
+ #undef USE_SOCKET_ROUTE
+@@ -82,6 +94,14 @@
+ #define FAILED (-1)
+ #endif
+
++
++#ifdef USE_HAIKU_WORKAROUND
++int getdefaultgateway(in_addr_t * addr)
++{
++ return FAILED;
++}
++#endif
++
+ #ifdef USE_PROC_NET_ROUTE
+ int getdefaultgateway(in_addr_t * addr)
+ {
+diff -Naur transmission-1.42-orig/third-party/miniupnp/upnpreplyparse.h transmission-1.42/third-party/miniupnp/upnpreplyparse.h
+--- transmission-1.42-orig/third-party/miniupnp/upnpreplyparse.h 2009-03-07 00:31:24.000000000 +0000
++++ transmission-1.42/third-party/miniupnp/upnpreplyparse.h 2009-03-07 00:34:44.000000000 +0000
+@@ -8,7 +8,7 @@
+ #ifndef __UPNPREPLYPARSE_H__
+ #define __UPNPREPLYPARSE_H__
+
+-#if defined(NO_SYS_QUEUE_H) || defined(WIN32)
++#if defined(NO_SYS_QUEUE_H) || defined(WIN32) || defined(__HAIKU__)
+ #include "bsdqueue.h"
+ #else
+ #include <sys/queue.h>