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

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

--

diff -NaurX diff-excludes.txt transmission-1.83-orig/libtransmission/JSON_parser.h transmission-1.83/libtransmission/JSON_parser.h --- transmission-1.83-orig/libtransmission/JSON_parser.h 2010-01-28 19:01:32.000000000 -0600 +++ transmission-1.83/libtransmission/JSON_parser.h 2010-01-30 06:37:37.948134060 -0600 @@ -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 diff-excludes.txt transmission-1.83-orig/libtransmission/net.c transmission-1.83/libtransmission/net.c --- transmission-1.83-orig/libtransmission/net.c 2010-01-28 19:01:32.000000000 -0600 +++ transmission-1.83/libtransmission/net.c 2010-01-30 06:37:37.975054876 -0600 @@ -32,8 +32,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.83-orig/libtransmission/net.h transmission-1.83/libtransmission/net.h --- transmission-1.83-orig/libtransmission/net.h 2010-01-28 19:01:32.000000000 -0600 +++ transmission-1.83/libtransmission/net.h 2010-01-30 06:39:21.655057936 -0600 @@ -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 diff-excludes.txt transmission-1.83-orig/libtransmission/peer-mgr.c transmission-1.83/libtransmission/peer-mgr.c --- transmission-1.83-orig/libtransmission/peer-mgr.c 2010-01-28 19:01:32.000000000 -0600 +++ transmission-1.83/libtransmission/peer-mgr.c 2010-01-30 06:37:38.108056620 -0600 @@ -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 diff-excludes.txt transmission-1.83-orig/libtransmission/tr-dht.c transmission-1.83/libtransmission/tr-dht.c --- transmission-1.83-orig/libtransmission/tr-dht.c 2010-01-28 19:01:32.000000000 -0600 +++ transmission-1.83/libtransmission/tr-dht.c 2010-01-30 06:40:30.855076592 -0600 @@ -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 diff-excludes.txt transmission-1.83-orig/libtransmission/trevent.c transmission-1.83/libtransmission/trevent.c --- transmission-1.83-orig/libtransmission/trevent.c 2010-01-28 19:01:32.000000000 -0600 +++ transmission-1.83/libtransmission/trevent.c 2010-01-30 06:37:38.123087444 -0600 @@ -26,7 +26,7 @@

#ifdef WIN32

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

static int pgpipe( int handles[2] )

diff -NaurX diff-excludes.txt transmission-1.83-orig/libtransmission/utils.c transmission-1.83/libtransmission/utils.c --- transmission-1.83-orig/libtransmission/utils.c 2010-01-28 19:01:32.000000000 -0600 +++ transmission-1.83/libtransmission/utils.c 2010-01-30 06:37:38.127084177 -0600 @@ -1366,7 +1366,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_new( char, buflen ); while( bytesLeft > 0 ) {

diff -NaurX diff-excludes.txt transmission-1.83-orig/qt/qtr.pro transmission-1.83/qt/qtr.pro --- transmission-1.83-orig/qt/qtr.pro 2010-01-28 19:01:33.000000000 -0600 +++ transmission-1.83/qt/qtr.pro 2010-01-30 06:41:25.768119829 -0600 @@ -1,7 +1,7 @@

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

-VERSION = 1.60 +VERSION = 1.83

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

+win32:LIBS += -lws2_32 -lintl

TRANSLATIONS += transmission_en.ts transmission_ru.ts

@@ -32,3 +33,4 @@

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

+win32:RC_FILE = qtr.rc diff -NaurX diff-excludes.txt transmission-1.83-orig/qt/qtr.rc transmission-1.83/qt/qtr.rc --- transmission-1.83-orig/qt/qtr.rc 1969-12-31 18:00:00.000000000 -0600 +++ transmission-1.83/qt/qtr.rc 2010-01-30 06:37:38.132210051 -0600 @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "qtr.ico" diff -NaurX diff-excludes.txt transmission-1.83-orig/qt/utils.cc transmission-1.83/qt/utils.cc --- transmission-1.83-orig/qt/utils.cc 2010-01-28 19:01:33.000000000 -0600 +++ transmission-1.83/qt/utils.cc 2010-01-30 06:37:38.149048558 -0600 @@ -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 diff-excludes.txt transmission-1.83-orig/third-party/dht/dht.c transmission-1.83/third-party/dht/dht.c --- transmission-1.83-orig/third-party/dht/dht.c 2010-01-28 19:02:12.000000000 -0600 +++ transmission-1.83/third-party/dht/dht.c 2010-01-30 06:42:13.977112826 -0600 @@ -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 diff -NaurX diff-excludes.txt transmission-1.83-orig/third-party/miniupnp/miniupnpcstrings.h transmission-1.83/third-party/miniupnp/miniupnpcstrings.h --- transmission-1.83-orig/third-party/miniupnp/miniupnpcstrings.h 1969-12-31 18:00:00.000000000 -0600 +++ transmission-1.83/third-party/miniupnp/miniupnpcstrings.h 2010-01-30 06:44:18.113278147 -0600 @@ -0,0 +1,15 @@ +/* $Id: miniupnpcstrings.h.in,v 1.1 2009/07/09 16:13:31 nanard Exp $ */ +/* Project: miniupnp + * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ + * Author: Thomas Bernard + * Copyright (c) 2005-2009 Thomas Bernard + * This software is subjects to the conditions detailed + * in the LICENCE file provided within this distribution */ +#ifndef MINIUPNPCSTRINGS_H +#define MINIUPNPCSTRINGS_H + +#define OS_STRING "Linux/2.6.29.6-217.2.16.fc11.i586" +#define MINIUPNPC_VERSION_STRING "1.3" + +#endif +