wiki:BuildingTransmissionQtWindows/transmission-1.71-Qt-build.diff

Version 1 (modified by rb07, 13 years ago) (diff)

--

diff -NaurX diff-excludes.txt transmission-1.71-orig/libtransmission/JSON_parser.h transmission-1.71/libtransmission/JSON_parser.h --- transmission-1.71-orig/libtransmission/JSON_parser.h 2009-05-15 13:16:34.000000000 +0000 +++ transmission-1.71/libtransmission/JSON_parser.h 2009-06-08 09:04:54.207583797 +0000 @@ -7,7 +7,7 @@

#include <stddef.h>

/* Windows DLL stuff */

-#ifdef _WIN32 +#if defined(WIN32) && !defined(STATICLIB)

# ifdef JSON_PARSER_DLL_EXPORTS # define JSON_PARSER_DLL_API declspec(dllexport) # else

diff -NaurX diff-excludes.txt transmission-1.71-orig/libtransmission/net.c transmission-1.71/libtransmission/net.c --- transmission-1.71-orig/libtransmission/net.c 2009-06-03 15:47:08.000000000 +0000 +++ transmission-1.71/libtransmission/net.c 2009-06-08 09:04:54.212619141 +0000 @@ -31,8 +31,8 @@

#include <sys/types.h>

#ifdef WIN32

  • #include <winsock2.h> /* inet_addr */
  • #include <WS2tcpip.h>

+ #define _WIN32_WINNT 0x0501 + #include <ws2tcpip.h>

#else

#include <arpa/inet.h> /* inet_addr */ #include <netdb.h>

diff -NaurX diff-excludes.txt transmission-1.71-orig/libtransmission/net.h transmission-1.71/libtransmission/net.h --- transmission-1.71-orig/libtransmission/net.h 2009-05-14 13:42:29.000000000 +0000 +++ transmission-1.71/libtransmission/net.h 2009-06-08 09:04:54.242589894 +0000 @@ -32,7 +32,7 @@

#ifdef WIN32

#include <inttypes.h> #include <winsock2.h>

  • #include <WS2tcpip.h>

+ #include <ws2tcpip.h>

typedef int socklen_t;

#else

#include <sys/types.h>

diff -NaurX diff-excludes.txt transmission-1.71-orig/libtransmission/tr-dht.c transmission-1.71/libtransmission/tr-dht.c --- transmission-1.71-orig/libtransmission/tr-dht.c 2009-06-03 23:42:13.000000000 +0000 +++ transmission-1.71/libtransmission/tr-dht.c 2009-06-08 09:04:54.256605277 +0000 @@ -25,12 +25,19 @@

#include <stdio.h>

/* posix */

-#include <netinet/in.h> /* sockaddr_in */

#include <signal.h> /* sig_atomic_t */ #include <sys/time.h>

-#include <sys/types.h> -#include <sys/socket.h> /* socket(), bind() */

#include <unistd.h> /* close() */

+#ifdef WIN32 + #include <inttypes.h> + #include <winsock2.h> + #define _WIN32_WINNT 0x0501 + #include <ws2tcpip.h> +#else + #include <sys/types.h> + #include <sys/socket.h> /* socket(), bind() */ + #include <netinet/in.h> /* sockaddr_in */ +#endif

/* third party */ #include <event.h>

diff -NaurX diff-excludes.txt transmission-1.71-orig/libtransmission/trevent.c transmission-1.71/libtransmission/trevent.c --- transmission-1.71-orig/libtransmission/trevent.c 2009-05-22 19:32:49.000000000 +0000 +++ transmission-1.71/libtransmission/trevent.c 2009-06-08 09:04:54.262800224 +0000 @@ -23,7 +23,7 @@

#ifdef WIN32

-#include <WinSock2.h> +#include <winsock2.h>

static int pgpipe( int handles[2] )

diff -NaurX diff-excludes.txt transmission-1.71-orig/libtransmission/utils.c transmission-1.71/libtransmission/utils.c --- transmission-1.71-orig/libtransmission/utils.c 2009-06-02 18:21:23.000000000 +0000 +++ transmission-1.71/libtransmission/utils.c 2009-06-08 09:04:54.269564734 +0000 @@ -1634,7 +1634,11 @@

in = tr_open_file_for_scanning( oldpath ); tr_preallocate_file( newpath, bytesLeft ); out = tr_open_file_for_writing( newpath );

+#ifdef WIN32 + buflen = 4096; +#else

buflen = stat( newpath, &st ) ? 4096 : st.st_blksize;

+#endif

buf = tr_new( char, buflen ); while( bytesLeft > 0 ) {

diff -NaurX diff-excludes.txt transmission-1.71-orig/qt/qtr.pro transmission-1.71/qt/qtr.pro --- transmission-1.71-orig/qt/qtr.pro 2009-06-05 17:10:12.000000000 +0000 +++ transmission-1.71/qt/qtr.pro 2009-06-08 09:04:54.274877119 +0000 @@ -1,7 +1,7 @@

TARGET = qtr NAME = "Transmission" DESCRIPTION = "Transmission: a fast, easy, and free BitTorrent? client"

-VERSION = 1.60 +VERSION = 1.70

LICENSE = "GPL"

target.path = /bin

@@ -18,6 +18,7 @@

LIBS += $${TRANSMISSION_TOP}/third-party/miniupnp/libminiupnp.a LIBS += $${TRANSMISSION_TOP}/third-party/libnatpmp/libnatpmp.a LIBS += $${TRANSMISSION_TOP}/third-party/libevent/.libs/libevent.a

+LIBS += -lws2_32 -lintl

TRANSLATIONS += transmission_en.ts

@@ -31,4 +32,4 @@

torrent-model.cc triconpushbutton.cc utils.cc watchdir.cc

HEADERS += $$replace(SOURCES, .cc, .h) HEADERS += speed.h types.h

- +RC_FILE = qtr.rc diff -NaurX diff-excludes.txt transmission-1.71-orig/qt/qtr.rc transmission-1.71/qt/qtr.rc --- transmission-1.71-orig/qt/qtr.rc 1970-01-01 00:00:00.000000000 +0000 +++ transmission-1.71/qt/qtr.rc 2009-06-08 09:04:54.319569011 +0000 @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "qtr.ico" diff -NaurX diff-excludes.txt transmission-1.71-orig/third-party/dht/dht.c transmission-1.71/third-party/dht/dht.c --- transmission-1.71-orig/third-party/dht/dht.c 2009-06-05 14:06:52.000000000 +0000 +++ transmission-1.71/third-party/dht/dht.c 2009-06-08 09:04:54.340545403 +0000 @@ -39,10 +39,31 @@

#include <unistd.h> #include <fcntl.h> #include <sys/time.h>

-#include <arpa/inet.h> -#include <sys/types.h> -#include <sys/socket.h> -#include <netinet/in.h> +#ifdef WIN32 + #define WINVER 0x0501 + #include <windows.h> + #include <inttypes.h> + #include <winsock2.h> + #include <ws2tcpip.h> + typedef int socklen_t; + #define random rand /* int rand(), long random() */ + #define EINVAL WSAEINVAL + #define ECONNREFUSED WSAECONNREFUSED + #define ECONNRESET WSAECONNRESET + #define EHOSTUNREACH WSAEHOSTUNREACH + #define EINPROGRESS WSAEINPROGRESS + #define ENOTCONN WSAENOTCONN + #define EWOULDBLOCK WSAEWOULDBLOCK + #define EAFNOSUPPORT WSAEAFNOSUPPORT + #define ENETUNREACH WSAENETUNREACH + #define sockerrno WSAGetLastError( ) + static const char *inet_ntop(int, const void *, char *, socklen_t); +#else + #include <arpa/inet.h> + #include <sys/types.h> + #include <sys/socket.h> + #include <netinet/in.h> +#endif

#include "dht.h"

@@ -1309,6 +1330,7 @@

storage = NULL;

+#ifndef WIN32

rc = fcntl(s, F_GETFL, 0); if(rc < 0)

goto fail;

@@ -1316,6 +1338,10 @@

rc = fcntl(s, F_SETFL, (rc | O_NONBLOCK)); if(rc < 0)

goto fail;

+#else + u_long mode= 1; + ioctlsocket(s, FIONBIO, &mode); +#endif

memcpy(myid, id, 20); if(v) {

@@ -2306,3 +2332,32 @@

debugf("Truncated message.\n"); return -1;

}

+ +#ifdef WIN32 +static const char * +inet_ntop(int af, const void *src, char *dst, socklen_t cnt) +{ + if (af == AF_INET) + { + struct sockaddr_in in; + memset(&in, 0, sizeof(in)); + in.sin_family = AF_INET; + memcpy(&in.sin_addr, src, sizeof(struct in_addr)); + getnameinfo((struct sockaddr *)&in, sizeof(struct + sockaddr_in), dst, cnt, NULL, 0, NI_NUMERICHOST); + return dst; + } + else if (af == AF_INET6) + { + struct sockaddr_in6 in; + memset(&in, 0, sizeof(in)); + in.sin6_family = AF_INET6; + memcpy(&in.sin6_addr, src, sizeof(struct in_addr6)); + getnameinfo((struct sockaddr *)&in, sizeof(struct + sockaddr_in6), dst, cnt, NULL, 0, NI_NUMERICHOST); + return dst; + } + return NULL; +} + +#endif diff -NaurX diff-excludes.txt transmission-1.71-orig/third-party/libnatpmp/getgateway.c transmission-1.71/third-party/libnatpmp/getgateway.c --- transmission-1.71-orig/third-party/libnatpmp/getgateway.c 2009-03-11 13:04:03.000000000 +0000 +++ transmission-1.71/third-party/libnatpmp/getgateway.c 2009-06-08 09:04:54.365635758 +0000 @@ -261,7 +261,7 @@

#endif /* #ifdef USE_SOCKET_ROUTE */

#ifdef USE_WIN32_CODE

-int getdefaultgateway(in_addr_t * addr) +LIBSPEC int getdefaultgateway(in_addr_t * addr)

{

HKEY networkCardsKey; HKEY networkCardKey;

diff -NaurX diff-excludes.txt transmission-1.71-orig/third-party/libnatpmp/natpmp.c transmission-1.71/third-party/libnatpmp/natpmp.c --- transmission-1.71-orig/third-party/libnatpmp/natpmp.c 2009-03-11 13:04:03.000000000 +0000 +++ transmission-1.71/third-party/libnatpmp/natpmp.c 2009-06-08 09:04:54.396728040 +0000 @@ -18,8 +18,9 @@

#include <time.h> #include <sys/time.h> #ifdef WIN32

+#include <errno.h>

#include <winsock2.h>

-#include <Ws2tcpip.h> +#include <ws2tcpip.h>

#include <io.h> #define EWOULDBLOCK WSAEWOULDBLOCK #define ECONNREFUSED WSAECONNREFUSED

@@ -34,7 +35,7 @@

#include "natpmp.h" #include "getgateway.h"

-int initnatpmp(natpmp_t * p) +LIBSPEC int initnatpmp(natpmp_t * p)

{ #ifdef WIN32

u_long ioctlArg = 1;

@@ -70,7 +71,7 @@

return 0;

}

-int closenatpmp(natpmp_t * p) +LIBSPEC int closenatpmp(natpmp_t * p)

{

if(!p)

return NATPMP_ERR_INVALIDARGS;

@@ -113,7 +114,7 @@

return n;

}

-int getnatpmprequesttimeout(natpmp_t * p, struct timeval * timeout) +LIBSPEC int getnatpmprequesttimeout(natpmp_t * p, struct timeval * timeout)

{

struct timeval now;

if(!p
!timeout)

@@ -131,7 +132,7 @@

return 0;

}

-int sendpublicaddressrequest(natpmp_t * p) +LIBSPEC int sendpublicaddressrequest(natpmp_t * p)

{

if(!p)

return NATPMP_ERR_INVALIDARGS;

@@ -143,7 +144,7 @@

return sendnatpmprequest(p);

}

-int sendnewportmappingrequest(natpmp_t * p, int protocol, +LIBSPEC int sendnewportmappingrequest(natpmp_t * p, int protocol,

uint16_t privateport, uint16_t publicport,

uint32_t lifetime)

{

@@ -228,7 +229,7 @@

return n;

}

-int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response) +LIBSPEC int readnatpmpresponseorretry(natpmp_t * p, natpmpresp_t * response)

{

int n;

if(!p
!response)

@@ -268,7 +269,7 @@

}

#ifdef ENABLE_STRNATPMPERR

-const char * strnatpmperr(int r) +LIBSPEC const char * strnatpmperr(int r)

{

const char * s; switch(r) {

diff -NaurX diff-excludes.txt transmission-1.71-orig/third-party/miniupnp/minissdpc.c transmission-1.71/third-party/miniupnp/minissdpc.c --- transmission-1.71-orig/third-party/miniupnp/minissdpc.c 2009-02-07 00:11:58.000000000 +0000 +++ transmission-1.71/third-party/miniupnp/minissdpc.c 2009-06-08 09:04:54.428589858 +0000 @@ -12,8 +12,14 @@

#include <sys/types.h> #ifdef WIN32 #include <winsock2.h>

-#include <Ws2tcpip.h> +#include <ws2tcpip.h>

#include <io.h>

+/* Hack */ +#define UNIX_PATH_LEN 108 +struct sockaddr_un { + uint16_t sun_family; + char sun_path[UNIX_PATH_LEN]; +};

#else #include <sys/socket.h> #include <sys/un.h>

diff -NaurX diff-excludes.txt transmission-1.71-orig/third-party/miniupnp/miniupnpc.c transmission-1.71/third-party/miniupnp/miniupnpc.c --- transmission-1.71-orig/third-party/miniupnp/miniupnpc.c 2009-02-07 00:11:58.000000000 +0000 +++ transmission-1.71/third-party/miniupnp/miniupnpc.c 2009-06-08 09:04:54.460879399 +0000 @@ -10,7 +10,7 @@

#ifdef WIN32 /* Win32 Specific includes and defines */ #include <winsock2.h>

-#include <Ws2tcpip.h> +#include <ws2tcpip.h>

#include <io.h> #define snprintf _snprintf #if defined(_MSC_VER) && (_MSC_VER >= 1400)

@@ -49,7 +49,7 @@

#define SERVICEPREFIX2 'u'

/* root description parsing */

-void parserootdesc(const char * buffer, int bufsize, struct IGDdatas * data) +LIBSPEC void parserootdesc(const char * buffer, int bufsize, struct IGDdatas * data)

{

struct xmlparser parser; /* xmlparser object */

@@ -340,7 +340,7 @@

  • no devices was found.
  • It is up to the caller to free the chained list
  • delay is in millisecond (poll) */

-struct UPNPDev * upnpDiscover(int delay, const char * multicastif, +LIBSPEC struct UPNPDev * upnpDiscover(int delay, const char * multicastif,

const char * minissdpdsock, int sameport)

{

struct UPNPDev * tmp;

@@ -489,7 +489,7 @@

/* freeUPNPDevlist() should be used to

  • free the chained list returned by upnpDiscover() */

-void freeUPNPDevlist(struct UPNPDev * devlist) +LIBSPEC void freeUPNPDevlist(struct UPNPDev * devlist)

{

struct UPNPDev * next; while(devlist)

@@ -525,7 +525,7 @@

/* Prepare the Urls for usage...

*/

-void GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data, +LIBSPEC void GetUPNPUrls(struct UPNPUrls * urls, struct IGDdatas * data,

const char * descURL)

{

char * p;

@@ -568,7 +568,7 @@

#endif }

-void +LIBSPEC void

FreeUPNPUrls(struct UPNPUrls * urls) {

if(!urls)

@@ -655,7 +655,7 @@

  • passed as parameters are set. Donc forget to call FreeUPNPUrls(urls) to
  • free allocated memory. */

-int +LIBSPEC int

UPNP_GetValidIGD(struct UPNPDev * devlist,

struct UPNPUrls * urls,

struct IGDdatas * data,

@@ -722,7 +722,7 @@

  • return value :
  • 0 - Not ok
  • 1 - OK */

-int +LIBSPEC int

UPNP_GetIGDFromUrl(const char * rootdescurl,

struct UPNPUrls * urls, struct IGDdatas * data,

diff -NaurX diff-excludes.txt transmission-1.71-orig/third-party/miniupnp/upnpcommands.c transmission-1.71/third-party/miniupnp/upnpcommands.c --- transmission-1.71-orig/third-party/miniupnp/upnpcommands.c 2009-04-21 01:12:55.000000000 +0000 +++ transmission-1.71/third-party/miniupnp/upnpcommands.c 2009-06-08 09:04:54.493627189 +0000 @@ -19,7 +19,7 @@

/*

  • */

-UNSIGNED_INTEGER +LIBSPEC UNSIGNED_INTEGER

UPNP_GetTotalBytesSent(const char * controlURL,

const char * servicetype)

{

@@ -39,7 +39,7 @@

/*

  • */

-UNSIGNED_INTEGER +LIBSPEC UNSIGNED_INTEGER

UPNP_GetTotalBytesReceived(const char * controlURL,

const char * servicetype)

{

@@ -59,7 +59,7 @@

/*

  • */

-UNSIGNED_INTEGER +LIBSPEC UNSIGNED_INTEGER

UPNP_GetTotalPacketsSent(const char * controlURL,

const char * servicetype)

{

@@ -79,7 +79,7 @@

/*

  • */

-UNSIGNED_INTEGER +LIBSPEC UNSIGNED_INTEGER

UPNP_GetTotalPacketsReceived(const char * controlURL,

const char * servicetype)

{

@@ -99,7 +99,7 @@

/* UPNP_GetStatusInfo() call the corresponding UPNP method

  • returns the current status and uptime */

-int UPNP_GetStatusInfo(const char * controlURL, +LIBSPEC int UPNP_GetStatusInfo(const char * controlURL,

const char * servicetype, char * status, unsigned int * uptime,

@@ -159,7 +159,7 @@

/* UPNP_GetConnectionTypeInfo() call the corresponding UPNP method

  • returns the connection type */

-int UPNP_GetConnectionTypeInfo(const char * controlURL, +LIBSPEC int UPNP_GetConnectionTypeInfo(const char * controlURL,

const char * servicetype, char * connectionType)

{

@@ -198,7 +198,7 @@

-int UPNP_GetLinkLayerMaxBitRates(const char * controlURL, const char * servicetype, unsigned int * bitrateDown, unsigned int* bitrateUp) +LIBSPEC int UPNP_GetLinkLayerMaxBitRates(const char * controlURL, const char * servicetype, unsigned int * bitrateDown, unsigned int* bitrateUp)

{

struct NameValueParserData? pdata; char buffer[4096];

@@ -262,7 +262,7 @@

  • 402 Invalid Args - See UPnP Device Architecture section on Control.
  • 501 Action Failed - See UPnP Device Architecture section on Control. */

-int UPNP_GetExternalIPAddress(const char * controlURL, +LIBSPEC int UPNP_GetExternalIPAddress(const char * controlURL,

const char * servicetype,

char * extIpAdd)

{

@@ -297,7 +297,7 @@

return ret;

}

-int +LIBSPEC int

UPNP_AddPortMapping(const char * controlURL, const char * servicetype,

const char * extPort,

const char * inPort,

@@ -351,7 +351,7 @@

return ret;

}

-int +LIBSPEC int

UPNP_DeletePortMapping(const char * controlURL, const char * servicetype,

const char * extPort, const char * proto, const char * remoteHost)

@@ -391,7 +391,7 @@

return ret;

}

-int UPNP_GetGenericPortMappingEntry(const char * controlURL, +LIBSPEC int UPNP_GetGenericPortMappingEntry(const char * controlURL,

const char * servicetype,

const char * index, char * extPort,

@@ -480,7 +480,7 @@

return r;

}

-int UPNP_GetPortMappingNumberOfEntries(const char * controlURL, const char * servicetype, unsigned int * numEntries) +LIBSPEC int UPNP_GetPortMappingNumberOfEntries(const char * controlURL, const char * servicetype, unsigned int * numEntries)

{

struct NameValueParserData? pdata; char buffer[4096];

@@ -513,7 +513,7 @@

/* UPNP_GetSpecificPortMappingEntry retrieves an existing port mapping

  • the result is returned in the intClient and intPort strings
  • please provide 16 and 6 bytes of data */

-int +LIBSPEC int

UPNP_GetSpecificPortMappingEntry(const char * controlURL,

const char * servicetype, const char * extPort,