The OpenSAML V2 software has reached its End of Life and is no longer supported. This documentation is available for historical purposes only.

zlib

zlib is a common compression library that OpenSAML relies on for deflate/inflate support.

Project website: http://zlib.org/

zlib is provided with most Linux and Unix operating systems.

Non-Windows

If you're building from source on a non-Windows platform, a default build is generally fine.

Windows

On Windows, zlib is pretty much a mess. The only modern project files are for building a DLL that uses the WINAPI calling convention for Visual Basic applications, and the default Makefile doesn't handle debug builds, or create properly versioned DLL and import library names. Short of a total rewrite, I built this by manually adjusting the makefile with different settings, running a build, and then copying the output files into separate directories.

Copying OpenSSL's sound versioning discipline, they also just added two entry points to a patch release.

First I do the 32-bit Release build:

  • Edit win32/Makefile.msc and change:

    • IMPLIB=zlib1.lib

    • SHAREDLIB=zlib1_2.dll

  • nmake /f win32\Makefile.msc
  • mkdir Release
  • copy zlib1.* Release
  • nmake /f win32\Makefile.msc clean

Now, the 64-bit Release build, switching to the x64 Tools command prompt:

  • mkdir x64
  • mkdir x64\Release
  • nmake /f win32\Makefile.msc
  • copy zlib1.* x64\Release
  • nmake /f win32\Makefile.msc clean

Now the 32-bit Debug build, switching to the 32-bit Tools command prompt:

  • Edit win32/Makefile.msc and change:
    • IMPLIB=zlib1D.lib
    •  SHAREDLIB=zlib1_2D.dll
  • Change CFLAGS and turn /MD into /MDd, and add -D_DEBUG to WFLAGS
  • nmake win32/Makefile.msc
  • mkdir Debug
  • copy zlib1D.* Debug
  • nmake /f win32\Makefile.msc clean

Now, the 64-bit Debug build, switching back to the x64 Tools command prompt:

  • mkdir x64\Debug
  • nmake /f win32\Makefile.msc
  • copy zlib1D.* x64\Debug
  • nmake /f win32\Makefile.msc clean


The following files dependencies subdirectory of the cpp-msbuild project can be used to automate the build:

  • ..\cpp-msbuild\dependencies\config.bat to set up the environment
  • ..\cpp-msbuild\dependencies\zlib.bat to create the modified makefiles (requires 'sed' on the path)
  • X86 build (requires the appropriate VS command line):

    ..\cpp-msbuild\dependencies\zlib-compile.bat .
  • X64 build (requires the appropriate VS command line):

    ..\cpp-msbuild\dependencies\zlib-compile.bat x64