proposed changes for winbuild makefile
Date: Mon, 16 Jan 2017 08:32:12 +0000
I've attached a patch to address some issues in the Windows build.
See also https://github.com/curl/curl/issues/1201#issuecomment-272394593.
Based on the advice of Daniel, I switched away from Visual Studio version dependent lib\Makefile.vc<nn> to the (recommended) winbuild\Makefile.vc procedure.
I had to solve some things to be able to build curl with zlib, libssh2 and openSSL libraries at a different location, and with different names.
The patch tries to address the following issues:
- When using USE_PDB, conflicting flags (/Z7 and /Zi) are provided to the Visual Studio compiler of a Visual Studio version > 6 was used. A PDB file is only generated for libcurl/curl.dll, not for the curl.exe.
- The openSSL libraries have been renamed as of openSSL 1.1.0x. I added some makefile variables that allow to override the library names. The default assumptions of the MakefileBuild.vc are not (always) correct (e.g. libz_a.lib, which is in fact libz.a). Also compiler and linker flags can be overridden by using DEVEL_CFLAGS and/or DEVEL_LFLAGS variables.
An example of calling the make is: nmake -f Makefile.vc mode=static VC=14 WITH_SSL=static WITH_ZLIB=static WITH_SSH2=static GEN_PDB=yes DEBUG=no MACHINE=x64 SSL_CFLAGS="/I$(OpenSSLIncDir)" ZLIB_CFLAGS="/I$(ZlibIncDir)" SSH2_CFLAGS="/I$(Libssh2IncDir)" SSL_LIBS="libcrypto.lib libssl.lib" ZLIB_LIBS=zlib.lib SSH2_LIBS=libssh2.lib DEVEL_LFLAGS="/LIBPATH:$(OpenSSLLibDir) /LIBPATH:$(ZlibLibDir) /LIBPATH:$(Libssh2LibDir)". The $(xxx) are variables that point to the actual include and library paths.
- There was no clean target in Makefile.vc. And the clean target in MakefileBuild.vc was unreachable, due to some tests. This has been fixed, and nmake -f Makefile.vc mode=static clean now works.
- Minor cleanup in MakefileBuild.vc: DEVEL_BIN was not used.
The attached patch has been tested with static libz, libssh2 and openSSL libraries to build 32-bit and 64-bit optimized + debug curl DLL and curl static libs + curl.exe. If no makefile variables are specified to override libraries names and/or include or library paths, then the defaults fall back to the original behavior.
This is my first contribution to this mailing list. Not sure whether all information is provided. The patch is in *NIX style format and can be applied by using the patch tool.
List admin: https://cool.haxx.se/list/listinfo/curl-library
- application/octet-stream attachment: makefile.win.patch