[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Teaching Neon to compile ZLib on Windows

From: Branko Čibej <brane_at_xbc.nu>
Date: 2004-11-16 01:42:20 CET

Hi!

The other day while compiling Subversion on Windows in debug mode, I got
fed up with warnings about how ZLib wasn't linked against the debug CRT.
So I decided that it was time to revamp Neon's Win32 makefile again so
that it compiles ZLib with the correct parameters. Since ZLib 1.2.1
includes an acceptable makefile, and has been around for quite a while,
I thought that requiring this version (on Windows only) would not be too
ornery.

The patch is attached, diffed against the 0.24.x branch.

[[[
Change the Win32 build to compile ZLib from sources, and change the ZLib
versin requirement. This doesn't change neon.mak's external interface.

* neon.mak: Add parameters and targets for building ZLib from source.
* INSTALL.win32: Update the documentation, and note that the ZLib version
  must be at least 1.2.1.
]]]

-- Brane

Index: neon.mak
===================================================================
--- neon.mak (revision 353)
+++ neon.mak (working copy)
@@ -9,6 +9,18 @@
 !ENDIF
 
 ########
+# Debug vs. Release build
+!IF "$(DEBUG_BUILD)" == ""
+INTDIR = Release
+CFLAGS = /MD /W3 /GX /O2 /D "NDEBUG"
+TARGET = .\libneon.lib
+!ELSE
+INTDIR = Debug
+CFLAGS = /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG"
+TARGET = .\libneonD.lib
+!ENDIF
+
+########
 # Support for Expat integration
 #
 # If EXPAT_SRC or EXPAT_INC are set, then assume compiling against a
@@ -39,7 +51,6 @@
 EXPAT_FLAGS = /I "$(EXPAT_INC)" /D HAVE_EXPAT /D HAVE_EXPAT_H
 !ENDIF
 
-
 ########
 # Support for OpenSSL integration
 !IF "$(OPENSSL_SRC)" == ""
@@ -53,26 +64,30 @@
 !IF "$(ZLIB_SRC)" == ""
 ZLIB_FLAGS =
 ZLIB_LIBS =
+ZLIB_CLEAN =
 !ELSE
+ZLIB_CLEAN = ZLIB_CLEAN
+!IF "$(DEBUG_BUILD)" == ""
+ZLIB_STATICLIB = zlib.lib
+ZLIB_SHAREDLIB = zlib1.dll
+ZLIB_IMPLIB = zdll.lib
+ZLIB_LDFLAGS = /nologo /release
+!ELSE
+ZLIB_STATICLIB = zlib_d.lib
+ZLIB_SHAREDLIB = zlib1_d.dll
+ZLIB_IMPLIB = zdll_d.lib
+ZLIB_LDFLAGS = /nologo /debug
+!ENDIF
 ZLIB_FLAGS = /I "$(ZLIB_SRC)" /D NEON_ZLIB
 !IF "$(ZLIB_DLL)" == ""
-ZLIB_LIBS = "$(ZLIB_SRC)\zlibstat.lib"
+ZLIB_LIBS = "$(ZLIB_SRC)\$(ZLIB_STATICLIB)"
 !ELSE
 ZLIB_FLAGS = $(ZLIB_FLAGS) /D ZLIB_DLL
-ZLIB_LIBS = "$(ZLIB_SRC)\zlibdll.lib"
+ZLIB_LIBS = "$(ZLIB_SRC)\$(ZLIB_IMPLIB)"
 !ENDIF
 !ENDIF
 
 
-!IF "$(DEBUG_BUILD)" == ""
-INTDIR = Release
-CFLAGS = /MD /W3 /GX /O2 /D "NDEBUG"
-TARGET = .\libneon.lib
-!ELSE
-INTDIR = Debug
-CFLAGS = /MDd /W3 /Gm /GX /Zi /Od /D "_DEBUG"
-TARGET = .\libneonD.lib
-!ENDIF
 
 # Exclude stuff we don't need from the Win32 headers
 WIN32_DEFS = /D WIN32_LEAN_AND_MEAN /D NOUSER /D NOGDI /D NONLS /D NOCRYPT
@@ -130,7 +145,7 @@
 
 ALL: ".\src\config.h" "$(TARGET)"
 
-CLEAN:
+CLEAN: $(ZLIB_CLEAN)
         -@erase "$(INTDIR)\ne_207.obj"
         -@erase "$(INTDIR)\ne_alloc.obj"
         -@erase "$(INTDIR)\ne_acl.obj"
@@ -198,3 +213,24 @@
 "$(INTDIR)\ne_uri.obj": .\src\ne_uri.c
 "$(INTDIR)\ne_utils.obj": .\src\ne_utils.c
 "$(INTDIR)\ne_xml.obj": .\src\ne_xml.c
+
+"$(ZLIB_SRC)\$(ZLIB_STATICLIB)":
+ <<tempfile.bat
+ @echo off
+ cd /d "$(ZLIB_SRC)"
+ "$(MAKE)" /nologo /f win32\Makefile.msc CFLAGS="/nologo $(CFLAGS)" LDFLAGS="$(ZLIB_LDFLAGS)" STATICLIB=$(ZLIB_STATICLIB) $(ZLIB_STATICLIB)
+<<
+
+"$(ZLIB_SRC)\$(ZLIB_IMPLIB)":
+ <<tempfile.bat
+ @echo off
+ cd /d "$(ZLIB_SRC)"
+ "$(MAKE)" /nologo /f win32\Makefile.msc CFLAGS="/nologo $(CFLAGS)" LDFLAGS="$(ZLIB_LDFLAGS)" SHAREDLIB=$(ZLIB_SHAREDLIB) IMPLIB=$(ZLIB_IMPLIB) $(ZLIB_SHAREDLIB) $(ZLIB_IMPLIB)
+<<
+
+ZLIB_CLEAN:
+ <<tempfile.bat
+ @echo off
+ cd /d "$(ZLIB_SRC)"
+ "$(MAKE)" /nologo /f win32\Makefile.msc STATICLIB=$(ZLIB_STATICLIB) SHAREDLIB=$(ZLIB_SHAREDLIB) IMPLIB=$(ZLIB_IMPLIB) clean
+<<
Index: INSTALL.win32
===================================================================
--- INSTALL.win32 (revision 353)
+++ INSTALL.win32 (working copy)
@@ -85,20 +85,16 @@
 If you want to build Neon with the capability to decompress compressed
 content, then you need to compile against the Zlib library.
 
-Currently, the Neon's neon.mak file expects to compile and link a self
-compiled version of Zlib. You need Zlib 1.1.4 or greater. Zlib 1.1.3
-and older has a serious security issue.
+Neon's neon.mak file will compile and link the Zlib sources. You need
+Zlib 1.2.1 or later, as previous versions do not include build scripts
+for Win32.
 
-Here's how to compile Zlib.
+Here's how to compile in Zlib support.
 
   1) Get one of the Zlib source file packages in Zip format from
- http://www.gzip.org/zlib/
+ http://www.gzip.org/zlib/; for example,
+ http://www.gzip.org/zlib/zlib121.zip
   2) Unzip it.
- 3) Get the package
- http://www.gzip.org/zlib/contrib/zlib113-win32.zip
- 4) Unzip it and copy the Makefile from this package to the Zlib
- 1.1.4 or greater package.
- 5) Run nmake in the Zlib 1.1.4 or greater directory.
 
 Now add the ZLIB_SRC parameter to Neon's neon.mak pointing to your
 newly compiled zlib.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Nov 16 01:42:26 2004

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.