cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl 7.24.0 for Windows with mingw and mingw64

From: Brecht Sanders <brechtsanders_at_users.sourceforge.net>
Date: Wed, 25 Jan 2012 13:31:10 +0100

Hi,
I compiled libcurl 7.24.0 for Windows 32-bit with mingw and 64-bit with
mingw64 with the patches below.
The first patch was to address an issue with ftruncate/ftruncate64 on
mingw64.
The rest is all related to the configure script setting
USE_THREADS_POSIX instead of USE_THREADS_WIN32 and the linker option
-pthread which is invalid for mingw (and not needed when using Windows
threads).
I hope this helps keeping libcurl crossplatform.
Regards
     Brecht Sanders

# fix src/main.c for 64-bit
patch -ulbf src/main.c << EOF
--- src/main.c 2011-04-22 19:01:50 +0200
+++ src/main.c 2011-08-13 17:04:50 +0200
@@ -436,2 +436,3 @@

+#ifndef __MINGW64__
  static int ftruncate64(int fd, curl_off_t where)
@@ -447,2 +448,3 @@
  #define ftruncate(fd,where) ftruncate64(fd,where)
+#endif

EOF

# after running configure the following fix is needed
echo "#undef USE_THREADS_POSIX" >> lib/curl_config.h &&
echo "#define USE_THREADS_WIN32 1" >> lib/curl_config.h &&
echo "#undef USE_THREADS_POSIX" >> src/curl_config.h &&
echo "#define USE_THREADS_WIN32 1" >> src/curl_config.h &&
# remove -pthread from Makefiles
for F in `find . -iname Makefile` ; do
  sed -i.orig "s/-pthread//" $F
done &&
make install-strip

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-01-25