[Libreoffice-commits] .: cairo/cairo cairo/cairo-1.10.2.patch clucene/CustomTarget_source.mk clucene/patches filter/source gdk-pixbuf/gdk-pixbuf-2.23.0-win32.patch glib/glib-2.28.1-win32.patch hwpfilter/source libgsf/libgsf-1.14.19.windows.patch libpng/libpng-1.5.1.patch moz/makefile.mk neon/neon.patch nss/nss.patch nss/prj package/Library_package2.mk package/source RepositoryExternal.mk RepositoryFixes.mk RepositoryModule_ooo.mk sdext/source shell/inc shell/source solenv/inc tools/source zlib/CustomTarget_source.mk zlib/Makefile zlib/makefile.mk zlib/make_patched_header.pl zlib/Module_zlib.mk zlib/Package_source.mk zlib/patches zlib/prj zlib/StaticLibrary_zlib.mk zlib/zlib-1.2.5.patch

Caolán McNamara caolan at kemper.freedesktop.org
Fri Apr 13 06:07:23 PDT 2012


 RepositoryExternal.mk                                  |    4 
 RepositoryFixes.mk                                     |    6 -
 RepositoryModule_ooo.mk                                |    1 
 cairo/cairo-1.10.2.patch                               |   44 +++++++++
 cairo/cairo/makefile.mk                                |    5 +
 clucene/CustomTarget_source.mk                         |    1 
 clucene/patches/clucene-internal-zlib.patch            |   15 +++
 filter/source/flash/swfwriter1.cxx                     |    6 +
 gdk-pixbuf/gdk-pixbuf-2.23.0-win32.patch               |    2 
 glib/glib-2.28.1-win32.patch                           |   24 ++++-
 hwpfilter/source/hgzip.h                               |    5 +
 hwpfilter/source/hiodev.cxx                            |    5 +
 libgsf/libgsf-1.14.19.windows.patch                    |    4 
 libpng/libpng-1.5.1.patch                              |   48 ++++++++++
 moz/makefile.mk                                        |    6 -
 neon/neon.patch                                        |    9 +-
 nss/nss.patch                                          |   14 +++
 nss/prj/build.lst                                      |    2 
 package/Library_package2.mk                            |    6 +
 package/source/zipapi/Deflater.cxx                     |    4 
 package/source/zipapi/Inflater.cxx                     |    4 
 sdext/source/pdfimport/pdfparse/pdfentries.cxx         |    4 
 sdext/source/pdfimport/test/tests.cxx                  |    4 
 sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx       |    5 +
 shell/inc/internal/zipfile.hxx                         |    4 
 shell/source/win32/ooofilereader/makefile.mk           |    4 
 shell/source/win32/shlxthandler/columninfo/makefile.mk |    4 
 shell/source/win32/shlxthandler/infotips/makefile.mk   |    4 
 shell/source/win32/shlxthandler/makefile.mk            |    8 +
 shell/source/win32/shlxthandler/ooofilt/makefile.mk    |    8 +
 shell/source/win32/shlxthandler/prophdl/makefile.mk    |    4 
 shell/source/win32/shlxthandler/propsheets/makefile.mk |    4 
 shell/source/win32/shlxthandler/util/makefile.mk       |    4 
 shell/source/win32/zipfile/makefile.mk                 |    4 
 solenv/inc/libs.mk                                     |    6 +
 tools/source/zcodec/zcodec.cxx                         |    6 +
 zlib/CustomTarget_source.mk                            |   53 ------------
 zlib/Makefile                                          |   11 --
 zlib/Module_zlib.mk                                    |   36 --------
 zlib/Package_source.mk                                 |   38 --------
 zlib/StaticLibrary_zlib.mk                             |   70 ---------------
 zlib/make_patched_header.pl                            |   66 ++++++++++++++
 zlib/makefile.mk                                       |   75 +++++++++++++++++
 zlib/patches/minizip-null.patch                        |   12 --
 zlib/patches/zlib-1.2.5-gentoo.patch                   |   12 --
 zlib/patches/zlib-1.2.5-minizip-fixuncrypt.patch       |   14 ---
 zlib/patches/zlib-1.2.5-zip64.patch                    |   59 -------------
 zlib/prj/build.lst                                     |    5 -
 zlib/prj/d.lst                                         |   11 ++
 zlib/prj/makefile.mk                                   |    1 
 zlib/zlib-1.2.5.patch                                  |   67 +++++++++++++++
 51 files changed, 485 insertions(+), 333 deletions(-)

New commits:
commit 3934efe28c70b1c21a60f38fe726a935c15f4e99
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Apr 13 14:06:05 2012 +0100

    sigh, need a 64bit zlib too on windows, reverting

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index c0a3dd2..10dc633 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -90,12 +90,12 @@ endef
 else # !SYSTEM_ZLIB
 
 $(eval $(call gb_Helper_register_static_libraries,PLAINLIBS, \
-	z \
+	zlib \
 ))
 
 define gb_LinkTarget__use_zlib
 $(call gb_LinkTarget_use_static_libraries,$(1),\
-	z \
+	zlib \
 )
 
 endef
diff --git a/RepositoryFixes.mk b/RepositoryFixes.mk
index d07d791..77c51be 100644
--- a/RepositoryFixes.mk
+++ b/RepositoryFixes.mk
@@ -54,7 +54,7 @@ gb_Library_DLLFILENAMES := $(patsubst icuuc:icuuc%,icuuc:icuuc40%,$(gb_Library_D
 gb_Library_DLLFILENAMES := $(patsubst log_uno:log_uno%,log_uno:log_uno_uno%,$(gb_Library_DLLFILENAMES))
 gb_Library_DLLFILENAMES := $(patsubst ucbhelper:ucbhelper%,ucbhelper:ucbhelper4%,$(gb_Library_DLLFILENAMES))
 gb_Library_DLLFILENAMES := $(patsubst unsafe_uno:unsafe_uno%,unsafe_uno:unsafe_uno_uno%,$(gb_Library_DLLFILENAMES))
-gb_Library_DLLFILENAMES := $(patsubst z:z%,z:z%,$(gb_Library_DLLFILENAMES))
+gb_Library_DLLFILENAMES := $(patsubst z:z%,z:zlib%,$(gb_Library_DLLFILENAMES))
 
 gb_Library_FILENAMES := $(patsubst sb:isb%,sb:basic%,$(gb_Library_FILENAMES))
 gb_Library_FILENAMES := $(patsubst sfx:isfx%,sfx:sfx%,$(gb_Library_FILENAMES))
@@ -74,7 +74,7 @@ gb_Library_FILENAMES := $(patsubst rdf:irdf%,rdf:librdf.dll$(gb_Library_IARCEXT)
 gb_Library_FILENAMES := $(patsubst ssl:issl%,ssl:ssl%,$(gb_Library_FILENAMES))
 gb_Library_FILENAMES := $(patsubst xml2:ixml2%,xml2:libxml2$(gb_Library_IARCEXT),$(gb_Library_FILENAMES))
 gb_Library_FILENAMES := $(patsubst xslt:ixslt%,xslt:libxslt$(gb_Library_IARCEXT),$(gb_Library_FILENAMES))
-gb_Library_FILENAMES := $(patsubst z:iz%,z:z%,$(gb_Library_FILENAMES))
+gb_Library_FILENAMES := $(patsubst z:iz%,z:zlib%,$(gb_Library_FILENAMES))
 
 
 # Libraries not provided by mingw(-w64), available only in the Windows
@@ -109,7 +109,7 @@ gb_Library_FILENAMES := $(patsubst xmlsec1:ixmlsec1%,xmlsec1:libxmlsec%,$(gb_Lib
 gb_Library_FILENAMES := $(patsubst xmlsec1-mscrypto:ixmlsec1-mscrypto%,xmlsec1-mscrypto:libxmlsec-mscrypto%,$(gb_Library_FILENAMES))
 gb_Library_FILENAMES := $(patsubst xmlsec1-nss:ixmlsec1-nss%,xmlsec1-nss:libxmlsec-nss%,$(gb_Library_FILENAMES))
 gb_Library_FILENAMES := $(patsubst xslt:ixslt%,xslt:libxslt%,$(gb_Library_FILENAMES))
-gb_Library_FILENAMES := $(patsubst z:z%,z:z%,$(gb_Library_FILENAMES))
+gb_Library_FILENAMES := $(patsubst z:z%,z:zlib%,$(gb_Library_FILENAMES))
 
 
 # change the names of all import libraries that don't have an "i" prefix as in our standard naming schema
diff --git a/RepositoryModule_ooo.mk b/RepositoryModule_ooo.mk
index def8356..ea5d5ab 100644
--- a/RepositoryModule_ooo.mk
+++ b/RepositoryModule_ooo.mk
@@ -139,7 +139,6 @@ $(eval $(call gb_Module_add_moduledirs,ooo,\
     xmloff \
     xmlreader \
     xmlscript \
-    zlib \
 ))
 
 ifneq ($(SOLAR_JAVA),)
diff --git a/cairo/cairo-1.10.2.patch b/cairo/cairo-1.10.2.patch
index 2234383..d13c1e4 100644
--- a/cairo/cairo-1.10.2.patch
+++ b/cairo/cairo-1.10.2.patch
@@ -38,7 +38,7 @@
  DEFAULT_CFLAGS += -I. -I$(top_srcdir)
  DEFAULT_CFLAGS += $(PIXMAN_CFLAGS) $(LIBPNG_CFLAGS) $(ZLIB_CFLAGS)
 +DEFAULT_CFLAGS += $(SOLARINC)
-+DEFAULT_CFLAGS += -I$(SOLARVER)/$(INPATH)/inc/external/libpng -DDISABLE_SOME_FLOATING_POINT=1
++DEFAULT_CFLAGS += -I$(SOLARVER)/$(INPATH)/inc/zlib -I$(SOLARVER)/$(INPATH)/inc/external/libpng -DZLIB_FIX -DDISABLE_SOME_FLOATING_POINT=1
  
  CAIRO_CFLAGS = $(DEFAULT_CFLAGS) $(CFLAGS)
  
@@ -189,6 +189,20 @@
  
  			cairo_cv_xml_use=$use_xml
  			cairo_cv_xml_cache_vars=" BASE REQUIRES CFLAGS NONPKGCONFIG_CFLAGS LIBS NONPKGCONFIG_LIBS NONPKGCONFIG_EXTRA_LIBS"
+--- misc/cairo-1.10.2/src/cairo-deflate-stream.c	2010-06-18 13:47:12.000000000 +0200
++++ misc/build/cairo-1.10.2/src/cairo-deflate-stream.c	2010-06-18 13:47:12.000000000 +0200
+@@ -37,7 +37,11 @@
+ #include "cairoint.h"
+ #include "cairo-error-private.h"
+ #include "cairo-output-stream-private.h"
++#ifdef ZLIB_FIX
++#include <zlib/zlib.h>
++#else
+ #include <zlib.h>
++#endif
+ 
+ #define BUFFER_SIZE 16384
+ 
 --- misc/cairo-1.10.2/src/cairo-output-stream.c	2010-07-12 10:57:03.000000000 +0200
 +++ misc/build/cairo-1.10.2/src/cairo-output-stream.c	2010-07-12 10:57:03.000000000 +0200
 @@ -313,7 +313,11 @@
@@ -203,6 +217,34 @@
      decimal_point_len = strlen (decimal_point);
  
      assert (decimal_point_len != 0);
+--- misc/cairo-1.10.2/src/cairo-pdf-surface.c	2010-12-25 15:21:34.000000000 +0100
++++ misc/build/cairo-1.10.2/src/cairo-pdf-surface.c	2010-12-25 15:21:34.000000000 +0100
+@@ -57,7 +57,11 @@
+ #include "cairo-type3-glyph-surface-private.h"
+ 
+ #include <time.h>
++#ifdef ZLIB_FIX
++#include <zlib/zlib.h>
++#else
+ #include <zlib.h>
++#endif
+ 
+ /* Issues:
+  *
+--- misc/cairo-1.10.2/src/cairo-ps-surface.c	2010-12-25 15:21:34.000000000 +0100
++++ misc/build/cairo-1.10.2/src/cairo-ps-surface.c	2010-12-25 15:21:34.000000000 +0100
+@@ -72,7 +72,11 @@
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <time.h>
++#ifdef ZLIB_FIX
++#include <zlib/zlib.h>
++#else
+ #include <zlib.h>
++#endif
+ #include <errno.h>
+ 
+ #define DEBUG_PS 0
 --- misc/cairo-1.10.2/src/cairo-ft-font.c	2010-12-25 15:21:34.000000000 +0100
 +++ misc/build/cairo-1.10.2/src/cairo-ft-font.c	2010-12-25 15:21:34.000000000 +0100
 @@ -534,16 +534,16 @@
diff --git a/cairo/cairo/makefile.mk b/cairo/cairo/makefile.mk
index 51854dc..16a89bf 100644
--- a/cairo/cairo/makefile.mk
+++ b/cairo/cairo/makefile.mk
@@ -70,7 +70,12 @@ cairo_LDFLAGS=-L$(SOLARVER)$/$(INPATH)$/lib
 
 cairo_CPPFLAGS=
 
+.IF "$(SYSTEM_ZLIB)"!="YES"
+cairo_CPPFLAGS+=-I$(SOLARINCDIR)$/external$/zlib
+cairo_COMPRESS=z_compress
+.ELSE
 cairo_COMPRESS=compress
+.ENDIF
 cairo_CPPFLAGS+=$(INCLUDE)
 
 .IF "$(OS)"=="WNT"
diff --git a/clucene/CustomTarget_source.mk b/clucene/CustomTarget_source.mk
index a93b595..474d1b8 100644
--- a/clucene/CustomTarget_source.mk
+++ b/clucene/CustomTarget_source.mk
@@ -61,6 +61,7 @@ $(CLSO)/done : $(cl_FIXED_TARFILE_LOCATION) \
 	$(call gb_Helper_abbreviate_dirs, \
 	mkdir -p $(dir $@) && cd $(dir $@) && \
 	$(GNUTAR) -x -z $(STRIP_COMPONENTS)=1 -f $< && \
+	$(GNUPATCH) -p0 < $(SRCDIR)/clucene/patches/clucene-internal-zlib.patch && \
 	$(GNUPATCH) -p0 < $(SRCDIR)/clucene/patches/clucene-warnings.patch && \
 	$(GNUPATCH) -p0 < $(SRCDIR)/clucene/patches/clucene-gcc-atomics.patch && \
 	$(GNUPATCH) -p0 < $(SRCDIR)/clucene/patches/clucene-debug.patch && \
diff --git a/clucene/patches/clucene-internal-zlib.patch b/clucene/patches/clucene-internal-zlib.patch
new file mode 100644
index 0000000..6667926
--- /dev/null
+++ b/clucene/patches/clucene-internal-zlib.patch
@@ -0,0 +1,15 @@
+--- src/shared/CLucene/util/Misc.cpp	2012-02-17 15:33:09.217891100 +0000
++++ src/shared/CLucene/util/Misc.cpp	2012-02-17 15:38:10.836597500 +0000
+@@ -34,7 +34,11 @@
+ #include "CLucene/util/dirent.h" //if we have dirent, then the native one will be used
+ 
+ //for zlib...
+-#include "zlib.h"
++#ifdef SYSTEM_ZLIB
++#include <zlib.h>
++#else
++#include <external/zlib/zlib.h>
++#endif
+ #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
+ #  include <fcntl.h>
+ #  include <io.h>
diff --git a/filter/source/flash/swfwriter1.cxx b/filter/source/flash/swfwriter1.cxx
index 0151fa1..3f20b6c 100644
--- a/filter/source/flash/swfwriter1.cxx
+++ b/filter/source/flash/swfwriter1.cxx
@@ -41,7 +41,13 @@
 #include <vcl/graphictools.hxx>
 #include <vcl/rendergraphicrasterizer.hxx>
 
+#ifndef _ZLIB_H
+#ifdef SYSTEM_ZLIB
 #include <zlib.h>
+#else
+#include <external/zlib/zlib.h>
+#endif
+#endif
 
 #include <vcl/salbtype.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
diff --git a/gdk-pixbuf/gdk-pixbuf-2.23.0-win32.patch b/gdk-pixbuf/gdk-pixbuf-2.23.0-win32.patch
index 37a3d08..142ea34 100644
--- a/gdk-pixbuf/gdk-pixbuf-2.23.0-win32.patch
+++ b/gdk-pixbuf/gdk-pixbuf-2.23.0-win32.patch
@@ -208,7 +208,7 @@
 +GLIB_LIB = $(OUTDIR)\lib\glib-2.0.lib $(OUTDIR)\lib\gobject-2.0.lib  $(OUTDIR)\lib\gmodule-2.0.lib  $(OUTDIR)\lib\gio-2.0.lib $(OUTDIR)\lib\gthread-2.0.lib	
 +LIBJPEG_LIB = $(OUTDIR)\lib\jpeg.lib
 +LIBPNG_LIB = $(OUTDIR)\lib\libpng.lib
-+ZLIB_LIB = $(OUTDIR)\lib\z.lib
++ZLIB_LIB = $(OUTDIR)\lib\zlib.lib
 +GDIPLUS_LIB = gdiplus.lib
  
 -!INCLUDE $(TOP)/glib/build/win32/make.msc
diff --git a/glib/glib-2.28.1-win32.patch b/glib/glib-2.28.1-win32.patch
index f45b46f..3089f93 100644
--- a/glib/glib-2.28.1-win32.patch
+++ b/glib/glib-2.28.1-win32.patch
@@ -73,17 +73,26 @@
  !IFDEF ZLIB
  ZLIB_CFLAGS = -I $(ZLIB)
 -ZLIB_LIBS = $(ZLIB)\projects\visualc6\Win32_LIB_Release\zlib.lib
-+ZLIB_LIBS = $(OUTDIR)\lib\z.lib
++ZLIB_LIBS = $(OUTDIR)\lib\zlib.lib
  !ELSE
 -ZLIB_CFLAGS = -I $(DEVTOP)\include
 -ZLIB_LIBS = $(DEVTOP)\lib\zdll.lib
-+ZLIB_CFLAGS = -I $(OUTDIR)\inc\external
-+ZLIB_LIBS = $(OUTDIR)\lib\z.lib
++ZLIB_CFLAGS = -I $(OUTDIR)\inc\external\zlib
++ZLIB_LIBS = $(OUTDIR)\lib\zlib.lib
  !ENDIF
  
  ################
 --- misc/glib-2.28.1/gio/gzlibcompressor.c	2011-02-11 16:23:12.000000000 +0100
 +++ misc/build/glib-2.28.1/gio/gzlibcompressor.c	2011-03-07 10:33:19.559189800 +0100
+@@ -25,7 +25,7 @@
+ #include "gzlibcompressor.h"
+ 
+ #include <errno.h>
+-#include <zlib.h>
++#include <zlib/zlib.h>
+ #include <string.h>
+ 
+ #include "gfileinfo.h"
 @@ -64,8 +64,10 @@
  
    GZlibCompressorFormat format;
@@ -106,6 +115,15 @@
    if (compressor->format != G_ZLIB_COMPRESSOR_FORMAT_GZIP ||
 --- misc/glib-2.28.1/gio/gzlibdecompressor.c	2011-03-07 09:13:41.324890400 +0100
 +++ misc/build/glib-2.28.1/gio/gzlibdecompressor.c	2011-03-04 11:28:39.712480200 +0100
+@@ -25,7 +25,7 @@
+ #include "gzlibdecompressor.h"
+ 
+ #include <errno.h>
+-#include <zlib.h>
++#include <zlib/zlib.h>
+ #include <string.h>
+ 
+ #include "gfileinfo.h"
 @@ -76,7 +76,7 @@
  g_zlib_decompressor_set_gzheader (GZlibDecompressor *decompressor)
  {
diff --git a/hwpfilter/source/hgzip.h b/hwpfilter/source/hgzip.h
index 600d8f1..c8b2cbe 100644
--- a/hwpfilter/source/hgzip.h
+++ b/hwpfilter/source/hgzip.h
@@ -29,7 +29,12 @@
 #ifndef _HWPGZIP_H_
 #define _HWPGZIP_H_
 
+// DVO: add zlib/ prefix
+#ifdef SYSTEM_ZLIB
 #include <zlib.h>
+#else
+#include "zlib/zlib.h"
+#endif
 
 class HStream;
 /**
diff --git a/hwpfilter/source/hiodev.cxx b/hwpfilter/source/hiodev.cxx
index e8b45d6..20b368a 100644
--- a/hwpfilter/source/hiodev.cxx
+++ b/hwpfilter/source/hiodev.cxx
@@ -28,7 +28,12 @@
 
 #include <stdio.h>
 #include <errno.h>
+// DVO: add zlib/ prefix
+#ifdef SYSTEM_ZLIB
 #include <zlib.h>
+#else
+#include <zlib/zlib.h>
+#endif
 #ifdef WIN32
 # include <io.h>
 #else
diff --git a/libgsf/libgsf-1.14.19.windows.patch b/libgsf/libgsf-1.14.19.windows.patch
index 98e0a8f..56c10c5 100644
--- a/libgsf/libgsf-1.14.19.windows.patch
+++ b/libgsf/libgsf-1.14.19.windows.patch
@@ -55,7 +55,7 @@
 +
 +.INCLUDE : settings.mk
 +
-+CFLAGS+= -I.. -I$(SOLARINCDIR)$/external$/glib-2.0 -I$(SOLARINCDIR)$/external
++CFLAGS+= -I.. -I$(SOLARINCDIR)$/external$/glib-2.0 -I$(SOLARINCDIR)$/external$/zlib -I$(SOLARINCDIR)$/external
 +
 +# --- Files -------------------------------------
 +
@@ -115,7 +115,7 @@
 +    gobject-2.0.lib \
 +    glib-2.0.lib \
 +    intl.lib \
-+    z.lib \
++    zlib.lib \
 +	Advapi32.lib
 +
 +
diff --git a/libpng/libpng-1.5.1.patch b/libpng/libpng-1.5.1.patch
index 58f7011..ebae94a 100644
--- a/libpng/libpng-1.5.1.patch
+++ b/libpng/libpng-1.5.1.patch
@@ -231,3 +231,51 @@
 +#define PNG_iTXt_SUPPORTED
 +/* end of options */
 +#endif /* PNGLCONF_H */
+--- misc/libpng-1.5.1/pngstruct.h	2011-02-03 05:58:17.000000000 +0100
++++ misc/build/libpng-1.5.1/pngstruct.h	2011-03-24 21:47:23.380397048 +0100
+@@ -24,7 +24,15 @@
+  * in this structure and is required for decompressing the LZ compressed
+  * data in PNG files.
+  */
++/* WTF, surely this should depend explicitly on whether using the system or
++ * internal zlib, not on OS... But yeah, so maybe MacOSX, iOS and Android are the only OSes for which
++ * we use a system zlib but internal libpng, at least by default.
++ */
++#if defined MACOSX || defined IOS || defined ANDROID
+ #include "zlib.h"
++#else
++#include <external/zlib/zlib.h>
++#endif
+ 
+ struct png_struct_def
+ {
+--- misc/libpng-1.5.1/pngtest.c	2011-02-03 05:58:17.000000000 +0100
++++ misc/build/libpng-1.5.1/pngtest.c	2011-03-24 21:47:23.380397048 +0100
+@@ -31,7 +31,12 @@
+  * of files at once by typing "pngtest -m file1.png file2.png ..."
+  */
+
++#if defined MACOSX || defined IOS || defined ANDROID
+ #include "zlib.h"
++#else
++#include <external/zlib/zlib.h>
++#endif
++
+ #include "png.h"
+ /* Copied from pngpriv.h but only used in error messages below. */
+ #ifndef PNG_ZBUF_SIZE
+--- misc/libpng-1.5.1/pngvalid.c	2011-02-03 05:58:17.000000000 +0100
++++ misc/build/libpng-1.5.1/pngvalid.c	2011-03-24 21:47:23.381397048 +0100
+@@ -51,7 +51,11 @@
+ #define PNG_READ_16BIT_SUPPORTED
+ #endif
+
+-#include "zlib.h"   /* For crc32 */
++#if defined MACOSX || defined IOS || defined ANDROID
++#include "zlib.h"
++#else
++#include <external/zlib/zlib.h>
++#endif
+
+ #include <float.h>  /* For floating point constants */
+ #include <stdlib.h> /* For malloc */
diff --git a/moz/makefile.mk b/moz/makefile.mk
index 6b31556..13db91f 100644
--- a/moz/makefile.mk
+++ b/moz/makefile.mk
@@ -220,14 +220,16 @@ MOZDIR=$(MISC)$/build$/seamonkey
 MOZTARGET=$(OS)$(COM)$(CPU)
 
 .IF "$(GUI)"=="WNT"
-#for moz to link to our static lz if necessary
-SYSTEM_ZLIB:="YES"
 # "Our" build environment uses "NO" for the environment variable that
 # indicate if system libraries should be used, the mozilla build uses
 # "" in this case. This conflicts (at least for W32) with mozilla (1.7b)
 # because it disables the library checks for msvc so that
 # --without-system-* is not evaluated. To build the included libraries
 # the affected variables have to be empty and not NO.
+.IF "$(SYSTEM_ZLIB)"=="NO"
+SYSTEM_ZLIB:=
+.EXPORT : SYSTEM_ZLIB
+.ENDIF
 .IF "$(SYSTEM_JPEG)"=="NO"
 SYSTEM_JPEG:=
 .EXPORT : SYSTEM_JPEG
diff --git a/neon/neon.patch b/neon/neon.patch
index cbb2db1..b7a3f85 100644
--- a/neon/neon.patch
+++ b/neon/neon.patch
@@ -492,7 +492,7 @@
 +#endif
 --- misc/neon-0.29.5/src/makefile.mk	2011-02-03 10:32:38.000000000 +0100
 +++ misc/build/neon-0.29.5/src/makefile.mk	2011-02-03 10:26:19.000000000 +0100
-@@ -1,1 +1,89 @@
+@@ -1,1 +1,96 @@
 -dummy
 +PRJ=..$/..$/..$/..$/..
 +
@@ -523,6 +523,13 @@
 +CFLAGS+= $(OPENSSL_CFLAGS)
 +.ENDIF
 +
++.IF "$(SYSTEM_ZLIB)" == "YES"
++CFLAGS+=-DSYSTEM_ZLIB
++.ELSE
++ZLIBINCDIR=external$/zlib
++CFLAGS+=-I$(SOLARINCDIR)$/$(ZLIBINCDIR)
++.ENDIF
++
 +SLOFILES= \
 +        $(SLO)$/ne_207.obj \
 +        $(SLO)$/ne_acl3744.obj \
diff --git a/nss/nss.patch b/nss/nss.patch
index 3764cc4..6930e67 100644
--- a/nss/nss.patch
+++ b/nss/nss.patch
@@ -67,6 +67,20 @@
  LDFLAGS			+= $(ARCHFLAG)
  
  # INCLUDES += -I/usr/include -Y/usr/include/linux
+@@ -158,8 +161,13 @@
+ #
+ CPU_TAG = _$(CPU_ARCH)
+ 
++ifeq ($(SYSTEM_ZLIB),YES)  
++# Currently (3.12.4) only the tools modutil and signtool are linked with libz
++# If USE_SYSTEM_ZLIB is not set then the tools link statically libzlib.a which
++# is also build in nss.
+ USE_SYSTEM_ZLIB = 1
+ ZLIB_LIBS = -lz
++endif
+ 
+ # The -rpath '$$ORIGIN' linker option instructs this library to search for its
+ # dependencies in the same directory where it resides.
 --- misc/nss-3.12.8/mozilla/security/coreconf/SunOS5.mk	2009-06-11 02:55:32.000000000 +0200
 +++ misc/build/nss-3.12.8/mozilla/security/coreconf/SunOS5.mk	2010-06-11 16:35:54.985571182 +0200
 @@ -89,8 +89,12 @@
diff --git a/nss/prj/build.lst b/nss/prj/build.lst
index 23cea65..14963ff 100644
--- a/nss/prj/build.lst
+++ b/nss/prj/build.lst
@@ -1,3 +1,3 @@
-ns	nss	: solenv ZLIB:zlib NULL
+ns	nss	: solenv NULL
 ns	nss						nmake	-	usr1	ns_mkout NULL
 ns	nss						nmake	-	all	ns_nss NULL
diff --git a/package/Library_package2.mk b/package/Library_package2.mk
index fcb7b62..223e280 100644
--- a/package/Library_package2.mk
+++ b/package/Library_package2.mk
@@ -88,4 +88,10 @@ $(eval $(call gb_Library_add_exception_objects,package2,\
 	package/source/zippackage/ZipPackageStream \
 ))
 
+ifeq ($(SYSTEM_ZLIB),YES)
+$(eval $(call gb_Library_add_defs,package2,\
+	-DSYSTEM_ZLIB \
+))
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/package/source/zipapi/Deflater.cxx b/package/source/zipapi/Deflater.cxx
index 3333c0d..75d9d39 100644
--- a/package/source/zipapi/Deflater.cxx
+++ b/package/source/zipapi/Deflater.cxx
@@ -27,7 +27,11 @@
  ************************************************************************/
 
 #include <package/Deflater.hxx>
+#ifdef SYSTEM_ZLIB
 #include <zlib.h>
+#else
+#include <external/zlib/zlib.h>
+#endif
 #include <com/sun/star/packages/zip/ZipConstants.hpp>
 #include <string.h> // for memset
 
diff --git a/package/source/zipapi/Inflater.cxx b/package/source/zipapi/Inflater.cxx
index b83eea0..2149e59 100644
--- a/package/source/zipapi/Inflater.cxx
+++ b/package/source/zipapi/Inflater.cxx
@@ -27,7 +27,11 @@
  ************************************************************************/
 
 #include <package/Inflater.hxx>
+#ifdef SYSTEM_ZLIB
 #include <zlib.h>
+#else
+#include <external/zlib/zlib.h>
+#endif
 #include <string.h> // for memset
 
 using namespace com::sun::star::uno;
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
index 14ff3b9..9c36cf8 100644
--- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx
+++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx
@@ -36,7 +36,11 @@
 #include <rtl/digest.h>
 #include <rtl/cipher.h>
 #include <rtl/memory.h>
+#ifdef SYSTEM_ZLIB
 #include "zlib.h"
+#else
+#include <zlib/zlib.h>
+#endif
 
 #include <math.h>
 #include <map>
diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx
index f77c82e..ab4e5fc 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -32,7 +32,11 @@
 
 #define BASEGFX_STATICLIBRARY
 
+#ifdef SYSTEM_ZLIB
 #include "zlib.h"
+#else
+#include <zlib/zlib.h>
+#endif
 
 #include "outputwrap.hxx"
 #include "contentsink.hxx"
diff --git a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
index aee3a70..71b0c89 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pnghelper.cxx
@@ -32,7 +32,12 @@
 #include "pnghelper.hxx"
 #include <sal/macros.h>
 
+#ifdef SYSTEM_ZLIB
 #include "zlib.h"
+#else
+#define ZLIB_INTERNAL 1
+#include <zlib/zlib.h>
+#endif
 
 using namespace pdfi;
 
diff --git a/shell/inc/internal/zipfile.hxx b/shell/inc/internal/zipfile.hxx
index 7b11941..24fba65 100644
--- a/shell/inc/internal/zipfile.hxx
+++ b/shell/inc/internal/zipfile.hxx
@@ -33,7 +33,11 @@
 #define _WINDOWS
 #endif
 
+#ifdef SYSTEM_ZLIB
 #include <zlib.h>
+#else
+#include <external/zlib/zlib.h>
+#endif
 
 #include <string>
 #include <vector>
diff --git a/shell/source/win32/ooofilereader/makefile.mk b/shell/source/win32/ooofilereader/makefile.mk
index 6b9d1ef..b26e10a 100644
--- a/shell/source/win32/ooofilereader/makefile.mk
+++ b/shell/source/win32/ooofilereader/makefile.mk
@@ -47,6 +47,10 @@ CFLAGS_X64+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
 .ENDIF
 CDEFS_X64+=-U_WIN32_IE -D_WIN32_IE=0x501 -U_WIN32_WINNT -D_WIN32_WINNT=0x0501
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CDEFS += -DSYSTEM_ZLIB
+.END
+
 # --- Files --------------------------------------------------------
 
 
diff --git a/shell/source/win32/shlxthandler/columninfo/makefile.mk b/shell/source/win32/shlxthandler/columninfo/makefile.mk
index 31c019f..7157f8f 100644
--- a/shell/source/win32/shlxthandler/columninfo/makefile.mk
+++ b/shell/source/win32/shlxthandler/columninfo/makefile.mk
@@ -42,6 +42,10 @@ CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
 .ENDIF
 CDEFS+=-U_WIN32_IE -D_WIN32_IE=0x501 -U_WIN32_WINNT -D_WIN32_WINNT=0x0501
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CDEFS += -DSYSTEM_ZLIB
+.END
+
 # --- Files --------------------------------------------------------
 
 SLOFILES=$(SLO)$/columninfo.obj
diff --git a/shell/source/win32/shlxthandler/infotips/makefile.mk b/shell/source/win32/shlxthandler/infotips/makefile.mk
index e7caf3a..38126a5 100644
--- a/shell/source/win32/shlxthandler/infotips/makefile.mk
+++ b/shell/source/win32/shlxthandler/infotips/makefile.mk
@@ -42,6 +42,10 @@ CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
 .ENDIF
 CDEFS+=-U_WIN32_IE -D_WIN32_IE=0x501 -U_WIN32_WINNT -D_WIN32_WINNT=0x0501
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CDEFS += -DSYSTEM_ZLIB
+.END
+
 # --- Files --------------------------------------------------------
 
 SLOFILES=$(SLO)$/$(TARGET).obj
diff --git a/shell/source/win32/shlxthandler/makefile.mk b/shell/source/win32/shlxthandler/makefile.mk
index b15f0ee..81c3515 100644
--- a/shell/source/win32/shlxthandler/makefile.mk
+++ b/shell/source/win32/shlxthandler/makefile.mk
@@ -59,6 +59,10 @@ CDEFS+=-DDONT_HAVE_GDIPLUS
 
 CDEFS+=-U_WIN32_IE -D_WIN32_IE=0x501 -U_WIN32_WINNT -D_WIN32_WINNT=0x0501
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CDEFS += -DSYSTEM_ZLIB
+.END
+
 # --- Files --------------------------------------------------------
 
 SLOFILES=$(SLO)$/classfactory.obj\
@@ -78,7 +82,7 @@ SHL1STDLIBS=$(ZLIB3RDLIB) $(MINIZIP3RDLIB) $(EXPAT3RDLIB) $(COMCTL32LIB)
 SHL1LIBS=
 .ELSE
 SHL1STDLIBS=
-SHL1LIBS=$(SOLARLIBDIR)$/$(ZLIB3RDLIB)\
+SHL1LIBS=$(SOLARLIBDIR)$/zlib.lib\
     $(SOLARLIBDIR)$/expat_xmlparse.lib\
     $(SOLARLIBDIR)$/expat_xmltok.lib
 .ENDIF
@@ -128,7 +132,7 @@ SLOFILES_X64= \
     $(SLO_X64)$/stream_helper.obj\
 
 SHL1TARGET_X64=$(TARGET)
-SHL1LIBS_X64=$(SOLARLIBDIR_X64)$/$(ZLIB3RDLIB)\
+SHL1LIBS_X64=$(SOLARLIBDIR_X64)$/zlib.lib\
     $(SOLARLIBDIR_X64)$/expat_xmlparse.lib\
     $(SOLARLIBDIR_X64)$/expat_xmltok.lib
 
diff --git a/shell/source/win32/shlxthandler/ooofilt/makefile.mk b/shell/source/win32/shlxthandler/ooofilt/makefile.mk
index 2ccf2ca..afb2988 100644
--- a/shell/source/win32/shlxthandler/ooofilt/makefile.mk
+++ b/shell/source/win32/shlxthandler/ooofilt/makefile.mk
@@ -46,6 +46,10 @@ CFLAGS+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
 .ENDIF
 CDEFS+=-U_WIN32_IE -D_WIN32_IE=0x501 -U_WIN32_WINNT -D_WIN32_WINNT=0x0501
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CDEFS += -DSYSTEM_ZLIB
+.END
+
 # --- Files --------------------------------------------------------
 
 SLOFILES=$(SLO)$/ooofilt.obj\
@@ -58,7 +62,7 @@ SHL1STDLIBS=$(ZLIB3RDLIB) $(MINIZIP3RDLIB) $(EXPAT3RDLIB)
 SHL1LIBS=
 .ELSE
 SHL1STDLIBS=
-SHL1LIBS=$(SOLARLIBDIR)$/$(ZLIB3RDLIB)\
+SHL1LIBS=$(SOLARLIBDIR)$/zlib.lib\
     $(SOLARLIBDIR)$/expat_xmlparse.lib\
     $(SOLARLIBDIR)$/expat_xmltok.lib
 .ENDIF
@@ -104,7 +108,7 @@ SLOFILES_X64=$(SLO_X64)$/ooofilt.obj\
 
 SHL1TARGET_X64=$(TARGET)
 
-SHL1LIBS_X64=$(SOLARLIBDIR_X64)$/$(ZLIB3RDLIB)\
+SHL1LIBS_X64=$(SOLARLIBDIR_X64)$/zlib.lib\
     $(SOLARLIBDIR_X64)$/expat_xmlparse.lib\
     $(SOLARLIBDIR_X64)$/expat_xmltok.lib
 
diff --git a/shell/source/win32/shlxthandler/prophdl/makefile.mk b/shell/source/win32/shlxthandler/prophdl/makefile.mk
index 56355e1..8a6813a 100644
--- a/shell/source/win32/shlxthandler/prophdl/makefile.mk
+++ b/shell/source/win32/shlxthandler/prophdl/makefile.mk
@@ -67,7 +67,7 @@ SHL1STDLIBS=$(ZLIB3RDLIB) $(MINIZIP3RDLIB) $(EXPAT3RDLIB) $(COMCTL32LIB)
 SHL1LIBS=
 .ELSE
 SHL1STDLIBS=
-SHL1LIBS=$(SOLARLIBDIR)$/$(ZLIB3RDLIB)\
+SHL1LIBS=$(SOLARLIBDIR)$/zlib.lib\
     $(SOLARLIBDIR)$/expat_xmlparse.lib\
     $(SOLARLIBDIR)$/expat_xmltok.lib
 .ENDIF
@@ -115,7 +115,7 @@ SLOFILES_X64= \
     $(SLO_X64)$/stream_helper.obj\
 
 SHL1TARGET_X64=$(TARGET)
-SHL1LIBS_X64=$(SOLARLIBDIR_X64)$/$(ZLIB3RDLIB)\
+SHL1LIBS_X64=$(SOLARLIBDIR_X64)$/zlib.lib\
     $(SOLARLIBDIR_X64)$/expat_xmlparse.lib\
     $(SOLARLIBDIR_X64)$/expat_xmltok.lib
 
diff --git a/shell/source/win32/shlxthandler/propsheets/makefile.mk b/shell/source/win32/shlxthandler/propsheets/makefile.mk
index 68c65b2..08adff7 100644
--- a/shell/source/win32/shlxthandler/propsheets/makefile.mk
+++ b/shell/source/win32/shlxthandler/propsheets/makefile.mk
@@ -44,6 +44,10 @@ CFLAGS_X64+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
 CDEFS_X64+=-U_WIN32_WINNT -D_WIN32_WINNT=0x0501 -U_WIN32_IE -D_WIN32_IE=0x501
 .ENDIF
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CDEFS += -DSYSTEM_ZLIB
+.END
+
 # --- Files --------------------------------------------------------
 
 SLOFILES=$(SLO)$/propsheets.obj\
diff --git a/shell/source/win32/shlxthandler/util/makefile.mk b/shell/source/win32/shlxthandler/util/makefile.mk
index f2edb7f..e2b7a82 100644
--- a/shell/source/win32/shlxthandler/util/makefile.mk
+++ b/shell/source/win32/shlxthandler/util/makefile.mk
@@ -47,6 +47,10 @@ CFLAGS_X64+=-wd4710 -wd4711 -wd4514 -wd4619 -wd4217 -wd4820
 .ENDIF
 CDEFS_X64+=-U_WIN32_IE -D_WIN32_IE=0x501 -U_WIN32_WINNT -D_WIN32_WINNT=0x0501
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CDEFS += -DSYSTEM_ZLIB
+.END
+
 # --- Files --------------------------------------------------------
 
 SLOFILES=$(SLO)$/fileextensions.obj\
diff --git a/shell/source/win32/zipfile/makefile.mk b/shell/source/win32/zipfile/makefile.mk
index 5d2d162..0e165dd 100644
--- a/shell/source/win32/zipfile/makefile.mk
+++ b/shell/source/win32/zipfile/makefile.mk
@@ -35,6 +35,10 @@ EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
 
 .INCLUDE :  settings.mk
 
+.IF "$(SYSTEM_ZLIB)" == "YES"
+CDEFS += -DSYSTEM_ZLIB
+.END
+
 # --- Files --------------------------------------------------------
 
 
diff --git a/solenv/inc/libs.mk b/solenv/inc/libs.mk
index 4b536fd..3adeb01 100644
--- a/solenv/inc/libs.mk
+++ b/solenv/inc/libs.mk
@@ -193,7 +193,11 @@ EXPATASCII3RDLIB=-lexpat
 EXPAT3RDLIB=-lexpat_xmlparse -lexpat_xmltok
 EXPATASCII3RDLIB=-lascii_expat_xmlparse -lexpat_xmltok
 .ENDIF
+.IF "$(SYSTEM_ZLIB)"=="YES"
 ZLIB3RDLIB=-lz
+.ELSE
+ZLIB3RDLIB=-lzlib
+.ENDIF
 .IF "$(SYSTEM_MINIZIP)"=="YES"
 MINIZIP3RDLIB=$(MINIZIP_LIBS)
 .ELSE
@@ -463,7 +467,7 @@ LNGLIB=ilng.lib
 CLUCENELIB=iclucene.lib
 EXPAT3RDLIB=expat_xmltok.lib expat_xmlparse.lib
 EXPATASCII3RDLIB=expat_xmltok.lib ascii_expat_xmlparse.lib
-ZLIB3RDLIB=z.lib
+ZLIB3RDLIB=zlib.lib
 JPEG3RDLIB=jpeglib.lib
 NEON3RDLIB=ineon.lib
 BERKELEYLIB=libdb47.lib
diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx
index 45429dc..46d3f24 100644
--- a/tools/source/zcodec/zcodec.cxx
+++ b/tools/source/zcodec/zcodec.cxx
@@ -27,7 +27,13 @@
  ************************************************************************/
 
 #include <tools/stream.hxx>
+#ifndef _ZLIB_H
+#ifdef SYSTEM_ZLIB
 #include "zlib.h"
+#else
+#include "zlib/zlib.h"
+#endif
+#endif
 #include <tools/zcodec.hxx>
 #include <rtl/crc.h>
 #include <osl/endian.h>
diff --git a/zlib/CustomTarget_source.mk b/zlib/CustomTarget_source.mk
deleted file mode 100644
index e051ab0..0000000
--- a/zlib/CustomTarget_source.mk
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2012 Red Hat, Inc., Caolán McNamara <caolanm at redhat.com>
-#  (initial developer)
-# Copyright (C) 2012 Red Hat, Inc., David Tardon <dtardon at redhat.com>
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-$(eval $(call gb_CustomTarget_CustomTarget,zlib/source))
-
-ZLSO := $(call gb_CustomTarget_get_workdir,zlib/source)
-
-$(call gb_CustomTarget_get_target,zlib/source) : $(ZLSO)/done
-
-# FIXME: do not hardcode the path here
-ifeq ($(OS_FOR_BUILD),WNT)
-zl_FIXED_TARFILE_LOCATION := $(shell cygpath -u $(TARFILE_LOCATION))/c735eab2d659a96e5a594c9e8541ad63-zlib-1.2.5.tar.gz
-else
-zl_FIXED_TARFILE_LOCATION := $(TARFILE_LOCATION)/c735eab2d659a96e5a594c9e8541ad63-zlib-1.2.5.tar.gz
-endif
-
-$(ZLSO)/done : $(zl_FIXED_TARFILE_LOCATION)
-	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),TAR,1)
-	$(call gb_Helper_abbreviate_dirs, \
-	mkdir -p $(dir $@) && cd $(dir $@) && \
-	$(GNUTAR) -x -z $(STRIP_COMPONENTS)=1 -f $< && \
-    $(GNUPATCH) -p1 < $(SRCDIR)/zlib/patches/zlib-1.2.5-gentoo.patch && \
-    $(GNUPATCH) -p1 < $(SRCDIR)/zlib/patches/minizip-null.patch && \
-    $(GNUPATCH) -p1 < $(SRCDIR)/zlib/patches/zlib-1.2.5-minizip-fixuncrypt.patch && \
-    $(GNUPATCH) -p1 < $(SRCDIR)/zlib/patches/zlib-1.2.5-zip64.patch )
-	touch $@
-
-# vim: set noet sw=4 ts=4:
diff --git a/zlib/Makefile b/zlib/Makefile
deleted file mode 100644
index 5f46a97..0000000
--- a/zlib/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-
-EXTERNAL_WARNINGS_NOT_ERRORS := TRUE
-export EXTERNAL_WARNINGS_NOT_ERRORS
-
-module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
-
-include $(module_directory)/../solenv/gbuild/partial_build.mk
-
-# vim: set noet sw=4 ts=4:
diff --git a/zlib/Module_zlib.mk b/zlib/Module_zlib.mk
deleted file mode 100644
index 42c1e5d..0000000
--- a/zlib/Module_zlib.mk
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2012 Red Hat, Inc., Caolán McNamara <caolanm at redhat.com>
-#  (initial developer)
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-$(eval $(call gb_Module_Module,zlib))
-
-$(eval $(call gb_Module_add_targets,zlib,\
-    CustomTarget_source \
-    StaticLibrary_zlib \
-    Package_source \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/zlib/Package_source.mk b/zlib/Package_source.mk
deleted file mode 100644
index 3479f08..0000000
--- a/zlib/Package_source.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2012 Red Hat, Inc., Caolán McNamara <caolanm at redhat.com>
-#  (initial developer)
-# Copyright (C) 2012 Red Hat, Inc., David Tardon <dtardon at redhat.com>
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-$(eval $(call gb_Package_Package,zlib_source,$(call gb_CustomTarget_get_workdir,zlib/source)))
-
-$(call gb_Package_get_preparation_target,zlib_source) : $(call gb_CustomTarget_get_target,zlib/source)
-
-$(eval $(call gb_Package_add_file,zlib_source,inc/external/zconf.h,zconf.h))
-$(eval $(call gb_Package_add_file,zlib_source,inc/external/zlib.h,zlib.h))
-$(eval $(call gb_Package_add_file,zlib_source,inc/external/minizip/unzip.h,contrib/minizip/unzip.h))
-$(eval $(call gb_Package_add_file,zlib_source,inc/external/minizip/ioapi.h,contrib/minizip/ioapi.h))
-
-# vim: set noet sw=4 ts=4:
diff --git a/zlib/StaticLibrary_zlib.mk b/zlib/StaticLibrary_zlib.mk
deleted file mode 100644
index bb862d6..0000000
--- a/zlib/StaticLibrary_zlib.mk
+++ /dev/null
@@ -1,70 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-# Version: MPL 1.1 / GPLv3+ / LGPLv3+
-#
-# The contents of this file are subject to the Mozilla Public License Version
-# 1.1 (the "License"); you may not use this file except in compliance with
-# the License or as specified alternatively below. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS IS" basis,
-# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
-# for the specific language governing rights and limitations under the
-# License.
-#
-# Major Contributor(s):
-# Copyright (C) 2012 Red Hat, Inc., Caolán McNamara <caolanm at redhat.com>
-#  (initial developer)
-#
-# All Rights Reserved.
-#
-# For minor contributions see the git repository.
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
-# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
-# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
-# instead of those above.
-
-$(eval $(call gb_StaticLibrary_StaticLibrary,z))
-
-$(eval $(call gb_StaticLibrary_use_package,z,zlib_source))
-
-$(eval $(call gb_StaticLibrary_set_warnings_not_errors,zlib))
-
-$(eval $(call gb_StaticLibrary_set_include,z,\
-	$$(INCLUDE) \
-))
-
-$(eval $(call gb_StaticLibrary_add_defs,z,\
-    $(LFS_CFLAGS) \
-))
-
-# zlib does not depend on sal nor needs uwinapi here
-$(eval $(call gb_StaticLibrary_use_libraries,z,\
-    $(filter-out uwinapi,$(gb_STDLIBS)) \
-))
-
-ifeq ($(OS),LINUX)
-$(eval $(call gb_StaticLibrary_use_libraries,z,\
-    m \
-    pthread \
-))
-endif
-
-$(eval $(call gb_StaticLibrary_add_generated_cobjects,z,\
-	CustomTarget/zlib/source/adler32 \
-	CustomTarget/zlib/source/compress \
-	CustomTarget/zlib/source/deflate \
-	CustomTarget/zlib/source/crc32 \
-	CustomTarget/zlib/source/inffast \
-	CustomTarget/zlib/source/inflate \
-	CustomTarget/zlib/source/inftrees \
-	CustomTarget/zlib/source/trees \
-	CustomTarget/zlib/source/zutil \
-	,$(if $(filter TRUE,$(EXTERNAL_WARNINGS_NOT_ERRORS)),\
-		$(filter-out $(gb_CFLAGS_WERROR),$(CFLAGS)),\
-		$(CFLAGS)) \
-	 $(gb_COMPILEROPTFLAGS) \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/zlib/make_patched_header.pl b/zlib/make_patched_header.pl
new file mode 100755
index 0000000..41dbdc5
--- /dev/null
+++ b/zlib/make_patched_header.pl
@@ -0,0 +1,66 @@
+:
+eval 'exec perl -S $0 ${1+"$@"}'
+    if 0;
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org.  If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+#
+# make_patched_header - make patched header
+#
+
+use strict;
+use File::Basename;
+use File::Path;
+use Carp;
+
+my $patched_file = shift @ARGV;
+$patched_file =~ s/\\/\//g;
+my $module = shift @ARGV;
+my $patch_dir = dirname($patched_file);
+my $orig_file = $patched_file;
+$orig_file =~ s/\/patched\//\//;
+
+if (!-f $orig_file) { carp("Cannot find file $orig_file\n"); };
+if (!-d $patch_dir) {
+    mkpath($patch_dir, 0, 0775);
+    if (!-d $patch_dir) {("mkdir: could not create directory $patch_dir\n"); };
+};
+
+open(PATCHED_FILE, ">$patched_file") or carp("Cannot open file $patched_file\n");
+open(ORIG_FILE, "<$orig_file") or carp("Cannot open file $orig_file\n");
+foreach (<ORIG_FILE>) {
+    if (/#include\s*"(\w+\.h\w*)"/) {
+        my $include = $1;
+        s/#include "$include"/#include <$module\/$include>/g;
+    };
+    print PATCHED_FILE $_;
+};
+close PATCHED_FILE;
+close ORIG_FILE;
+
+exit(0);
+
+
diff --git a/zlib/makefile.mk b/zlib/makefile.mk
new file mode 100644
index 0000000..6165ccc
--- /dev/null
+++ b/zlib/makefile.mk
@@ -0,0 +1,75 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+# 
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org.  If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=.
+
+PRJNAME=zlib
+TARGET=zlib
+
+.IF "$(GUI)" == "UNX"
+.IF "$(SYSTEM_ZLIB)" == "YES"
+all:
+    @echo "An already available installation of zlib should exist on your system."
+    @echo "Therefore the version provided here does not need to be built in addition."
+.ENDIF
+.ENDIF
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE :	settings.mk
+
+# --- Files --------------------------------------------------------
+
+TARFILE_NAME=zlib-1.2.5
+TARFILE_MD5=c735eab2d659a96e5a594c9e8541ad63
+
+PATCH_FILES=zlib-1.2.5.patch
+ADDITIONAL_FILES=makefile.mk
+
+#relative to CONFIGURE_DIR
+
+BUILD_DIR=$(CONFIGURE_DIR)
+BUILD_ACTION=dmake $(MFLAGS) $(CALLMACROS)
+
+OUT2INC= \
+    zlib.h \
+    zconf.h \
+    contrib$/minizip$/unzip.h \
+    contrib$/minizip$/ioapi.h
+
+PATCHED_HEADERS=$(INCCOM)$/patched$/zlib.h
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : set_ext.mk
+.INCLUDE :	target.mk
+.INCLUDE :	tg_ext.mk
+
+ALLTAR: $(PATCHED_HEADERS)
+
+$(PATCHED_HEADERS) : $(PACKAGE_DIR)$/$(PREDELIVER_FLAG_FILE)
+    @$(PERL) make_patched_header.pl $@ $(PRJNAME)
diff --git a/zlib/patches/minizip-null.patch b/zlib/patches/minizip-null.patch
deleted file mode 100644
index bffe207..0000000
--- a/zlib/patches/minizip-null.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up zlib-1.2.5/contrib/minizip/unzip.c.pom zlib-1.2.5/contrib/minizip/unzip.c
---- zlib-1.2.5/contrib/minizip/unzip.c.pom	2010-02-15 12:59:40.000000000 +0100
-+++ zlib-1.2.5/contrib/minizip/unzip.c	2011-04-06 12:06:04.000000000 +0200
-@@ -1145,7 +1145,7 @@ extern int ZEXPORT unzGetCurrentFileInfo
-                                                 szFileName,fileNameBufferSize,
-                                                 extraField,extraFieldBufferSize,
-                                                 szComment,commentBufferSize);
--    if (err==UNZ_OK)
-+    if (pfile_info && err==UNZ_OK)
-     {
-         pfile_info->version = file_info64.version;
-         pfile_info->version_needed = file_info64.version_needed;
diff --git a/zlib/patches/zlib-1.2.5-gentoo.patch b/zlib/patches/zlib-1.2.5-gentoo.patch
deleted file mode 100644
index 82c7f39..0000000
--- a/zlib/patches/zlib-1.2.5-gentoo.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -up zlib-1.2.5/zlib.h.pom zlib-1.2.5/zlib.h
---- zlib-1.2.5/zlib.h.pom	2010-04-20 06:12:48.000000000 +0200
-+++ zlib-1.2.5/zlib.h	2010-06-16 13:08:59.000000000 +0200
-@@ -1578,7 +1578,7 @@ ZEXTERN int ZEXPORT inflateBackInit_ OF(
- #  define gzoffset gzoffset64
- #  define adler32_combine adler32_combine64
- #  define crc32_combine crc32_combine64
--#  ifdef _LARGEFILE64_SOURCE
-+#  ifndef _LARGEFILE64_SOURCE
-      ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *));
-      ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int));
-      ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile));
diff --git a/zlib/patches/zlib-1.2.5-minizip-fixuncrypt.patch b/zlib/patches/zlib-1.2.5-minizip-fixuncrypt.patch
deleted file mode 100644
index d113879..0000000
--- a/zlib/patches/zlib-1.2.5-minizip-fixuncrypt.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-diff -up zlib-1.2.5/contrib/minizip/unzip.c.fixuncrypt zlib-1.2.5/contrib/minizip/unzip.c
---- zlib-1.2.5/contrib/minizip/unzip.c.fixuncrypt	2011-11-11 12:13:56.335867758 -0500
-+++ zlib-1.2.5/contrib/minizip/unzip.c	2011-11-11 12:14:01.747799372 -0500
-@@ -68,10 +68,6 @@
- #include <stdlib.h>
- #include <string.h>
- 
--#ifndef NOUNCRYPT
--        #define NOUNCRYPT
--#endif
--
- #include "zlib.h"
- #include "unzip.h"
- 
diff --git a/zlib/patches/zlib-1.2.5-zip64.patch b/zlib/patches/zlib-1.2.5-zip64.patch
deleted file mode 100644
index 2bc94de..0000000
--- a/zlib/patches/zlib-1.2.5-zip64.patch
+++ /dev/null
@@ -1,59 +0,0 @@
-diff -ru zlib-1.2.5/contrib/minizip/ioapi.c zlib-1.2.5-patch/contrib/minizip/ioapi.c
---- zlib-1.2.5/contrib/minizip/ioapi.c	2010-01-04 12:31:24.000000000 -0500
-+++ zlib-1.2.5-patch/contrib/minizip/ioapi.c	2011-07-05 15:47:48.263474587 -0400
-@@ -47,7 +47,7 @@
-     else
-     {
-         uLong tell_uLong = (*(pfilefunc->ztell32_file))(pfilefunc->zfile_func64.opaque,filestream);
--        if ((tell_uLong) == ((uLong)-1))
-+        if ((tell_uLong) == MAXU32)
-             return (ZPOS64_T)-1;
-         else
-             return tell_uLong;
-diff -ru zlib-1.2.5/contrib/minizip/ioapi.h zlib-1.2.5-patch/contrib/minizip/ioapi.h
---- zlib-1.2.5/contrib/minizip/ioapi.h	2010-02-15 06:59:40.000000000 -0500
-+++ zlib-1.2.5-patch/contrib/minizip/ioapi.h	2011-07-05 15:48:36.281546917 -0400
-@@ -85,6 +85,8 @@
- typedef uint64_t ZPOS64_T;
- #else
- 
-+/* Maximum unsigned 32-bit value used as placeholder for zip64 */
-+#define MAXU32 0xffffffff
- 
- #if defined(_MSC_VER) || defined(__BORLANDC__)
- typedef unsigned __int64 ZPOS64_T;
-diff -ru zlib-1.2.5/contrib/minizip/unzip.c zlib-1.2.5-patch/contrib/minizip/unzip.c
---- zlib-1.2.5/contrib/minizip/unzip.c	2010-02-15 06:59:40.000000000 -0500
-+++ zlib-1.2.5-patch/contrib/minizip/unzip.c	2011-07-05 15:50:31.409310349 -0400
-@@ -1040,26 +1040,26 @@
-             {
-                                                         uLong uL;
- 
--                                                                if(file_info.uncompressed_size == (ZPOS64_T)(unsigned long)-1)
-+                                                                if(file_info.uncompressed_size == MAXU32)
-                                                                 {
-                                                                         if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.uncompressed_size) != UNZ_OK)
-                                                                                         err=UNZ_ERRNO;
-                                                                 }
- 
--                                                                if(file_info.compressed_size == (ZPOS64_T)(unsigned long)-1)
-+                                                                if(file_info.compressed_size == MAXU32)
-                                                                 {
-                                                                         if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info.compressed_size) != UNZ_OK)
-                                                                                   err=UNZ_ERRNO;
-                                                                 }
- 
--                                                                if(file_info_internal.offset_curfile == (ZPOS64_T)(unsigned long)-1)
-+                                                                if(file_info_internal.offset_curfile == MAXU32)
-                                                                 {
-                                                                         /* Relative Header offset */
-                                                                         if (unz64local_getLong64(&s->z_filefunc, s->filestream,&file_info_internal.offset_curfile) != UNZ_OK)
-                                                                                 err=UNZ_ERRNO;
-                                                                 }
- 
--                                                                if(file_info.disk_num_start == (unsigned long)-1)
-+                                                                if(file_info.disk_num_start == MAXU32)
-                                                                 {
-                                                                         /* Disk Start Number */
-                                                                         if (unz64local_getLong(&s->z_filefunc, s->filestream,&uL) != UNZ_OK)
-
diff --git a/zlib/prj/build.lst b/zlib/prj/build.lst
index 2eb61b4..8ef73d9 100644
--- a/zlib/prj/build.lst
+++ b/zlib/prj/build.lst
@@ -1,3 +1,2 @@
-cl	zlib : soltools NULL
-cl	zlib			usr1	-   all	zl_mkout NULL
-cl	zlib\prj		nmake	-   all	zl_prj NULL
+zl	zlib	:	soltools NULL
+zl	zlib						nmake	-	all	zl_mkout NULL
diff --git a/zlib/prj/d.lst b/zlib/prj/d.lst
index e69de29..ef40caf 100644
--- a/zlib/prj/d.lst
+++ b/zlib/prj/d.lst
@@ -0,0 +1,11 @@
+mkdir: %_DEST%\inc\external\zlib
+mkdir: %_DEST%\lib\x64
+
+..\%__SRC%\inc\patched\zlib.h %_DEST%\inc\external\zlib\zlib.h
+..\%__SRC%\inc\zconf.h %_DEST%\inc\external\zlib\zconf.h
+
+..\%__SRC%\lib\libzlib.a %_DEST%\lib\libzlib.a
+..\%__SRC%\slb\zlib.lib %_DEST%\lib\zlib.lib
+..\%__SRC%\slb\zlib.lin %_DEST%\lib\zlib.lin
+..\%__SRC%\slb\x64\zlib.lib %_DEST%\lib\x64\zlib.lib
+..\%__SRC%\slb\x64\zlib.lin %_DEST%\lib\x64\zlib.lin
diff --git a/zlib/prj/makefile.mk b/zlib/prj/makefile.mk
deleted file mode 100644
index 0997622..0000000
--- a/zlib/prj/makefile.mk
+++ /dev/null
@@ -1 +0,0 @@
-.INCLUDE : gbuildbridge.mk
diff --git a/zlib/zlib-1.2.5.patch b/zlib/zlib-1.2.5.patch
new file mode 100644
index 0000000..3389b88
--- /dev/null
+++ b/zlib/zlib-1.2.5.patch
@@ -0,0 +1,67 @@
+--- misc/zlib-1.2.5/makefile.mk	Fri Mar 14 10:17:06 2008
++++ misc/build/zlib-1.2.5/makefile.mk	Fri Mar 14 10:16:56 2008
+@@ -1 +1,63 @@
+-dummy
++#*************************************************************************
++#
++#   Copyright according the GNU Public License.
++#
++#*************************************************************************
++
++PRJ=..$/..$/..$/..
++
++PRJNAME=zlib
++TARGET=zlib
++LIBTARGET=NO
++EXTERNAL_WARNINGS_NOT_ERRORS=TRUE
++
++# --- Settings -----------------------------------------------------
++
++.INCLUDE :  settings.mk
++
++# --- Files --------------------------------------------------------
++
++INCEXT=contrib$/minizip
++
++SLOFILES=	$(SLO)$/adler32.obj		\
++			$(SLO)$/compress.obj	\
++			$(SLO)$/deflate.obj		\
++			$(SLO)$/crc32.obj		\
++			$(SLO)$/inffast.obj		\
++			$(SLO)$/inflate.obj		\
++			$(SLO)$/inftrees.obj	\
++			$(SLO)$/trees.obj		\
++			$(SLO)$/zutil.obj
++
++
++LIB1TARGET=$(SLB)$/$(TARGET).lib
++LIB1ARCHIV=$(LB)$/lib$(TARGET).a
++LIB1OBJFILES=$(SLOFILES)
++
++.IF "$(BUILD_X64)"!=""
++SLOFILES_X64=	$(SLO_X64)$/adler32.obj		\
++			$(SLO_X64)$/compress.obj	\
++			$(SLO_X64)$/deflate.obj		\
++			$(SLO_X64)$/crc32.obj		\
++			$(SLO_X64)$/inffast.obj		\
++			$(SLO_X64)$/inflate.obj		\
++			$(SLO_X64)$/inftrees.obj	\
++			$(SLO_X64)$/trees.obj		\
++			$(SLO_X64)$/zutil.obj
++
++LIB1TARGET_X64=$(SLB_X64)$/$(TARGET).lib
++LIB1OBJFILES_X64=$(SLOFILES_X64)
++.ENDIF # "$(BUILD_X64)"!=""
++
++
++# --- Targets ------------------------------------------------------
++
++$(MISC)$/%.c : contrib$/minizip$/%.c
++	@echo ------------------------------
++	@echo Making: $@
++    @$(COPY) $< $@
++
++.INCLUDE :  set_wntx64.mk
++.INCLUDE :  target.mk
++.INCLUDE :  tg_wntx64.mk
++


More information about the Libreoffice-commits mailing list