Adds Transmission 1.72

This commit is contained in:
Eric Petit
2009-07-09 11:09:39 +00:00
parent 6dffb653d9
commit c05cc33806
2 changed files with 452 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
DESCRIPTION="Transmission"
HOMEPAGE="http://www.transmissionbt.com/"
SRC_URI="http://mirrors.m0k.org/transmission/files/transmission-1.72.tar.bz2"
REVISION="1"
STATUS_R5="untested"
STATUS_BONE="untested"
# gcc4 is required
STATUS_HAIKU="stable"
# pkgconfig is only a build dependency
DEPEND="pkgconfig, curl, libevent"
BUILD {
cd transmission-1.72
autoreconf -vfi
./configure --prefix=/boot/common
make
}
INSTALL {
cd transmission-1.72
make install
}

View File

@@ -0,0 +1,428 @@
diff -Naur transmission-1.72/cli/Makefile.am transmission-1.72-haiku/cli/Makefile.am
--- transmission-1.72/cli/Makefile.am 2009-06-17 00:01:54.000000000 +0000
+++ transmission-1.72-haiku/cli/Makefile.am 2009-07-09 10:05:58.000000000 +0000
@@ -26,6 +26,5 @@
$(LIBCURL_LIBS) \
$(ZLIB_LIBS) \
$(OPENSSL_LIBS) \
- $(PTHREAD_LIBS) \
- -lm
+ $(PTHREAD_LIBS)
diff -Naur transmission-1.72/configure.ac transmission-1.72-haiku/configure.ac
--- transmission-1.72/configure.ac 2009-06-17 00:01:56.000000000 +0000
+++ transmission-1.72-haiku/configure.ac 2009-07-09 10:10:19.000000000 +0000
@@ -163,7 +163,8 @@
dnl build our copy of libevent whether we use it or not,
dnl because "make dist" needs its Makefiles to exist, and
dnl AM_CONDITIONAL + AC_CONFIG_SUBDIRS don't seem to play nice
-AC_CONFIG_SUBDIRS([third-party/libevent])
+dnl (HaikuPorts only: require an installed copy)
+dnl AC_CONFIG_SUBDIRS([third-party/libevent])
libevent_source=bundled
AC_CHECK_LIB([event],[evutil_vsnprintf],
[libevent_found=yes],
@@ -179,13 +180,19 @@
fi
fi
if test "x$libevent_source" = "xbundled"; then
+ dnl (HaikuPorts only: require an installed copy)
+ AC_MSG_ERROR("libevent not found!")
AC_MSG_WARN([using our own libevent from third-party/libevent/])
AC_MSG_WARN([if you are cross-compiling this is probably NOT what you want.])
LIBEVENT_CFLAGS="-I\$(top_srcdir)/third-party/libevent -I\$(top_builddir)/third-party/libevent"
LIBEVENT_LIBS="\$(top_builddir)/third-party/libevent/libevent.la"
else
LIBEVENT_CFLAGS=""
- LIBEVENT_LIBS="-levent -lrt"
+ dnl FIXME Shouldn't libtool handle this?
+ case "${host_os}" in
+ haiku*) LIBEVENT_LIBS="-levent" ;;
+ *) LIBEVENT_LIBS="-levent -lrt" ;;
+ esac
fi
AC_SUBST(LIBEVENT_CFLAGS)
AC_SUBST(LIBEVENT_LIBS)
@@ -277,17 +284,19 @@
fi
use_nls=no
-if test "x$enable_nls" = "xyes" ; then
- use_nls=yes
- IT_PROG_INTLTOOL([0.40.0],[no-xml])
- AC_CHECK_HEADERS([libintl.h])
- GETTEXT_PACKAGE=transmission
- AC_SUBST(GETTEXT_PACKAGE)
- AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
- AM_GLIB_GNU_GETTEXT
- transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
- AC_SUBST(transmissionlocaledir)
-fi
+dnl HACK for Haiku: comment this whole part because we don't need it and
+dnl it would require us to have intltool installed only to run autoconf
+dnl if test "x$enable_nls" = "xyes" ; then
+dnl use_nls=yes
+dnl IT_PROG_INTLTOOL([0.40.0],[no-xml])
+dnl AC_CHECK_HEADERS([libintl.h])
+dnl GETTEXT_PACKAGE=transmission
+dnl AC_SUBST(GETTEXT_PACKAGE)
+dnl AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"],[Gettext package])
+dnl AM_GLIB_GNU_GETTEXT
+dnl transmissionlocaledir='${prefix}/${DATADIRNAME}/locale'
+dnl AC_SUBST(transmissionlocaledir)
+dnl fi
dnl ----------------------------------------------------------------------------
diff -Naur transmission-1.72/daemon/Makefile.am transmission-1.72-haiku/daemon/Makefile.am
--- transmission-1.72/daemon/Makefile.am 2009-06-17 00:01:54.000000000 +0000
+++ transmission-1.72-haiku/daemon/Makefile.am 2009-07-09 10:05:58.000000000 +0000
@@ -28,7 +28,7 @@
$(LIBCURL_LIBS) \
$(ZLIB_LIBS) \
$(OPENSSL_LIBS) \
- $(PTHREAD_LIBS) -lm
+ $(PTHREAD_LIBS)
noinst_HEADERS = \
watch.h
diff -Naur transmission-1.72/libtransmission/JSON_parser.c transmission-1.72-haiku/libtransmission/JSON_parser.c
--- transmission-1.72/libtransmission/JSON_parser.c 2009-06-17 00:01:44.000000000 +0000
+++ transmission-1.72-haiku/libtransmission/JSON_parser.c 2009-07-09 10:12:28.000000000 +0000
@@ -73,6 +73,10 @@
# endif
#endif
+/* This can be removed once http://dev.haiku-os.org/ticket/3408 is fixed */
+#ifdef __HAIKU__
+# define strtold strtod
+#endif
#define true 1
#define false 0
diff -Naur transmission-1.72/libtransmission/Makefile.am transmission-1.72-haiku/libtransmission/Makefile.am
--- transmission-1.72/libtransmission/Makefile.am 2009-06-17 00:01:44.000000000 +0000
+++ transmission-1.72-haiku/libtransmission/Makefile.am 2009-07-09 10:05:58.000000000 +0000
@@ -132,8 +132,7 @@
$(LIBCURL_LIBS) \
$(OPENSSL_LIBS) \
$(PTHREAD_LIBS) \
- $(ZLIB_LIBS) \
- -lm
+ $(ZLIB_LIBS)
bencode_test_SOURCES = bencode-test.c
bencode_test_LDADD = ${apps_ldadd}
diff -Naur transmission-1.72/libtransmission/fdlimit.c transmission-1.72-haiku/libtransmission/fdlimit.c
--- transmission-1.72/libtransmission/fdlimit.c 2009-06-17 00:01:44.000000000 +0000
+++ transmission-1.72-haiku/libtransmission/fdlimit.c 2009-07-09 10:05:58.000000000 +0000
@@ -585,7 +585,6 @@
#endif
tr_err( _( "Couldn't create socket: %s" ),
tr_strerror( sockerrno ) );
- s = -sockerrno;
}
if( s > -1 )
diff -Naur transmission-1.72/libtransmission/net.c transmission-1.72-haiku/libtransmission/net.c
--- transmission-1.72/libtransmission/net.c 2009-06-17 00:01:44.000000000 +0000
+++ transmission-1.72-haiku/libtransmission/net.c 2009-07-09 10:05:58.000000000 +0000
@@ -195,25 +195,6 @@
return memcmp( &a->addr, &b->addr, sizes[a->type] );
}
-tr_bool
-tr_net_hasIPv6( tr_port port )
-{
- static tr_bool result = FALSE;
- static tr_bool alreadyDone = FALSE;
-
- if( !alreadyDone )
- {
- int fd = tr_netBindTCP( &tr_in6addr_any, port, TRUE );
- if( fd >= 0 || -fd != EAFNOSUPPORT ) /* we support ipv6 */
- result = TRUE;
- if( fd >= 0 )
- EVUTIL_CLOSESOCKET( fd );
- alreadyDone = TRUE;
- }
-
- return result;
-}
-
/***********************************************************************
* TCP sockets
**********************************************************************/
@@ -368,8 +349,8 @@
return s;
}
-int
-tr_netBindTCP( const tr_address * addr, tr_port port, tr_bool suppressMsgs )
+static int
+tr_netBindTCPImpl( const tr_address * addr, tr_port port, tr_bool suppressMsgs, int * errOut )
{
static const int domains[NUM_TR_AF_INET_TYPES] = { AF_INET, AF_INET6 };
struct sockaddr_storage sock;
@@ -380,11 +361,14 @@
assert( tr_isAddress( addr ) );
fd = socket( domains[addr->type], SOCK_STREAM, 0 );
- if( fd < 0 )
+ if( fd < 0 ) {
+ *errOut = sockerrno;
return -1;
+ }
if( evutil_make_socket_nonblocking( fd ) < 0 ) {
EVUTIL_CLOSESOCKET( fd );
+ *errOut = sockerrno;
return -1;
}
@@ -395,8 +379,10 @@
#ifdef IPV6_V6ONLY
if( addr->type == TR_AF_INET6 )
if( setsockopt( fd, IPPROTO_IPV6, IPV6_V6ONLY, &optval, sizeof( optval ) ) == -1 )
- if( sockerrno != ENOPROTOOPT ) /* if the kernel doesn't support it, ignore it */
- return -sockerrno;
+ if( sockerrno != ENOPROTOOPT ) { /* if the kernel doesn't support it, ignore it */
+ *errOut = sockerrno;
+ return -1;
+ }
#endif
addrlen = setup_sockaddr( addr, htons( port ), &sock );
@@ -406,7 +392,8 @@
tr_err( _( "Couldn't bind port %d on %s: %s" ),
port, tr_ntop_non_ts( addr ), tr_strerror( err ) );
EVUTIL_CLOSESOCKET( fd );
- return -err;
+ *errOut = err;
+ return -1;
}
if( !suppressMsgs )
@@ -414,13 +401,42 @@
if( listen( fd, 128 ) == -1 ) {
EVUTIL_CLOSESOCKET( fd );
- return -sockerrno;
+ *errOut = sockerrno;
+ return -1;
}
return fd;
}
int
+tr_netBindTCP( const tr_address * addr, tr_port port, tr_bool suppressMsgs )
+{
+ int unused;
+ return tr_netBindTCPImpl( addr, port, suppressMsgs, &unused );
+}
+
+tr_bool
+tr_net_hasIPv6( tr_port port )
+{
+ static tr_bool result = FALSE;
+ static tr_bool alreadyDone = FALSE;
+
+ if( !alreadyDone )
+ {
+ int err;
+ int fd = tr_netBindTCPImpl( &tr_in6addr_any, port, TRUE, &err );
+ if( fd >= 0 || err != EAFNOSUPPORT ) /* we support ipv6 */
+ result = TRUE;
+ if( fd >= 0 )
+ EVUTIL_CLOSESOCKET( fd );
+ tr_inf( "IPv6 support: %s", result ? "yes" : "no" );
+ alreadyDone = TRUE;
+ }
+
+ return result;
+}
+
+int
tr_netAccept( tr_session * session UNUSED,
int b,
tr_address * addr,
diff -Naur transmission-1.72/libtransmission/net.h transmission-1.72-haiku/libtransmission/net.h
--- transmission-1.72/libtransmission/net.h 2009-06-17 00:01:44.000000000 +0000
+++ transmission-1.72-haiku/libtransmission/net.h 2009-07-09 10:13:49.000000000 +0000
@@ -56,6 +56,32 @@
#define sockerrno errno
#endif
+/* To be removed once those macros are added to Haiku's headers */
+#ifndef IN6ADDR_ANY_INIT
+ #define IN6ADDR_ANY_INIT {{{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}}
+#endif
+#ifndef INET6_ADDRSTRLEN
+ #define INET6_ADDRSTRLEN 46
+#endif
+#ifndef IN6_IS_ADDR_V4MAPPED
+ #define IN6_IS_ADDR_V4MAPPED(a) \
+ ((((const uint32_t *) (a))[0] == 0) && \
+ (((const uint32_t *) (a))[1] == 0) && \
+ (((const uint32_t *) (a))[2] == htonl(0xFFFF)))
+#endif
+#ifndef IN6_IS_ADDR_V4COMPAT
+ #define IN6_IS_ADDR_V4COMPAT(a) \
+ ((((const uint32_t *) (a))[0] == 0) && \
+ (((const uint32_t *) (a))[1] == 0) && \
+ (((const uint32_t *) (a))[2] == 0) && \
+ (ntohl(((const uint32_t *) (a))[2]) > 1))
+#endif
+#ifndef IN6_IS_ADDR_LINKLOCAL
+ #define IN6_IS_ADDR_LINKLOCAL(a) \
+ ((((const uint32_t *) (a))[0] & htonl(0xFFC00000)) \
+ == htonl(0xFE800000))
+#endif
+
struct tr_session;
typedef enum tr_address_type
diff -Naur transmission-1.72/libtransmission/platform.c transmission-1.72-haiku/libtransmission/platform.c
--- transmission-1.72/libtransmission/platform.c 2009-06-17 00:01:44.000000000 +0000
+++ transmission-1.72-haiku/libtransmission/platform.c 2009-07-09 10:07:24.000000000 +0000
@@ -17,7 +17,9 @@
#ifdef SYS_DARWIN
#include <CoreFoundation/CoreFoundation.h>
#endif
-
+ #ifdef __HAIKU__
+ #include <FindDirectory.h>
+ #endif
#define _XOPEN_SOURCE 600 /* needed for recursive locks. */
#ifndef __USE_UNIX98
#define __USE_UNIX98 /* some older Linuxes need it spelt out for them */
@@ -271,6 +273,10 @@
char appdata[MAX_PATH]; /* SHGetFolderPath() requires MAX_PATH */
SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata );
path = tr_buildPath( appdata, "Transmission", NULL );
+#elif defined( __HAIKU__ )
+ char buf[MAX_PATH_LENGTH];
+ find_directory( B_USER_SETTINGS_DIRECTORY, -1, true, buf, sizeof(buf) );
+ path = tr_buildPath( buf, "Transmission", NULL );
#else
path = tr_buildPath( getHomeDir( ), ".transmission", NULL );
#endif
@@ -431,6 +437,10 @@
char appdata[MAX_PATH]; /* SHGetFolderPath() requires MAX_PATH */
SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata );
s = tr_buildPath( appdata, appname, NULL );
+#elif defined( __HAIKU__ )
+ char buf[MAX_PATH_LENGTH];
+ find_directory( B_USER_SETTINGS_DIRECTORY, -1, true, buf, sizeof(buf) );
+ s = tr_buildPath( buf, appname, NULL );
#else
if( ( s = getenv( "XDG_CONFIG_HOME" ) ) )
s = tr_buildPath( s, appname, NULL );
@@ -486,7 +496,11 @@
}
if( user_dir == NULL )
+#ifdef __HAIKU__
+ user_dir = tr_buildPath( getHomeDir( ), "Desktop", NULL );
+#else
user_dir = tr_buildPath( getHomeDir( ), "Downloads", NULL );
+#endif
tr_free( content );
tr_free( config_file );
diff -Naur transmission-1.72/third-party/Makefile.am transmission-1.72-haiku/third-party/Makefile.am
--- transmission-1.72/third-party/Makefile.am 2009-06-17 00:01:54.000000000 +0000
+++ transmission-1.72-haiku/third-party/Makefile.am 2009-07-09 10:05:58.000000000 +0000
@@ -1,5 +1,5 @@
-SUBDIRS = libnatpmp miniupnp dht libevent
+SUBDIRS = libnatpmp miniupnp dht
EXTRA_DIST = macosx-libevent-config.h
diff -Naur transmission-1.72/third-party/libnatpmp/getgateway.c transmission-1.72-haiku/third-party/libnatpmp/getgateway.c
--- transmission-1.72/third-party/libnatpmp/getgateway.c 2009-06-17 00:01:54.000000000 +0000
+++ transmission-1.72-haiku/third-party/libnatpmp/getgateway.c 2009-07-09 10:05:58.000000000 +0000
@@ -75,6 +75,12 @@
#define MAX_KEY_LENGTH 255
#define MAX_VALUE_LENGTH 16383
#endif
+#ifdef __HAIKU__
+#include <stdlib.h>
+#include <unistd.h>
+#include <net/if.h>
+#include <sys/sockio.h>
+#endif
#include "getgateway.h"
#ifndef WIN32
@@ -421,3 +427,56 @@
}
#endif /* #ifdef USE_WIN32_CODE */
+#ifdef __HAIKU__
+int getdefaultgateway(in_addr_t *addr)
+{
+ int fd, ret = -1;
+ struct ifconf config;
+ void *buffer = NULL;
+ struct ifreq *interface;
+
+ if ((fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
+ return -1;
+ }
+ if (ioctl(fd, SIOCGRTSIZE, &config, sizeof(config)) != 0) {
+ goto fail;
+ }
+ if (config.ifc_value < 1) {
+ goto fail; /* No routes */
+ }
+ if ((buffer = malloc(config.ifc_value)) == NULL) {
+ goto fail;
+ }
+ config.ifc_len = config.ifc_value;
+ config.ifc_buf = buffer;
+ if (ioctl(fd, SIOCGRTTABLE, &config, sizeof(config)) != 0) {
+ goto fail;
+ }
+ for (interface = buffer;
+ (uint8_t *)interface < (uint8_t *)buffer + config.ifc_len; ) {
+ struct route_entry route = interface->ifr_route;
+ int intfSize;
+ if (route.flags & (RTF_GATEWAY | RTF_DEFAULT)) {
+ *addr = ((struct sockaddr_in *)route.gateway)->sin_addr.s_addr;
+ ret = 0;
+ break;
+ }
+ intfSize = sizeof(route) + IF_NAMESIZE;
+ if (route.destination != NULL) {
+ intfSize += route.destination->sa_len;
+ }
+ if (route.mask != NULL) {
+ intfSize += route.mask->sa_len;
+ }
+ if (route.gateway != NULL) {
+ intfSize += route.gateway->sa_len;
+ }
+ interface = (struct ifreq *)((uint8_t *)interface + intfSize);
+ }
+fail:
+ free(buffer);
+ close(fd);
+ return ret;
+}
+#endif
+
diff -Naur transmission-1.72/third-party/miniupnp/upnpreplyparse.h transmission-1.72-haiku/third-party/miniupnp/upnpreplyparse.h
--- transmission-1.72/third-party/miniupnp/upnpreplyparse.h 2009-06-17 00:01:54.000000000 +0000
+++ transmission-1.72-haiku/third-party/miniupnp/upnpreplyparse.h 2009-07-09 10:05:59.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>