These five patches enable libssh2 to be cross-compiled from a Fedora Linux system to Windows using Fedora's new MinGW cross-compiler:
https://fedoraproject.org/wiki/MinGW
After applying these patches, you can cross-compile from a Fedora system using:
autoreconf mingw32-configure --enable-shared make
and you will end up with libssh2-1.dll and assorted Windows executables in the example/simple directory, which you can test using Wine or Windows.
I tested the example programs using Wine and an OpenSSH sshd and they appeared to work fine.
Rich.
Need to add 'AC_LIBTOOL_WIN32_DLL' _before_ 'AC_PROG_LIBTOOL' to persuade libtool that it is safe to build a Windows DLL.
Rich.
Currently Windows builds use a separate header file in the win32 subdirectory. This patch pulls the important bits out of that header file into the main "libssh2_priv.h" header file. The extras here are to check for and use the windows headers, and the implementation of iovec/writev.
Of course they are defended by #ifdef WIN32 ... #endif so that this still works on Linux.
Rich.
The example/simple/config.h{,in} header file isn't needed, it duplicates what is already in libssh2_config.h, it breaks autoheader, and it isn't rebuilt correctly when configure.ac changes. This patch removes the file completely.
Rich.
This patch implements non-blocking sockets for Windows in the example programs, meaning they can now be compiled under Windows.
Rich.
The WINSOCK_VERSION macro is defined centrally and passed to all instances of WSAStartup. However for the example programs the version of winsock declared isn't very important (as long as it's >= 2.0) and it's not likely you'd ever want to change it.
Because this complicates cross-compiling vs. building straight up in Visual Studio, I just removed this unnecessary macro.
Rich.
On Mon, 10 Nov 2008, Richard W.M. Jones wrote:
The WINSOCK_VERSION macro is defined centrally and passed to all instances of WSAStartup. However for the example programs the version of winsock declared isn't very important (as long as it's >= 2.0) and it's not likely you'd ever want to change it.
Thanks a lot for this patch set! I've been wanting to get this done for quite some time...
I applied all parts that were successfully merged, and there was only one part that wasn't clear to me at a quick glance how I should edit it so the changes to "win32/libssh2_config.h" were not committed.
Can you please give the current CVS a check and see how that patch is to be applied?