mirror of
				https://github.com/libssh2/libssh2.git
				synced 2025-11-03 22:13:11 +03:00 
			
		
		
		
	Add support for win32.
Edit win32/config.mk to set the paths to your openssl and zlib headers and libraries. Then, from the root of the tree: nmake -f NMakefile voila.
This commit is contained in:
		
							
								
								
									
										9
									
								
								win32/.cvsignore
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								win32/.cvsignore
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
*.lib
 | 
			
		||||
*.pdb
 | 
			
		||||
*.dll
 | 
			
		||||
*.exe
 | 
			
		||||
*.obj
 | 
			
		||||
.*.swp
 | 
			
		||||
Debug
 | 
			
		||||
Release
 | 
			
		||||
*.exp
 | 
			
		||||
							
								
								
									
										24
									
								
								win32/config.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										24
									
								
								win32/config.mk
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,24 @@
 | 
			
		||||
 | 
			
		||||
# Tweak these for your system
 | 
			
		||||
OPENSSLINC=\local\php\php_build\include
 | 
			
		||||
OPENSSLLIB=\local\php\php_build\lib
 | 
			
		||||
 | 
			
		||||
ZLIBINC=-DLIBSSH2_HAVE_ZLIB=1 /I\local\php\php_build\include
 | 
			
		||||
ZLIBLIB=\local\php\php_build\lib
 | 
			
		||||
 | 
			
		||||
CPPFLAGS=/nologo /GL /Zi /EHsc /MD /Iwin32 /Iinclude /I$(OPENSSLINC) $(ZLIBINC) -DLIBSSH2_WIN32
 | 
			
		||||
CFLAGS=$(CPPFLAGS)
 | 
			
		||||
DLLFLAGS=$(CFLAGS) /LDd
 | 
			
		||||
LIBS=$(OPENSSLLIB)\libeay32.lib $(OPENSSLLIB)\ssleay32.lib ws2_32.lib $(ZLIBLIB)\zlib.lib
 | 
			
		||||
 | 
			
		||||
!if "$(TARGET)" == ""
 | 
			
		||||
TARGET=Debug
 | 
			
		||||
!endif
 | 
			
		||||
 | 
			
		||||
!if "$(TARGET)" == "Debug"
 | 
			
		||||
SUFFIX=_debug
 | 
			
		||||
!endif
 | 
			
		||||
 | 
			
		||||
INTDIR=$(TARGET)\$(SUBDIR)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										31
									
								
								win32/libssh2_config.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								win32/libssh2_config.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
#define WIN32
 | 
			
		||||
#include <winsock2.h>
 | 
			
		||||
#include <mswsock.h>
 | 
			
		||||
#include <ws2tcpip.h>
 | 
			
		||||
 | 
			
		||||
/* 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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* not really usleep, but safe for the way we use it in this lib */
 | 
			
		||||
static inline int usleep(int udelay)
 | 
			
		||||
{
 | 
			
		||||
	Sleep(udelay / 1000);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define snprintf	_snprintf
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										15
									
								
								win32/rules.mk
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								win32/rules.mk
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
 | 
			
		||||
all-sub: $(INTDIR) all
 | 
			
		||||
 | 
			
		||||
clean-sub: clean
 | 
			
		||||
 | 
			
		||||
$(INTDIR):
 | 
			
		||||
!if "$(SRCDIR)" == ""
 | 
			
		||||
	@if not exist $(TARGET) mkdir $(TARGET)
 | 
			
		||||
!endif
 | 
			
		||||
	@if not exist $(INTDIR) mkdir $(INTDIR)
 | 
			
		||||
 | 
			
		||||
{$(SUBDIR)}.c{$(INTDIR)}.obj::
 | 
			
		||||
	$(CC) -c $(CFLAGS) /Fo"$(INTDIR)\\" $<
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user