From f790221b35738c75629d754f6bedb2dc89fc9d7b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] libssh2 package. --- .hgignore | 1 + libssh2/libssh2-01-build-win-library.patch | 11 + libssh2/libssh2-02-libssh_priv-headers.patch | 58 ++++ libssh2/libssh2-03-remove-extra-config.patch | 373 ++++++++++++++++++++++++ libssh2/libssh2-04-non-blocking-examples.patch | 119 ++++++++ libssh2/libssh2-05-remove-WINSOCK-VERSION.patch | 186 ++++++++++++ libssh2/mingw32-libssh2.spec | 85 ++++++ 7 files changed, 833 insertions(+) create mode 100644 libssh2/libssh2-01-build-win-library.patch create mode 100644 libssh2/libssh2-02-libssh_priv-headers.patch create mode 100644 libssh2/libssh2-03-remove-extra-config.patch create mode 100644 libssh2/libssh2-04-non-blocking-examples.patch create mode 100644 libssh2/libssh2-05-remove-WINSOCK-VERSION.patch create mode 100644 libssh2/mingw32-libssh2.spec diff --git a/.hgignore b/.hgignore index 05b2b69..08f8c69 100644 --- a/.hgignore +++ b/.hgignore @@ -53,6 +53,7 @@ libidn/libidn-1.9.tar.gz libjpeg/jpegsrc.v6b.tar.gz libpng/libpng-1.2.31.tar.bz2 libsigc++20/libsigc++-2.2.2.tar.bz2 +libssh2/libssh2-0.18.tar.gz libvirt/libvirt-0.4.5.tar.gz libvirt/libvirt-0.4.6.tar.gz libxml2/libxml2-2.6.32.tar.gz diff --git a/libssh2/libssh2-01-build-win-library.patch b/libssh2/libssh2-01-build-win-library.patch new file mode 100644 index 0000000..55942d0 --- /dev/null +++ b/libssh2/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/libssh2-02-libssh_priv-headers.patch b/libssh2/libssh2-02-libssh_priv-headers.patch new file mode 100644 index 0000000..b480ba8 --- /dev/null +++ b/libssh2/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 ++#endif ++ ++#ifdef HAVE_WS2TCPIP_H ++#include ++#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 diff --git a/libssh2/libssh2-03-remove-extra-config.patch b/libssh2/libssh2-03-remove-extra-config.patch new file mode 100644 index 0000000..7693122 --- /dev/null +++ b/libssh2/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@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 and it should be used (not on Ultrix). +- */ +-#undef HAVE_ALLOCA_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_ARPA_INET_H +- +-/* disabled non-blocking sockets */ +-#undef HAVE_DISABLED_NONBLOCKING +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_DLFCN_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_ERRNO_H +- +-/* Define to 1 if you have the 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 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 header file. */ +-#undef HAVE_MEMORY_H +- +-/* Define to 1 if you have the 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 header file. */ +-#undef HAVE_STDINT_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_STDIO_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_STDLIB_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_STRINGS_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_STRING_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_SYS_IOCTL_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_SYS_SELECT_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_SYS_SOCKET_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_SYS_STAT_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_SYS_TIME_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_SYS_TYPES_H +- +-/* Define to 1 if you have the header file. */ +-#undef HAVE_SYS_UIO_H +- +-/* Define to 1 if you have the 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 + + #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 + + #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 + + #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 + +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 + #include + +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 + #include + +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 + #include + +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 + #include + +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 + #include + +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 + #include + +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 + #include + +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 + #include + +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 + #include + +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 + #include + ++#ifdef HAVE_WINDOWS_H ++# include ++#endif + #ifdef HAVE_WINSOCK2_H + # include + #endif diff --git a/libssh2/libssh2-04-non-blocking-examples.patch b/libssh2/libssh2-04-non-blocking-examples.patch new file mode 100644 index 0000000..765d9cb --- /dev/null +++ b/libssh2/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/libssh2-05-remove-WINSOCK-VERSION.patch b/libssh2/libssh2-05-remove-WINSOCK-VERSION.patch new file mode 100644 index 0000000..9cd9228 --- /dev/null +++ b/libssh2/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/libssh2/mingw32-libssh2.spec b/libssh2/mingw32-libssh2.spec new file mode 100644 index 0000000..d354877 --- /dev/null +++ b/libssh2/mingw32-libssh2.spec @@ -0,0 +1,85 @@ +%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-libssh2 +Version: 0.18 +Release: 1%{?dist} +Summary: MinGW Windows library implementing 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 +BuildRequires: autoconf, automake, libtool +BuildRequires: pkgconfig + +# MinGW-specific patches. +# Sent upstream 2008-11-10. +Patch1001: libssh2-01-build-win-library.patch +Patch1002: libssh2-02-libssh_priv-headers.patch +Patch1003: libssh2-03-remove-extra-config.patch +Patch1004: libssh2-04-non-blocking-examples.patch +Patch1005: libssh2-05-remove-WINSOCK-VERSION.patch + + +%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). + + +%prep +%setup -q -n libssh2-%{version} + +%patch1001 -p1 +%patch1002 -p1 +%patch1003 -p1 +%patch1004 -p1 +%patch1005 -p1 + +autoreconf + + +%build +%{_mingw32_configure} --disable-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) +%{_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 + + +%changelog +* Mon Nov 10 2008 Richard W.M. Jones - 0.18-1 +- Initial RPM release. -- 1.8.3.1