From: Richard W.M. Jones <"Richard W.M. Jones "> Date: Thu, 13 Nov 2008 16:08:11 +0000 (+0000) Subject: Added libcurl. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=a0117551dc940249c9aa4fd53e24dac6ab57e541;p=fedora-mingw.git Added libcurl. --- diff --git a/.hgignore b/.hgignore index b93c0cb..22548f6 100644 --- a/.hgignore +++ b/.hgignore @@ -16,6 +16,7 @@ cairo/cairo-1.8.0.tar.gz cairo/svgspacewar cairo/svgspacewar.exe cairomm/cairomm-1.6.2.tar.gz +curl/curl-7.18.2.tar.bz2 expat/expat-2.0.1.tar.gz fontconfig/fontconfig-2.6.0.tar.gz freetype/freetype-2.3.7.tar.bz2 diff --git a/curl/curl-7.15.3-multilib.patch b/curl/curl-7.15.3-multilib.patch new file mode 100644 index 0000000..5670a76 --- /dev/null +++ b/curl/curl-7.15.3-multilib.patch @@ -0,0 +1,42 @@ +diff -up curl-7.18.0/curl-config.in.multilib curl-7.18.0/curl-config.in +--- curl-7.18.0/curl-config.in.multilib 2008-01-10 23:14:02.000000000 +0100 ++++ curl-7.18.0/curl-config.in 2008-02-16 06:48:14.000000000 +0100 +@@ -45,7 +45,6 @@ + --libs library linking information + --prefix curl install prefix + --protocols newline separated list of enabled protocols +- --static-libs static libcurl library linking information + --version output version information + --vernum output the version information as a number (hexadecimal) + EOF +@@ -72,7 +71,7 @@ + ;; + + --cc) +- echo "@CC@" ++ echo "gcc" + ;; + + --prefix) +@@ -189,20 +188,7 @@ + ;; + + --libs) +- if test "X@libdir@" != "X/usr/lib" -a "X@libdir@" != "X/usr/lib64"; then +- CURLLIBDIR="-L@libdir@ " +- else +- CURLLIBDIR="" +- fi +- if test "X@REQUIRE_LIB_DEPS@" = "Xyes"; then +- echo ${CURLLIBDIR}-lcurl @LDFLAGS@ @LIBCURL_LIBS@ @LIBS@ +- else +- echo ${CURLLIBDIR}-lcurl @LDFLAGS@ @LIBS@ +- fi +- ;; +- +- --static-libs) +- echo @libdir@/libcurl.@libext@ @LDFLAGS@ @LIBCURL_LIBS@ @LIBS@ ++ pkg-config libcurl --libs + ;; + + *) diff --git a/curl/curl-7.16.0-privlibs.patch b/curl/curl-7.16.0-privlibs.patch new file mode 100644 index 0000000..f3d2ece --- /dev/null +++ b/curl/curl-7.16.0-privlibs.patch @@ -0,0 +1,11 @@ +--- curl-7.16.2/libcurl.pc.in.privlibs 2007-02-18 10:41:27.000000000 +0100 ++++ curl-7.16.2/libcurl.pc.in 2007-04-11 20:02:34.000000000 +0200 +@@ -33,6 +33,6 @@ + URL: http://curl.haxx.se/ + Description: Library to transfer files with ftp, http, etc. + Version: @VERSION@ +-Libs: -L${libdir} -lcurl @LDFLAGS@ @LIBS@ +-Libs.private: @LIBCURL_LIBS@ @LIBS@ ++Libs: -L${libdir} -lcurl ++Libs.private: @LIBCURL_LIBS@ @LIBS@ @LDFLAGS@ + Cflags: -I${includedir} diff --git a/curl/curl-7.17.1-badsocket.patch b/curl/curl-7.17.1-badsocket.patch new file mode 100644 index 0000000..7f092ae --- /dev/null +++ b/curl/curl-7.17.1-badsocket.patch @@ -0,0 +1,13 @@ +diff -up curl-7.17.1/lib/ftp.c.badsocket curl-7.17.1/lib/ftp.c +--- curl-7.17.1/lib/ftp.c.badsocket 2007-10-27 00:25:19.000000000 +0200 ++++ curl-7.17.1/lib/ftp.c 2008-01-08 15:09:03.000000000 +0100 +@@ -3228,7 +3228,8 @@ static CURLcode Curl_ftp_done(struct con + /* Note that we keep "use" set to TRUE since that (next) connection is + still requested to use SSL */ + } +- sclose(conn->sock[SECONDARYSOCKET]); ++ if(CURL_SOCKET_BAD != conn->sock[SECONDARYSOCKET]) ++ sclose(conn->sock[SECONDARYSOCKET]); + + conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; + diff --git a/curl/curl-7.17.1-sslgen.patch b/curl/curl-7.17.1-sslgen.patch new file mode 100644 index 0000000..4ab3c8d --- /dev/null +++ b/curl/curl-7.17.1-sslgen.patch @@ -0,0 +1,10 @@ +--- curl-7.17.1/lib/sslgen.c.orig 2007-11-16 22:48:48.000000000 -0500 ++++ curl-7.17.1/lib/sslgen.c 2007-11-16 22:49:19.000000000 -0500 +@@ -243,6 +243,7 @@ + #else + #ifdef USE_NSS + *done = TRUE; /* fallback to BLOCKING */ ++ conn->ssl[sockindex].use = TRUE; + return Curl_nss_connect(conn, sockindex); + #else + #ifdef USE_QSOSSL diff --git a/curl/curl-7.18.2-nss-thread-safety.patch b/curl/curl-7.18.2-nss-thread-safety.patch new file mode 100644 index 0000000..46857f1 --- /dev/null +++ b/curl/curl-7.18.2-nss-thread-safety.patch @@ -0,0 +1,72 @@ +diff -u --recursive curl-7.18.2/lib/nss.c curl-7.18.2.new/lib/nss.c +--- curl-7.18.2/lib/nss.c 2008-09-16 11:13:00.000000000 -0400 ++++ curl-7.18.2.new/lib/nss.c 2008-09-16 11:29:13.000000000 -0400 +@@ -73,6 +73,8 @@ + + PRFileDesc *PR_ImportTCPSocket(PRInt32 osfd); + ++PRLock * nss_initlock = NULL; ++ + int initialized = 0; + + #define HANDSHAKE_TIMEOUT 30 +@@ -719,8 +721,11 @@ + */ + int Curl_nss_init(void) + { +- if(!initialized) ++ /* curl_global_init() is not thread-safe so this test is ok */ ++ if (nss_initlock == NULL) { + PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 256); ++ nss_initlock = PR_NewLock(); ++ } + + /* We will actually initialize NSS later */ + +@@ -730,7 +735,17 @@ + /* Global cleanup */ + void Curl_nss_cleanup(void) + { +- NSS_Shutdown(); ++ /* This function isn't required to be threadsafe and this is only done ++ * as a safety feature. ++ */ ++ PR_Lock(nss_initlock); ++ if (initialized) ++ NSS_Shutdown(); ++ PR_Unlock(nss_initlock); ++ ++ PR_DestroyLock(nss_initlock); ++ nss_initlock = NULL; ++ + initialized = 0; + } + +@@ -808,7 +823,8 @@ + return CURLE_OK; + + /* FIXME. NSS doesn't support multiple databases open at the same time. */ +- if(!initialized) { ++ PR_Lock(nss_initlock); ++ if(!initialized && !NSS_IsInitialized()) { + initialized = 1; + + certDir = getenv("SSL_DIR"); /* Look in $SSL_DIR */ +@@ -832,6 +848,8 @@ + if(rv != SECSuccess) { + infof(conn->data, "Unable to initialize NSS database\n"); + curlerr = CURLE_SSL_CACERT_BADFILE; ++ PR_Unlock(nss_initlock); ++ initialized = 0; + goto error; + } + +@@ -854,6 +872,7 @@ + } + #endif + } ++ PR_Unlock(nss_initlock); + + model = PR_NewTCPSocket(); + if(!model) +Only in curl-7.18.2.new/lib: nss.c.orig diff --git a/curl/curl-7.18.2-nssproxy.patch b/curl/curl-7.18.2-nssproxy.patch new file mode 100644 index 0000000..9d88d02 --- /dev/null +++ b/curl/curl-7.18.2-nssproxy.patch @@ -0,0 +1,13 @@ +diff -up curl-7.18.2/lib/nss.c.nssproxy curl-7.18.2/lib/nss.c +--- curl-7.18.2/lib/nss.c.nssproxy 2008-05-26 17:02:49.000000000 +0200 ++++ curl-7.18.2/lib/nss.c 2008-06-18 07:59:52.000000000 +0200 +@@ -804,6 +804,9 @@ CURLcode Curl_nss_connect(struct connect + + curlerr = CURLE_SSL_CONNECT_ERROR; + ++ if (connssl->state == ssl_connection_complete) ++ return CURLE_OK; ++ + /* FIXME. NSS doesn't support multiple databases open at the same time. */ + if(!initialized) { + initialized = 1; diff --git a/curl/mingw-curl-7.18.2-getaddrinfo.patch b/curl/mingw-curl-7.18.2-getaddrinfo.patch new file mode 100644 index 0000000..ffd466e --- /dev/null +++ b/curl/mingw-curl-7.18.2-getaddrinfo.patch @@ -0,0 +1,15 @@ +--- curl-7.18.2.orig/lib/setup.h 2008-04-23 21:07:52.000000000 +0100 ++++ curl-7.18.2/lib/setup.h 2008-11-13 15:51:40.000000000 +0000 +@@ -47,6 +47,12 @@ + + #ifdef HAVE_CONFIG_H + #include "config.h" ++ ++#ifdef __MINGW32__ /* only for MinGW cross-compiler ... */ ++/* We want the getaddrinfo functions. */ ++#define _WIN32_WINNT 0x0501 ++#endif /* __MINGW32__ cross-compiler */ ++ + #else + + #ifdef _WIN32_WCE diff --git a/curl/mingw32-curl.spec b/curl/mingw32-curl.spec new file mode 100644 index 0000000..ece71f6 --- /dev/null +++ b/curl/mingw32-curl.spec @@ -0,0 +1,124 @@ +%define __strip %{_mingw32_strip} +%define __objdump %{_mingw32_objdump} +%define _use_internal_dependency_generator 0 +%define __find_requires %{_mingw32_findrequires} +%define __find_provides %{_mingw32_findprovides} + +Name: mingw32-curl +Version: 7.18.2 +Release: 1%{?dist} +Summary: MinGW Windows port of curl and libcurl + +License: MIT +Group: Development/Libraries +URL: http://curl.haxx.se/ +Source0: http://curl.haxx.se/download/curl-%{version}.tar.bz2 +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildArch: noarch + +# Patches from native Fedora package. +Patch1: curl-7.15.3-multilib.patch +Patch2: curl-7.16.0-privlibs.patch +Patch3: curl-7.17.1-badsocket.patch +Patch4: curl-7.18.2-nssproxy.patch +Patch5: curl-7.18.2-nss-thread-safety.patch + +# MinGW-specific patches. +Patch1000: mingw-curl-7.18.2-getaddrinfo.patch + +BuildRequires: mingw32-filesystem >= 34 +BuildRequires: mingw32-gcc +BuildRequires: mingw32-binutils +BuildRequires: pkgconfig +BuildRequires: mingw32-gettext +BuildRequires: mingw32-iconv +BuildRequires: mingw32-zlib +BuildRequires: mingw32-libidn +BuildRequires: mingw32-libssh2 + +# See nss/README for the status of this package. +#BuildRequires: mingw32-nss +# Temporarily we can use OpenSSL instead of NSS: +BuildRequires: mingw32-openssl + +# Not started porting this package yet. +#BuildRequires: mingw32-openldap + +# Not started porting this package yet. +#BuildRequires: mingw32-krb5 + + +%description +cURL is a tool for getting files from HTTP, FTP, FILE, LDAP, LDAPS, +DICT, TELNET and TFTP servers, using any of the supported protocols. +cURL is designed to work without user interaction or any kind of +interactivity. cURL offers many useful capabilities, like proxy +support, user authentication, FTP upload, HTTP post, and file transfer +resume. + +This is the MinGW cross-compiled Windows library. + + +%prep +%setup -q -n curl-%{version} + +%patch1 -p1 -b .multilib +%patch2 -p1 -b .privlibs +%patch3 -p1 -b .badsocket +%patch4 -p1 -b .nssproxy +%patch5 -p1 -b .nssthreadsafety + +%patch1000 -p1 -b .getaddrinfo + + +%build +%{_mingw32_configure} \ + --with-ssl --enable-ipv6 \ + --with-ca-bundle=%{_mingw32_sysconfdir}/pki/tls/certs/ca-bundle.crt \ + --with-libidn \ + --disable-static --with-libssh2 \ + --without-random + +# --without-random disables random number collection (eg. from +# /dev/urandom). There isn't an obvious alternative for Windows: +# Perhaps we can port EGD or use a library such as Yarrow. + +# These are the original flags that we'll work towards as +# more of the dependencies get ported to Fedora MinGW. +# +# --without-ssl --with-nss=%{_mingw32_prefix} --enable-ipv6 +# --with-ca-bundle=%{_mingw32_sysconfdir}/pki/tls/certs/ca-bundle.crt +# --with-gssapi=%{_mingw32_prefix}/kerberos --with-libidn +# --enable-ldaps --disable-static --with-libssh2 + +make %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT +make DESTDIR=$RPM_BUILD_ROOT install + +# Remove the man pages which duplicate documentation in the +# native Fedora package. +rm -r $RPM_BUILD_ROOT%{_mingw32_mandir}/man{1,3} + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root) +%{_mingw32_bindir}/curl-config +%{_mingw32_bindir}/curl.exe +%{_mingw32_bindir}/libcurl-4.dll +%{_mingw32_libdir}/libcurl.dll.a +%{_mingw32_libdir}/libcurl.la +%{_mingw32_libdir}/pkgconfig/libcurl.pc +%{_mingw32_includedir}/curl/ + + +%changelog +* Thu Nov 13 2008 Richard W.M. Jones - 7.18.2-1 +- Initial RPM release.