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

diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/libtransmission/JSON_parser.h transmission-1.93/libtransmission/JSON_parser.h --- transmission-1.93-orig/libtransmission/JSON_parser.h 2010-05-01 16:35:04.000000000 -0500 +++ transmission-1.93/libtransmission/JSON_parser.h 2010-05-04 13:16:51.000000000 -0500 @@ -11,7 +11,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 /home/rberber/diff-excludes.txt transmission-1.93-orig/libtransmission/Makefile.in transmission-1.93/libtransmission/Makefile.in --- transmission-1.93-orig/libtransmission/Makefile.in 2010-05-01 16:38:43.000000000 -0500 +++ transmission-1.93/libtransmission/Makefile.in 2010-05-04 13:24:15.000000000 -0500 @@ -93,7 +93,7 @@

bencode_test_OBJECTS = $(am_bencode_test_OBJECTS) amDEPENDENCIES_1 = ./libtransmission.a \

$(top_builddir)/third-party/miniupnp/libminiupnp.a \

  • $(top_builddir)/third-party/libnatpmp/libnatpmp.a

+ $(top_builddir)/third-party/libnatpmp/libnatpmp.a

bencode_test_DEPENDENCIES = $(amDEPENDENCIES_1) AM_V_lt = $(amv_lt_$(V)) amv_lt_ = $(amv_lt_$(AM_DEFAULT_VERBOSITY))

@@ -496,6 +496,7 @@

./libtransmission.a \ $(top_builddir)/third-party/miniupnp/libminiupnp.a \ $(top_builddir)/third-party/libnatpmp/libnatpmp.a \

+ -liphlpapi \

@INTLLIBS@ \ @DHT_LIBS@ \ @LIBCURL_LIBS@ \

diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/libtransmission/bencode.c transmission-1.93/libtransmission/bencode.c --- transmission-1.93-orig/libtransmission/bencode.c 2010-05-01 16:35:04.000000000 -0500 +++ transmission-1.93/libtransmission/bencode.c 2010-05-04 13:56:39.000000000 -0500 @@ -18,6 +18,11 @@

#include <stdio.h> #include <stdlib.h> /* realpath() */ #include <string.h>

+#ifdef WIN32 + #define mkstemp mktemp + #define fsync _commit + static char *realpath(); +#endif

#include <sys/types.h> /* stat() */ #include <sys/stat.h> /* stat() */

@@ -1710,3 +1715,17 @@

tr_free( content ); return err;

}

+ +#ifdef WIN32 +/* From a message to the Mingw-msys list, circa Jun 2, 2005 + * by Mark Junker. + */ +static +char *realpath(const char *path, char *resolved_path) +{ + char *pszFilePart; + if (GetFullPathNameA(path, PATH_MAX, resolved_path, &pszFilePart) == 0) + return NULL; + return resolved_path; +} +#endif diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/libtransmission/net.c transmission-1.93/libtransmission/net.c --- transmission-1.93-orig/libtransmission/net.c 2010-05-01 16:35:04.000000000 -0500 +++ transmission-1.93/libtransmission/net.c 2010-05-04 13:16:51.000000000 -0500 @@ -32,8 +32,9 @@

#include <sys/types.h>

#ifdef WIN32

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

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

#else

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

diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/libtransmission/net.h transmission-1.93/libtransmission/net.h --- transmission-1.93-orig/libtransmission/net.h 2010-05-01 16:35:04.000000000 -0500 +++ transmission-1.93/libtransmission/net.h 2010-05-04 13:16:51.000000000 -0500 @@ -31,8 +31,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 /home/rberber/diff-excludes.txt transmission-1.93-orig/libtransmission/peer-mgr.c transmission-1.93/libtransmission/peer-mgr.c --- transmission-1.93-orig/libtransmission/peer-mgr.c 2010-05-01 16:35:04.000000000 -0500 +++ transmission-1.93/libtransmission/peer-mgr.c 2010-05-04 13:16:51.000000000 -0500 @@ -15,6 +15,9 @@

#include <stdlib.h> /* qsort */

#include <event.h>

+#ifdef WIN32 + #include <errno.h> +#endif

#include "transmission.h" #include "announcer.h"

diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/libtransmission/tr-dht.c transmission-1.93/libtransmission/tr-dht.c --- transmission-1.93-orig/libtransmission/tr-dht.c 2010-05-01 16:35:04.000000000 -0500 +++ transmission-1.93/libtransmission/tr-dht.c 2010-05-04 13:16:51.000000000 -0500 @@ -25,13 +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 <netdb.h>

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

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

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

diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/libtransmission/trevent.c transmission-1.93/libtransmission/trevent.c --- transmission-1.93-orig/libtransmission/trevent.c 2010-05-01 16:35:04.000000000 -0500 +++ transmission-1.93/libtransmission/trevent.c 2010-05-04 13:16:51.000000000 -0500 @@ -26,7 +26,7 @@

#ifdef WIN32

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

static int pgpipe( int handles[2] )

diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/libtransmission/utils.c transmission-1.93/libtransmission/utils.c --- transmission-1.93-orig/libtransmission/utils.c 2010-05-01 16:35:04.000000000 -0500 +++ transmission-1.93/libtransmission/utils.c 2010-05-04 13:16:51.000000000 -0500 @@ -34,6 +34,9 @@

#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> /* usleep, stat, getcwd, getpagesize */

+#ifdef WIN32 +#define getpagesize() 65536 +#endif

#include "event.h"

@@ -1421,7 +1424,11 @@

/* copy the file */ in = tr_open_file_for_scanning( oldpath ); out = tr_open_file_for_writing( newpath );

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

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

+#endif

buf = tr_valloc( buflen ); while( bytesLeft > 0 ) {

diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/libtransmission/web.c transmission-1.93/libtransmission/web.c --- transmission-1.93-orig/libtransmission/web.c 2010-05-01 16:35:04.000000000 -0500 +++ transmission-1.93/libtransmission/web.c 2010-05-04 13:16:51.000000000 -0500 @@ -10,7 +10,9 @@

  • $Id: web.c 10602 2010-05-01 14:19:45Z charles $ */

+#ifndef WIN32

#include <sys/select.h>

+#endif

#include <curl/curl.h> #include <event.h>

diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/qt/qtr.pro transmission-1.93/qt/qtr.pro --- transmission-1.93-orig/qt/qtr.pro 2010-05-01 16:35:05.000000000 -0500 +++ transmission-1.93/qt/qtr.pro 2010-05-04 13:57:49.000000000 -0500 @@ -1,7 +1,7 @@

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

-VERSION = 1.60 +VERSION = 1.93

LICENSE = "GPL"

target.path = /bin

@@ -18,6 +18,8 @@

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

+win32:LIBS += -lws2_32 -lintl +win32:LIBS += -lidn -lwldap32 -liphlpapi

TRANSLATIONS += transmission_en.ts transmission_ru.ts

@@ -32,3 +34,4 @@

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

+win32:RC_FILE = qtr.rc diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/qt/qtr.rc transmission-1.93/qt/qtr.rc --- transmission-1.93-orig/qt/qtr.rc 1969-12-31 18:00:00.000000000 -0600 +++ transmission-1.93/qt/qtr.rc 2010-05-04 13:16:51.000000000 -0500 @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "qtr.ico" diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/qt/utils.cc transmission-1.93/qt/utils.cc --- transmission-1.93-orig/qt/utils.cc 2010-05-01 16:35:05.000000000 -0500 +++ transmission-1.93/qt/utils.cc 2010-05-04 13:16:51.000000000 -0500 @@ -56,12 +56,12 @@

else if( size < (int64_t)GIGABYTE_FACTOR ) {

displayed_size = (double)size / MEGABYTE_FACTOR;

  • str = tr( "%L1 MB" ).arg( displayed_size, 0, 'f', 1 );

+ str = tr( "%L1 MB" ).arg( displayed_size, 0, 'f', 2 );

} else {

displayed_size = (double) size / GIGABYTE_FACTOR;

  • str = tr( "%L1 GB" ).arg( displayed_size, 0, 'f', 1 );

+ str = tr( "%L1 GB" ).arg( displayed_size, 0, 'f', 3 );

}

}

diff -NaurX /home/rberber/diff-excludes.txt transmission-1.93-orig/third-party/dht/dht.c transmission-1.93/third-party/dht/dht.c --- transmission-1.93-orig/third-party/dht/dht.c 2010-05-01 16:35:45.000000000 -0500 +++ transmission-1.93/third-party/dht/dht.c 2010-05-04 13:16:51.000000000 -0500 @@ -39,10 +39,18 @@

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

+#ifndef WIN32

#include <arpa/inet.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h>

+#else +#define WINVER WindowsXP /* freeaddrinfo(),getaddrinfo(),getnameinfo() */ +#include <ws2tcpip.h> +#define random rand /* int rand() since no long random() */ +const char *inet_ntop(int, const void *, char *, socklen_t); +#define EAFNOSUPPORT WSAEAFNOSUPPORT +#endif

#include "dht.h"

@@ -1530,6 +1538,10 @@

dht_init(int s, int s6, const unsigned char *id, const unsigned char *v) {

int rc;

+#ifdef WIN32 + unsigned long flags = 1; +#endif +

if(dht_socket >= 0
dht_socket6 >= 0 buckets buckets6) {

errno = EBUSY;

@@ -1548,11 +1560,15 @@

return -1;

buckets->af = AF_INET;

+#ifndef WIN32

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

goto fail;

rc = fcntl(s, F_SETFL, (rc | O_NONBLOCK));

+#else + rc = ioctlsocket(s, FIONBIO, &flags); +#endif

if(rc < 0)

goto fail;

}

@@ -1563,11 +1579,15 @@

return -1;

buckets6->af = AF_INET6;

+#ifndef WIN32

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

goto fail;

rc = fcntl(s6, F_SETFL, (rc | O_NONBLOCK));

+#else + rc = ioctlsocket(s6, FIONBIO, &flags); +#endif

if(rc < 0)

goto fail;

}

@@ -2877,3 +2897,29 @@

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

}

+ +#ifdef WIN32 +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

Last modified 7 years ago Last modified on May 28, 2010, 8:16:21 PM