[mingw-libssh2: 2/14] Initial import

Kalev Lember kalev at fedoraproject.org
Tue Mar 6 19:39:22 UTC 2012


commit 272f745ad8202375b70386d658ee25c1ce5a63a3
Author: epienbro <epienbro at fedoraproject.org>
Date:   Sun May 24 12:38:47 2009 +0000

    Initial import

 .cvsignore                              |    1 +
 libssh2-01-build-win-library.patch      |   11 +
 libssh2-02-libssh_priv-headers.patch    |   58 +++++
 libssh2-03-remove-extra-config.patch    |  373 +++++++++++++++++++++++++++++++
 libssh2-04-non-blocking-examples.patch  |  119 ++++++++++
 libssh2-05-remove-WINSOCK-VERSION.patch |  186 +++++++++++++++
 mingw32-libssh2.spec                    |  105 +++++++++
 sources                                 |    1 +
 8 files changed, 854 insertions(+), 0 deletions(-)
---
diff --git a/.cvsignore b/.cvsignore
index e69de29..b866dfd 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -0,0 +1 @@
+libssh2-1.1.tar.gz
diff --git a/libssh2-01-build-win-library.patch b/libssh2-01-build-win-library.patch
new file mode 100644
index 0000000..55942d0
--- /dev/null
+++ b/libssh2-01-build-win-library.patch
@@ -0,0 +1,11 @@
+diff -urN libssh2-0.18.orig/configure.in libssh2-0.18.mingw/configure.in
+--- libssh2-0.18.orig/configure.in	2007-07-31 10:55:29.000000000 +0100
++++ libssh2-0.18.mingw/configure.in	2008-11-10 14:12:07.000000000 +0000
+@@ -52,6 +52,7 @@
+ AC_PROG_INSTALL
+ AC_PROG_LN_S
+ AC_PROG_MAKE_SET
++AC_LIBTOOL_WIN32_DLL
+ AC_PROG_LIBTOOL
+ AC_C_BIGENDIAN
+ if test -z "$PKG_CONFIG"; then
diff --git a/libssh2-02-libssh_priv-headers.patch b/libssh2-02-libssh_priv-headers.patch
new file mode 100644
index 0000000..b480ba8
--- /dev/null
+++ b/libssh2-02-libssh_priv-headers.patch
@@ -0,0 +1,58 @@
+diff -urN libssh2-0.18.orig/configure.in libssh2-0.18.mingw/configure.in
+--- libssh2-0.18.orig/configure.in	2007-07-31 10:55:29.000000000 +0100
++++ libssh2-0.18.mingw/configure.in	2008-11-10 14:12:07.000000000 +0000
+@@ -249,6 +250,7 @@
+ AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
+ AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/ioctl.h sys/time.h])
+ AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
++AC_CHECK_HEADERS([windows.h ws2tcpip.h winsock2.h])
+ AC_CHECK_FUNCS(poll gettimeofday select)
+ 
+ AC_FUNC_ALLOCA
+diff -urN libssh2-0.18.orig/src/libssh2_priv.h libssh2-0.18.mingw/src/libssh2_priv.h
+--- libssh2-0.18.orig/src/libssh2_priv.h	2007-08-10 23:30:30.000000000 +0100
++++ libssh2-0.18.mingw/src/libssh2_priv.h	2008-11-10 13:57:49.000000000 +0000
+@@ -41,6 +41,14 @@
+ #define LIBSSH2_LIBRARY
+ #include "libssh2_config.h"
+ 
++#ifdef HAVE_WINDOWS_H
++#include <windows.h>
++#endif
++
++#ifdef HAVE_WS2TCPIP_H
++#include <ws2tcpip.h>
++#endif
++
+ /* The following CPP block should really only be in session.c and
+    packet.c.  However, AIX have #define's for 'events' and 'revents'
+    and we are using those names in libssh2.h, so we need to include
+@@ -70,6 +78,28 @@
+ #include "libssh2_publickey.h"
+ #include "libssh2_sftp.h"
+ 
++/* Provide iovec / writev on WIN32 platform. */
++#ifdef WIN32
++
++/* same as WSABUF */
++struct iovec {
++	u_long iov_len;
++	char *iov_base;
++};
++
++#define inline __inline
++
++static inline int writev(int sock, struct iovec *iov, int nvecs)
++{
++	DWORD ret;
++	if (WSASend(sock, (LPWSABUF)iov, nvecs, &ret, 0, NULL, NULL) == 0) {
++		return ret;
++	}
++	return -1;
++}
++
++#endif /* WIN32 */
++
+ /* Needed for struct iovec on some platforms */
+ #ifdef HAVE_SYS_UIO_H
+ #include <sys/uio.h>
diff --git a/libssh2-03-remove-extra-config.patch b/libssh2-03-remove-extra-config.patch
new file mode 100644
index 0000000..7693122
--- /dev/null
+++ b/libssh2-03-remove-extra-config.patch
@@ -0,0 +1,373 @@
+diff -urN libssh2-0.18.orig/configure.in libssh2-0.18.mingw/configure.in
+--- libssh2-0.18.orig/configure.in	2007-07-31 10:55:29.000000000 +0100
++++ libssh2-0.18.mingw/configure.in	2008-11-10 14:12:07.000000000 +0000
+@@ -1,7 +1,7 @@
+ # AC_PREREQ(2.57)
+ AC_INIT(libssh2, [-], libssh2-devel at lists.sourceforge.net)
+ AC_CONFIG_SRCDIR([src])
+-AC_CONFIG_HEADER([src/libssh2_config.h example/simple/config.h])
++AC_CONFIG_HEADER([src/libssh2_config.h])
+ AM_MAINTAINER_MODE
+ 
+ dnl SED is needed by some of the tools
+diff -urN libssh2-0.18.orig/example/simple/config.h.in libssh2-0.18.mingw/example/simple/config.h.in
+--- libssh2-0.18.orig/example/simple/config.h.in	2007-07-31 11:02:51.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/config.h.in	1970-01-01 01:00:00.000000000 +0100
+@@ -1,172 +0,0 @@
+-/* src/libssh2_config.h.in.  Generated from configure.in by autoheader.  */
+-
+-/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
+-   systems. This function is required for `alloca.c' support on those systems.
+-   */
+-#undef CRAY_STACKSEG_END
+-
+-/* Define to 1 if using `alloca.c'. */
+-#undef C_ALLOCA
+-
+-/* Define to 1 if you have `alloca', as a function or macro. */
+-#undef HAVE_ALLOCA
+-
+-/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
+-   */
+-#undef HAVE_ALLOCA_H
+-
+-/* Define to 1 if you have the <arpa/inet.h> header file. */
+-#undef HAVE_ARPA_INET_H
+-
+-/* disabled non-blocking sockets */
+-#undef HAVE_DISABLED_NONBLOCKING
+-
+-/* Define to 1 if you have the <dlfcn.h> header file. */
+-#undef HAVE_DLFCN_H
+-
+-/* Define to 1 if you have the <errno.h> header file. */
+-#undef HAVE_ERRNO_H
+-
+-/* Define to 1 if you have the <fcntl.h> header file. */
+-#undef HAVE_FCNTL_H
+-
+-/* use FIONBIO for non-blocking sockets */
+-#undef HAVE_FIONBIO
+-
+-/* Define to 1 if you have the `gettimeofday' function. */
+-#undef HAVE_GETTIMEOFDAY
+-
+-/* Define to 1 if you have the <inttypes.h> header file. */
+-#undef HAVE_INTTYPES_H
+-
+-/* use ioctlsocket() for non-blocking sockets */
+-#undef HAVE_IOCTLSOCKET
+-
+-/* use Ioctlsocket() for non-blocking sockets */
+-#undef HAVE_IOCTLSOCKET_CASE
+-
+-/* Define if you have the gcrypt library. */
+-#undef HAVE_LIBGCRYPT
+-
+-/* Define to 1 if you have the <memory.h> header file. */
+-#undef HAVE_MEMORY_H
+-
+-/* Define to 1 if you have the <netinet/in.h> header file. */
+-#undef HAVE_NETINET_IN_H
+-
+-/* use O_NONBLOCK for non-blocking sockets */
+-#undef HAVE_O_NONBLOCK
+-
+-/* Define to 1 if you have the `poll' function. */
+-#undef HAVE_POLL
+-
+-/* Define to 1 if you have the `select' function. */
+-#undef HAVE_SELECT
+-
+-/* use SO_NONBLOCK for non-blocking sockets */
+-#undef HAVE_SO_NONBLOCK
+-
+-/* Define to 1 if you have the <stdint.h> header file. */
+-#undef HAVE_STDINT_H
+-
+-/* Define to 1 if you have the <stdio.h> header file. */
+-#undef HAVE_STDIO_H
+-
+-/* Define to 1 if you have the <stdlib.h> header file. */
+-#undef HAVE_STDLIB_H
+-
+-/* Define to 1 if you have the <strings.h> header file. */
+-#undef HAVE_STRINGS_H
+-
+-/* Define to 1 if you have the <string.h> header file. */
+-#undef HAVE_STRING_H
+-
+-/* Define to 1 if you have the <sys/ioctl.h> header file. */
+-#undef HAVE_SYS_IOCTL_H
+-
+-/* Define to 1 if you have the <sys/select.h> header file. */
+-#undef HAVE_SYS_SELECT_H
+-
+-/* Define to 1 if you have the <sys/socket.h> header file. */
+-#undef HAVE_SYS_SOCKET_H
+-
+-/* Define to 1 if you have the <sys/stat.h> header file. */
+-#undef HAVE_SYS_STAT_H
+-
+-/* Define to 1 if you have the <sys/time.h> header file. */
+-#undef HAVE_SYS_TIME_H
+-
+-/* Define to 1 if you have the <sys/types.h> header file. */
+-#undef HAVE_SYS_TYPES_H
+-
+-/* Define to 1 if you have the <sys/uio.h> header file. */
+-#undef HAVE_SYS_UIO_H
+-
+-/* Define to 1 if you have the <unistd.h> header file. */
+-#undef HAVE_UNISTD_H
+-
+-/* Enable "none" cipher -- NOT RECOMMENDED */
+-#undef LIBSSH2_CRYPT_NONE
+-
+-/* Enable newer diffie-hellman-group-exchange-sha1 syntax */
+-#undef LIBSSH2_DH_GEX_NEW
+-
+-/* Compile in zlib support */
+-#undef LIBSSH2_HAVE_ZLIB
+-
+-/* Use libgcrypt */
+-#undef LIBSSH2_LIBGCRYPT
+-
+-/* Enable "none" MAC -- NOT RECOMMENDED */
+-#undef LIBSSH2_MAC_NONE
+-
+-/* Name of package */
+-#undef PACKAGE
+-
+-/* Define to the address where bug reports for this package should be sent. */
+-#undef PACKAGE_BUGREPORT
+-
+-/* Define to the full name of this package. */
+-#undef PACKAGE_NAME
+-
+-/* Define to the full name and version of this package. */
+-#undef PACKAGE_STRING
+-
+-/* Define to the one symbol short name of this package. */
+-#undef PACKAGE_TARNAME
+-
+-/* Define to the version of this package. */
+-#undef PACKAGE_VERSION
+-
+-/* If using the C implementation of alloca, define if you know the
+-   direction of stack growth for your system; otherwise it will be
+-   automatically deduced at runtime.
+-	STACK_DIRECTION > 0 => grows toward higher addresses
+-	STACK_DIRECTION < 0 => grows toward lower addresses
+-	STACK_DIRECTION = 0 => direction of growth unknown */
+-#undef STACK_DIRECTION
+-
+-/* Define to 1 if you have the ANSI C header files. */
+-#undef STDC_HEADERS
+-
+-/* Version number of package */
+-#undef VERSION
+-
+-/* Define to 1 if your processor stores words with the most significant byte
+-   first (like Motorola and SPARC, unlike Intel and VAX). */
+-#undef WORDS_BIGENDIAN
+-
+-/* Number of bits in a file offset, on hosts where this is settable. */
+-#undef _FILE_OFFSET_BITS
+-
+-/* Define for large files, on AIX-style hosts. */
+-#undef _LARGE_FILES
+-
+-/* Define to empty if `const' does not conform to ANSI C. */
+-#undef const
+-
+-/* Define to `__inline__' or `__inline' if that's what the C compiler
+-   calls it, or to nothing if 'inline' is not supported under any name.  */
+-#ifndef __cplusplus
+-#undef inline
+-#endif
+diff -urN libssh2-0.18.orig/example/simple/Makefile.am libssh2-0.18.mingw/example/simple/Makefile.am
+--- libssh2-0.18.orig/example/simple/Makefile.am	2007-08-12 22:39:55.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/Makefile.am	2008-11-10 14:13:22.000000000 +0000
+@@ -10,6 +10,6 @@
+ 		sftp_RW_nonblock \
+ 		sftpdir sftpdir_nonblock
+ 
+-INCLUDES = -I. -I$(top_srcdir)/include
++INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/include
+ LDADD = $(top_builddir)/src/libssh2.la
+ 
+diff -urN libssh2-0.18.orig/example/simple/scp.c libssh2-0.18.mingw/example/simple/scp.c
+--- libssh2-0.18.orig/example/simple/scp.c	2007-08-12 22:39:55.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/scp.c	2008-11-10 14:18:13.000000000 +0000
+@@ -4,7 +4,7 @@
+  * Sample showing how to do a simple SCP transfer.
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ 
+ #ifdef HAVE_WINSOCK2_H
+diff -urN libssh2-0.18.orig/example/simple/scp_nonblock.c libssh2-0.18.mingw/example/simple/scp_nonblock.c
+--- libssh2-0.18.orig/example/simple/scp_nonblock.c	2007-09-24 13:15:45.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/scp_nonblock.c	2008-11-10 14:22:21.000000000 +0000
+@@ -4,7 +4,7 @@
+  * Sample showing how to do SCP transfers in a non-blocking manner.
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ 
+ #ifdef HAVE_WINSOCK2_H
+diff -urN libssh2-0.18.orig/example/simple/scp_write.c libssh2-0.18.mingw/example/simple/scp_write.c
+--- libssh2-0.18.orig/example/simple/scp_write.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/scp_write.c	2008-11-10 14:19:32.000000000 +0000
+@@ -4,7 +4,7 @@
+  * Sample showing how to do a simple SCP transfer.
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ 
+ #ifdef HAVE_WINSOCK2_H
+diff -urN libssh2-0.18.orig/example/simple/scp_write_nonblock.c libssh2-0.18.mingw/example/simple/scp_write_nonblock.c
+--- libssh2-0.18.orig/example/simple/scp_write_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/scp_write_nonblock.c	2008-11-10 14:22:13.000000000 +0000
+@@ -4,7 +4,7 @@
+  * Sample showing how to do a simple SCP transfer.
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ 
+ #include <libssh2.h>
+ 
+diff -urN libssh2-0.18.orig/example/simple/sftp.c libssh2-0.18.mingw/example/simple/sftp.c
+--- libssh2-0.18.orig/example/simple/sftp.c	2007-09-24 13:14:18.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp.c	2008-11-10 14:15:47.000000000 +0000
+@@ -9,7 +9,7 @@
+  * "sftp 192.168.0.1 user password /tmp/secrets -p|-i|-k"
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ #include <libssh2_sftp.h>
+ 
+diff -urN libssh2-0.18.orig/example/simple/sftpdir.c libssh2-0.18.mingw/example/simple/sftpdir.c
+--- libssh2-0.18.orig/example/simple/sftpdir.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftpdir.c	2008-11-10 14:18:41.000000000 +0000
+@@ -9,7 +9,7 @@
+  * "sftpdir 192.168.0.1 user password /tmp/secretdir"
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ #include <libssh2_sftp.h>
+ 
+diff -urN libssh2-0.18.orig/example/simple/sftpdir_nonblock.c libssh2-0.18.mingw/example/simple/sftpdir_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftpdir_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftpdir_nonblock.c	2008-11-10 14:23:35.000000000 +0000
+@@ -9,7 +9,7 @@
+  * "sftpdir 192.168.0.1 user password /tmp/secretdir"
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ #include <libssh2_sftp.h>
+ 
+diff -urN libssh2-0.18.orig/example/simple/sftp_mkdir.c libssh2-0.18.mingw/example/simple/sftp_mkdir.c
+--- libssh2-0.18.orig/example/simple/sftp_mkdir.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_mkdir.c	2008-11-10 14:18:33.000000000 +0000
+@@ -9,7 +9,7 @@
+  * "sftp 192.168.0.1 user password /tmp/sftp_mkdir"
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ #include <libssh2_sftp.h>
+ 
+diff -urN libssh2-0.18.orig/example/simple/sftp_mkdir_nonblock.c libssh2-0.18.mingw/example/simple/sftp_mkdir_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_mkdir_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_mkdir_nonblock.c	2008-11-10 14:23:03.000000000 +0000
+@@ -9,7 +9,7 @@
+  * "sftp 192.168.0.1 user password /tmp/sftp_write_nonblock.c"
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ #include <libssh2_sftp.h>
+ 
+diff -urN libssh2-0.18.orig/example/simple/sftp_nonblock.c libssh2-0.18.mingw/example/simple/sftp_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_nonblock.c	2008-11-10 14:22:30.000000000 +0000
+@@ -9,7 +9,7 @@
+  * "sftp 192.168.0.1 user password /tmp/secrets"
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ #include <libssh2_sftp.h>
+ 
+diff -urN libssh2-0.18.orig/example/simple/sftp_RW_nonblock.c libssh2-0.18.mingw/example/simple/sftp_RW_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_RW_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_RW_nonblock.c	2008-11-10 14:23:18.000000000 +0000
+@@ -9,7 +9,7 @@
+  * Using the SFTP server running on 127.0.0.1
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ #include <libssh2_sftp.h>
+ 
+diff -urN libssh2-0.18.orig/example/simple/sftp_write.c libssh2-0.18.mingw/example/simple/sftp_write.c
+--- libssh2-0.18.orig/example/simple/sftp_write.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_write.c	2008-11-10 14:19:09.000000000 +0000
+@@ -9,7 +9,7 @@
+  * "sftp 192.168.0.1 user password sftp_write.c /tmp/secrets"
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ #include <libssh2_sftp.h>
+ 
+diff -urN libssh2-0.18.orig/example/simple/sftp_write_nonblock.c libssh2-0.18.mingw/example/simple/sftp_write_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_write_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_write_nonblock.c	2008-11-10 14:22:44.000000000 +0000
+@@ -9,7 +9,7 @@
+  * "sftp 192.168.0.1 user password sftp_write_nonblock.c /tmp/sftp_write_nonblock.c"
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ #include <libssh2_sftp.h>
+ 
+diff -urN libssh2-0.18.orig/example/simple/ssh2.c libssh2-0.18.mingw/example/simple/ssh2.c
+--- libssh2-0.18.orig/example/simple/ssh2.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/ssh2.c	2008-11-10 14:14:32.000000000 +0000
+@@ -9,10 +9,13 @@
+  * "ssh2 host user password [-p|-i|-k]"
+  */
+ 
+-#include "config.h"
++#include "libssh2_config.h"
+ #include <libssh2.h>
+ #include <libssh2_sftp.h>
+ 
++#ifdef HAVE_WINDOWS_H
++# include <windows.h>
++#endif
+ #ifdef HAVE_WINSOCK2_H
+ # include <winsock2.h>
+ #endif
diff --git a/libssh2-04-non-blocking-examples.patch b/libssh2-04-non-blocking-examples.patch
new file mode 100644
index 0000000..765d9cb
--- /dev/null
+++ b/libssh2-04-non-blocking-examples.patch
@@ -0,0 +1,119 @@
+diff -urN libssh2-0.18.orig/example/simple/scp_nonblock.c libssh2-0.18.mingw/example/simple/scp_nonblock.c
+--- libssh2-0.18.orig/example/simple/scp_nonblock.c	2007-09-24 13:15:45.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/scp_nonblock.c	2008-11-10 14:22:21.000000000 +0000
+@@ -89,8 +89,13 @@
+     rc = fcntl(sock, F_GETFL, 0);
+     fcntl(sock, F_SETFL, rc | O_NONBLOCK);
+ #else
++#ifdef WIN32
++    u_long mode = 1;
++    ioctlsocket (sock, FIONBIO, &mode);
++#else
+ #error "add support for setting the socket non-blocking here"
+ #endif
++#endif
+ 
+     /* Create a session instance */
+     session = libssh2_session_init();
+diff -urN libssh2-0.18.orig/example/simple/scp_write_nonblock.c libssh2-0.18.mingw/example/simple/scp_write_nonblock.c
+--- libssh2-0.18.orig/example/simple/scp_write_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/scp_write_nonblock.c	2008-11-10 14:22:13.000000000 +0000
+@@ -106,8 +106,13 @@
+     rc = fcntl(sock, F_GETFL, 0);
+     fcntl(sock, F_SETFL, rc | O_NONBLOCK);
+ #else
++#ifdef WIN32
++    u_long mode = 1;
++    ioctlsocket (sock, FIONBIO, &mode);
++#else
+ #error "add support for setting the socket non-blocking here"
+ #endif
++#endif
+ 
+     /* Create a session instance
+      */
+diff -urN libssh2-0.18.orig/example/simple/sftpdir_nonblock.c libssh2-0.18.mingw/example/simple/sftpdir_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftpdir_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftpdir_nonblock.c	2008-11-10 14:23:35.000000000 +0000
+@@ -92,8 +92,13 @@
+     rc = fcntl(sock, F_GETFL, 0);
+     fcntl(sock, F_SETFL, rc | O_NONBLOCK);
+ #else
++#ifdef WIN32
++    u_long mode = 1;
++    ioctlsocket (sock, FIONBIO, &mode);
++#else
+ #error "add support for setting the socket non-blocking here"
+ #endif
++#endif
+ 
+     /* Create a session instance
+      */
+diff -urN libssh2-0.18.orig/example/simple/sftp_mkdir_nonblock.c libssh2-0.18.mingw/example/simple/sftp_mkdir_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_mkdir_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_mkdir_nonblock.c	2008-11-10 14:23:03.000000000 +0000
+@@ -92,8 +92,13 @@
+     rc = fcntl(sock, F_GETFL, 0);
+     fcntl(sock, F_SETFL, rc | O_NONBLOCK);
+ #else
++#ifdef WIN32
++    u_long mode = 1;
++    ioctlsocket (sock, FIONBIO, &mode);
++#else
+ #error "add support for setting the socket non-blocking here"
+ #endif
++#endif
+ 
+     /* Create a session instance
+      */
+diff -urN libssh2-0.18.orig/example/simple/sftp_nonblock.c libssh2-0.18.mingw/example/simple/sftp_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_nonblock.c	2008-11-10 14:22:30.000000000 +0000
+@@ -95,8 +95,13 @@
+     rc = fcntl(sock, F_GETFL, 0);
+     fcntl(sock, F_SETFL, rc | O_NONBLOCK);
+ #else
++#ifdef WIN32
++    u_long mode = 1;
++    ioctlsocket (sock, FIONBIO, &mode);
++#else
+ #error "add support for setting the socket non-blocking here"
+ #endif
++#endif
+ 
+     /* Create a session instance */
+     session = libssh2_session_init();
+diff -urN libssh2-0.18.orig/example/simple/sftp_RW_nonblock.c libssh2-0.18.mingw/example/simple/sftp_RW_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_RW_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_RW_nonblock.c	2008-11-10 14:23:18.000000000 +0000
+@@ -88,8 +88,13 @@
+     rc = fcntl(sock, F_GETFL, 0);
+     fcntl(sock, F_SETFL, rc | O_NONBLOCK);
+ #else
++#ifdef WIN32
++    u_long mode = 1;
++    ioctlsocket (sock, FIONBIO, &mode);
++#else
+ #error "add support for setting the socket non-blocking here"
+ #endif
++#endif
+ 
+     /* Create a session instance
+      */
+diff -urN libssh2-0.18.orig/example/simple/sftp_write_nonblock.c libssh2-0.18.mingw/example/simple/sftp_write_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_write_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_write_nonblock.c	2008-11-10 14:22:44.000000000 +0000
+@@ -107,8 +107,13 @@
+     rc = fcntl(sock, F_GETFL, 0);
+     fcntl(sock, F_SETFL, rc | O_NONBLOCK);
+ #else
++#ifdef WIN32
++    u_long mode = 1;
++    ioctlsocket (sock, FIONBIO, &mode);
++#else
+ #error "add support for setting the socket non-blocking here"
+ #endif
++#endif
+ 
+     /* Create a session instance
+         */
diff --git a/libssh2-05-remove-WINSOCK-VERSION.patch b/libssh2-05-remove-WINSOCK-VERSION.patch
new file mode 100644
index 0000000..9cd9228
--- /dev/null
+++ b/libssh2-05-remove-WINSOCK-VERSION.patch
@@ -0,0 +1,186 @@
+diff -urN libssh2-0.18.orig/example/simple/scp.c libssh2-0.18.mingw/example/simple/scp.c
+--- libssh2-0.18.orig/example/simple/scp.c	2007-08-12 22:39:55.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/scp.c	2008-11-10 14:18:13.000000000 +0000
+@@ -50,7 +50,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/scp_nonblock.c libssh2-0.18.mingw/example/simple/scp_nonblock.c
+--- libssh2-0.18.orig/example/simple/scp_nonblock.c	2007-09-24 13:15:45.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/scp_nonblock.c	2008-11-10 14:22:21.000000000 +0000
+@@ -50,7 +50,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/scp_write.c libssh2-0.18.mingw/example/simple/scp_write.c
+--- libssh2-0.18.orig/example/simple/scp_write.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/scp_write.c	2008-11-10 14:19:32.000000000 +0000
+@@ -54,7 +54,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/scp_write_nonblock.c libssh2-0.18.mingw/example/simple/scp_write_nonblock.c
+--- libssh2-0.18.orig/example/simple/scp_write_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/scp_write_nonblock.c	2008-11-10 14:22:13.000000000 +0000
+@@ -55,7 +55,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/sftp.c libssh2-0.18.mingw/example/simple/sftp.c
+--- libssh2-0.18.orig/example/simple/sftp.c	2007-09-24 13:14:18.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp.c	2008-11-10 14:15:47.000000000 +0000
+@@ -80,7 +80,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/sftpdir.c libssh2-0.18.mingw/example/simple/sftpdir.c
+--- libssh2-0.18.orig/example/simple/sftpdir.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftpdir.c	2008-11-10 14:18:41.000000000 +0000
+@@ -52,7 +52,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/sftpdir_nonblock.c libssh2-0.18.mingw/example/simple/sftpdir_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftpdir_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftpdir_nonblock.c	2008-11-10 14:23:35.000000000 +0000
+@@ -52,7 +52,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/sftp_mkdir.c libssh2-0.18.mingw/example/simple/sftp_mkdir.c
+--- libssh2-0.18.orig/example/simple/sftp_mkdir.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_mkdir.c	2008-11-10 14:18:33.000000000 +0000
+@@ -51,7 +51,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/sftp_mkdir_nonblock.c libssh2-0.18.mingw/example/simple/sftp_mkdir_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_mkdir_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_mkdir_nonblock.c	2008-11-10 14:23:03.000000000 +0000
+@@ -51,7 +51,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/sftp_nonblock.c libssh2-0.18.mingw/example/simple/sftp_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_nonblock.c	2008-11-10 14:22:30.000000000 +0000
+@@ -55,7 +55,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/sftp_RW_nonblock.c libssh2-0.18.mingw/example/simple/sftp_RW_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_RW_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_RW_nonblock.c	2008-11-10 14:23:18.000000000 +0000
+@@ -63,7 +63,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     /* Ultra basic "connect to port 22 on localhost"
+diff -urN libssh2-0.18.orig/example/simple/sftp_write.c libssh2-0.18.mingw/example/simple/sftp_write.c
+--- libssh2-0.18.orig/example/simple/sftp_write.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_write.c	2008-11-10 14:19:09.000000000 +0000
+@@ -57,7 +57,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/sftp_write_nonblock.c libssh2-0.18.mingw/example/simple/sftp_write_nonblock.c
+--- libssh2-0.18.orig/example/simple/sftp_write_nonblock.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/sftp_write_nonblock.c	2008-11-10 14:22:44.000000000 +0000
+@@ -57,7 +57,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/example/simple/ssh2.c libssh2-0.18.mingw/example/simple/ssh2.c
+--- libssh2-0.18.orig/example/simple/ssh2.c	2007-08-12 22:39:56.000000000 +0100
++++ libssh2-0.18.mingw/example/simple/ssh2.c	2008-11-10 14:14:32.000000000 +0000
+@@ -73,7 +76,7 @@
+ #ifdef WIN32
+     WSADATA wsadata;
+ 
+-    WSAStartup(WINSOCK_VERSION, &wsadata);
++    WSAStartup(MAKEWORD(2,0), &wsadata);
+ #endif
+ 
+     if (argc > 1) {
+diff -urN libssh2-0.18.orig/win32/libssh2_config.h libssh2-0.18.mingw/win32/libssh2_config.h
+--- libssh2-0.18.orig/win32/libssh2_config.h	2007-07-28 23:59:22.000000000 +0100
++++ libssh2-0.18.mingw/win32/libssh2_config.h	2008-11-10 14:15:24.000000000 +0000
+@@ -47,12 +47,10 @@
+ #define strncasecmp _strnicmp
+ #define strcasecmp _stricmp
+ #else
+-#ifdef __MINGW32__
+-#define WINSOCK_VERSION MAKEWORD(2,0)
+-#else
++#ifndef __MINGW32__
+ #define strncasecmp strnicmp
+ #define strcasecmp stricmp
+-#endif /* __MINGW32__ */
++#endif /* !__MINGW32__ */
+ #endif /* _MSC_VER */
+ 
+ /* Compile in zlib support */
diff --git a/mingw32-libssh2.spec b/mingw32-libssh2.spec
new file mode 100644
index 0000000..4c44033
--- /dev/null
+++ b/mingw32-libssh2.spec
@@ -0,0 +1,105 @@
+%global __strip %{_mingw32_strip}
+%global __objdump %{_mingw32_objdump}
+%global _use_internal_dependency_generator 0
+%global __find_requires %{_mingw32_findrequires}
+%global __find_provides %{_mingw32_findprovides}
+
+Name:           mingw32-libssh2
+Version:        1.1
+Release:        2%{?dist}
+Summary:        MinGW Windows library implementation of the SSH2 protocol
+
+License:        BSD
+Group:          Development/Libraries
+URL:            http://www.libssh2.org/
+Source0:        http://downloads.sourceforge.net/libssh2/libssh2-%{version}.tar.gz
+BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:      noarch
+
+BuildRequires:  mingw32-filesystem >= 33
+BuildRequires:  mingw32-gcc
+BuildRequires:  mingw32-binutils
+BuildRequires:  mingw32-openssl
+BuildRequires:  mingw32-zlib
+
+Requires:       pkgconfig
+
+%description
+libssh2 is a library implementing the SSH2 protocol as defined by
+Internet Drafts: SECSH-TRANS(22), SECSH-USERAUTH(25),
+SECSH-CONNECTION(23), SECSH-ARCH(20), SECSH-FILEXFER(06)*,
+SECSH-DHGEX(04), and SECSH-NUMBERS(10).
+
+
+%package static
+Summary:        Static version of the MinGW Windows SSH2 library
+Requires:       %{name} = %{version}-%{release}
+Group:          Development/Libraries
+
+%description static
+Static version of the MinGW Windows SSH2 library.
+
+
+%prep
+%setup -q -n libssh2-%{version}
+
+
+%build
+%{_mingw32_configure} --enable-static --enable-shared
+make %{?_smp_mflags}
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+make DESTDIR=$RPM_BUILD_ROOT install
+
+# Remove man pages which duplicate native Fedora.
+rm -r $RPM_BUILD_ROOT%{_mingw32_mandir}/man3
+
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+
+%files
+%defattr(-,root,root,-)
+%doc COPYING
+%{_mingw32_bindir}/libssh2-1.dll
+%{_mingw32_libdir}/libssh2.dll.a
+%{_mingw32_libdir}/libssh2.la
+%{_mingw32_includedir}/libssh2.h
+%{_mingw32_includedir}/libssh2_publickey.h
+%{_mingw32_includedir}/libssh2_sftp.h
+
+
+%files static
+%defattr(-,root,root,-)
+%{_mingw32_libdir}/libssh2.a
+
+%changelog
+* Fri May 22 2009 Erik van Pienbroek <epienbro at fedoraproject.org> - 1.1-2
+- Use %%global instead of %%define
+
+* Sat May  9 2009 Erik van Pienbroek <epienbro at fedoraproject.org> - 1.1-1
+- Update to version 1.1
+- Drop upstreamed patches
+
+* Fri Apr  3 2009 Erik van Pienbroek <epienbro at fedoraproject.org> - 0.18-6
+- Added -static subpackage
+- Fixed %%defattr line
+
+* Fri Feb 20 2009 Richard W.M. Jones <rjones at redhat.com> - 0.18-5
+- Rebuild for mingw32-gcc 4.4
+
+* Fri Feb  6 2009 Richard W.M. Jones <rjones at redhat.com> - 0.18-4
+- Include license file.
+
+* Fri Feb  6 2009 Richard W.M. Jones <rjones at redhat.com> - 0.18-3
+- Rebuild against new OpenSSH (because of soname bump).
+
+* Sat Jan 24 2009 Richard W.M. Jones <rjones at redhat.com> - 0.18-2
+- Update libtool installation.
+
+* Mon Nov 10 2008 Richard W.M. Jones <rjones at redhat.com> - 0.18-1
+- Initial RPM release.
diff --git a/sources b/sources
index e69de29..1162227 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+f8a3eb9bb814e0a5a2bb76a5423f5129  libssh2-1.1.tar.gz


More information about the scm-commits mailing list