compiling squid 3.2.2 under MSYS/MinGW

From: Brecht Sanders <brecht_at_sanders.org>
Date: Mon, 08 Oct 2012 21:41:49 +0200

Hello,
I just had a go at compiling squid for native Windows with the MinGW
compiler under the MSYS shell.
The patches below did solve some issues for this compiler and got me
through compilation of lib directory.
However, a lot more work would be needed to get the whole program to
compile I'm afraid.
I hope my feedback below is of some use to you.
Regards
     Brecht Sanders

### patches for MinGW ###
# fix compat/os/mswin.h
patch -ulbf compat/os/mswin.h << EOF
--- compat/os/mswin.h 2012-10-06 05:08:36 +0200
+++ compat/os/mswin.h 2012-10-08 12:02:40 +0200
@@ -37,2 +37,5 @@
  #if _SQUID_WINDOWS_
+#ifdef __MINGW32__
+#include <unistd.h>
+#endif

@@ -163,3 +166,3 @@

-#if !_SQUID_CYGWIN_
+#if !_SQUID_CYGWIN_ && !defined(__MINGW32__)
  typedef int uid_t;
@@ -349,3 +352,5 @@

+#ifndef __MINGW32__
  #define strerror(e) WIN32_strerror(e)
+#endif
  #define HAVE_STRERROR 1
EOF
# fix compat/mswin.cc
patch -ulbf compat/mswin.cc << EOF
--- compat/mswin.cc 2012-10-06 05:08:36 +0200
+++ compat/mswin.cc 2012-10-08 13:30:36 +0200
@@ -387,5 +387,5 @@
  WIN32_maperror(unsigned long WIN32_oserrno)
  {
- int i;
+ size_t i;

      _doserrno = WIN32_oserrno;
EOF
# fix compat/shm.h
patch -ulbf compat/shm.h << EOF
--- compat/shm.h 2012-10-06 05:08:36 +0200
+++ compat/shm.h 2012-10-08 12:07:30 +0200
@@ -25,2 +25,5 @@
  #endif
+#ifdef __MINGW32__
+#define ENOTSUP 45
+#endif

EOF
# fix lib/sspwin32.c
patch -ulbf lib/sspwin32.c << EOF
--- lib/sspwin32.c 2012-10-06 05:08:36 +0200
+++ lib/sspwin32.c 2012-10-08 21:16:54 +0200
@@ -38,3 +38,3 @@

-#include "libntlmauth/ntlmauth.h"
+#include "ntlmauth/ntlmauth.h"
  #include "sspwin32.h"
@@ -522,5 +522,5 @@
          challenge = (ntlm_challenge *) fResult;
- Use_Unicode = NEGOTIATE_UNICODE & challenge->flags;
- NTLM_LocalCall = NEGOTIATE_THIS_IS_LOCAL_CALL & challenge->flags;
- encoded = base64_encode_bin((char *) fResult, cbOut);
+ Use_Unicode = NTLM_NEGOTIATE_UNICODE & challenge->flags;
+ NTLM_LocalCall = NTLM_NEGOTIATE_THIS_IS_LOCAL_CALL &
challenge->flags;
+ encoded = (const char*)base64_encode_bin((char *) fResult, cbOut);
      }
@@ -585,3 +585,3 @@
      if (pServerBuf != NULL && cbOut > 0)
- encoded = base64_encode_bin((char *) pServerBuf, cbOut);
+ encoded = (const char*)base64_encode_bin((char *) pServerBuf,
cbOut);
      return encoded;
@@ -613,3 +613,3 @@
      if (pServerBuf != NULL && cbOut > 0)
- encoded = base64_encode_bin((char *) pServerBuf, cbOut);
+ encoded = (const char*)base64_encode_bin((char *) pServerBuf,
cbOut);
      return encoded;
EOF

### dirty hacks ###
# fix missing files
mkdir -p src/sys src/netinet src/arpa
touch src/sys/ipc.h src/sys/msg.h src/sys/shm.h src/netinet/in.h
src/sys/signal.h src/netinet/tcp.h src/arpa/inet.h
echo "#include <winsock2.h>" > src/sys/socket.h
echo "#include <winsock2.h>" > src/netdb.h
cat > src/sys/uio.h << EOF
#include <winsock2.h>
struct iovec {
  caddr_t iov_base;
  int iov_len;
};
EOF
# create dummy syslog.h
cat > src/syslog.h << EOF
#define LOG_ERR 3 //error conditions
#define LOG_WARNING 4 //warning conditions
#define LOG_INFO 6 //informational
#define LOG_USER (1<<3) //random user-level messages
#define LOG_AUTH (4<<3) //security/authorization messages
#define LOG_PID 0x01 //log the pid with each message
static void openlog (const char *ident, int option, int facility) {}
static void syslog (int priority, const char *format, ...) {}
static void closelog (void) {}
EOF
Received on Wed Oct 10 2012 - 22:55:07 MDT

This archive was generated by hypermail 2.2.0 : Thu Oct 11 2012 - 12:00:06 MDT