bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] Re: Compilation in Visual Studio 8 (and against msvcrt.dll)


From: Paul Franklin
Subject: [Bug-wget] Re: Compilation in Visual Studio 8 (and against msvcrt.dll)
Date: Wed, 29 Jul 2009 12:04:05 -0700

This is my first message to this list so I apologize if I do
something wrong or do not follow the correct protocol.

I would like to have a statically-linked wget for Windows.  I have
used wget for years and occasionally need the modern one on Windows.

So when a Google search showed me the recent (2009-07-18 02:35:55 GMT)
message to this list from Gustavo Lopes (mailto:address@hidden
or mailto:address@hidden), I also noticed that there had been no
reply to it.  No "thank you, we will put your patches into the 1.12
release" or "we have no way to compile and test Windows patches" or
any sort of follow-up message at all.

In the hope his patches can be incorporated into the next release,
I am sending this message to the list -- to ask for just that.

In any case, thank you in advance for taking the time to read it.

p.s. I append his original message, pasted, for reference only.

===============================================================

I've tried today to compile wget statically linked against openssl and
dynamically linked against msvcrt.dll (which required using headers and
libs from the Windows Driver Development Kit, I used 6001.18002), so that
I didn't have to distribute the runtime.

It didn't compile cleanly. In case anywone is interested, I attach the
changes I had to make. It works in XP SP3 (but will also probably work in
SP1 and SP2) and vista. IPv6 works in both operating systems.

The diffs are against 1.11.4.

-- 
Gustavo Lopes

--- mswindows.c Mon Jan 19 04:14:16 1970
+++ mswindows.c Mon Jan 19 04:14:16 1970
@@ -694,11 +694,11 @@
 /* An inet_ntop implementation that uses WSAAddressToString.
    Prototype complies with POSIX 1003.1-2004.  This is only used under
    IPv6 because Wget prints IPv4 addresses using inet_ntoa.  */
-
+//vista has this function, but it's incompatible
 const char *
-inet_ntop (int af, const void *src, char *dst, socklen_t cnt)
+inet_ntop_custom (int af, const void *src, char *dst, socklen_t cnt)
 {
-  /* struct sockaddr can't accomodate struct sockaddr_in6. */
+  //struct sockaddr can't accomodate struct sockaddr_in6.
   union {
     struct sockaddr_in6 sin6;
     struct sockaddr_in sin;
@@ -723,7 +723,8 @@
       abort ();
     }

-  if (WSAAddressToString ((struct sockaddr *) &sa, srcsize, NULL, dst,
&dstlen) != 0)
+  //changed from WSAAddressToString because wget is not handling unicode
strings
+  if (WSAAddressToStringA ((struct sockaddr *) &sa, srcsize, NULL, dst,
&dstlen) != 0)
     {
       errno = WSAGetLastError();
       return NULL;
--- mswindows.h Mon Jan 19 04:14:16 1970
+++ mswindows.h Mon Jan 19 04:14:16 1970
@@ -70,12 +70,23 @@
 # define S_ISLNK(a) 0
 #endif

+#define utime _utime
+#define utimbuf _utimbuf
+//inet_ntop was introduced in vista, do not use it
+#define inet_ntop inet_ntop_custom
+//don't know why this is needed
+#define getpid GetCurrentProcessId
+
 /* We have strcasecmp and strncasecmp, just under different names.  */
 #ifndef HAVE_STRCASECMP
 # define strcasecmp stricmp
+//avoid redefinition of stricmp
+# define HAVE_STRCASECMP
 #endif
 #ifndef HAVE_STRNCASECMP
 # define strncasecmp strnicmp
+//avoid redefinition of strnicmp
+# define HAVE_STRNCASECMP
 #endif

 /* The same for snprintf() and vsnprintf().  */
@@ -162,8 +173,8 @@
    right thing with Winsock errors. */
 #ifndef INHIBIT_WRAP
 # define strerror windows_strerror
-#endif
 const char *windows_strerror (int);
+#endif

 /* Declarations of various socket errors:  */


--- config-compiler.h   Mon Jan 19 04:14:16 1970
+++ config-compiler.h   Mon Jan 19 04:14:16 1970
@@ -107,6 +107,8 @@

 #define OS_TYPE "Windows-MSVC"

+#undef socklen_t                /* avoid clash with <ws2tcpip.h> */
+
 #define LL(n) n##I64

 #define stat_alias _stati64
--- Makefile.src        Mon Jan 19 04:14:16 1970
+++ Makefile.src        Mon Jan 19 04:14:16 1970
@@ -41,15 +41,15 @@
 LD     = link
 RM     = -del

-DEFS   = /DWINDOWS /D_CONSOLE /DHAVE_CONFIG_H $(SSLDEFS)
-LIBS   = kernel32.lib advapi32.lib wsock32.lib user32.lib gdi32.lib $(SSLLIBS)
+DEFS   = /DWINDOWS /DENABLE_IPV6 /D_CONSOLE /DHAVE_CONFIG_H $(SSLDEFS)
+LIBS   = kernel32.lib advapi32.lib wsock32.lib user32.lib gdi32.lib ws2_32.lib
$(SSLLIBS) msvcrt_winxp.obj msvcrt.lib

 !ifdef DEBUG
 CFLAGS = /nologo /MTd /Od /Zi /I. $(DEFS)
 LDFLAGS        = /debug
 !else
-CFLAGS = /nologo /MT /O2 /I. $(DEFS)
-LDFLAGS        = /opt:ref #/opt:nowin98
+CFLAGS = /MD /nologo /O2 /Ox /I. -IC:\WinDDK\6001.18002\inc\api
/IC:\WinDDK\6001.18002\inc\crt -IC:\Users\Cataphract\Desktop\openssl\include
$(DEFS)
+LDFLAGS        = /subsystem:console /opt:ref /nodefaultlib:libcmt
/nodefaultlib:libcmtd /nodefaultlib:msvcrt /nodefaultlib:msvcrt90
/LIBPATH:C:\WinDDK\6001.18002\lib\crt\i386
/LIBPATH:C:\WinDDK\6001.18002\lib\wxp\i386
/LIBPATH:C:\Users\Cataphract\Desktop\openssl\lib /PDB:wget.pdb
 !endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]