summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-libs/zlib/files')
-rw-r--r--sys-libs/zlib/files/zlib-1.2.1-build-fPIC.patch72
-rw-r--r--sys-libs/zlib/files/zlib-1.2.1-configure.patch103
-rw-r--r--sys-libs/zlib/files/zlib-1.2.1-fPIC.patch16
-rw-r--r--sys-libs/zlib/files/zlib-1.2.1-glibc.patch12
-rw-r--r--sys-libs/zlib/files/zlib-1.2.3-LDFLAGS.patch31
-rw-r--r--sys-libs/zlib/files/zlib-1.2.3-build.patch66
-rw-r--r--sys-libs/zlib/files/zlib-1.2.3-mingw-implib.patch13
-rw-r--r--sys-libs/zlib/files/zlib-1.2.3-r1-bsd-soname.patch15
-rw-r--r--sys-libs/zlib/files/zlib-1.2.3-visibility-support.patch45
-rw-r--r--sys-libs/zlib/files/zlib-1.2.4-minizip-autotools.patch64
-rw-r--r--sys-libs/zlib/files/zlib-1.2.5-fbsd_chosts.patch15
-rw-r--r--sys-libs/zlib/files/zlib-1.2.5-ldflags.patch22
-rw-r--r--sys-libs/zlib/files/zlib-1.2.5-lfs-decls.patch15
-rw-r--r--sys-libs/zlib/files/zlib-1.2.5.1-symlinks.patch33
-rw-r--r--sys-libs/zlib/files/zlib-1.2.5.1-version.patch22
15 files changed, 544 insertions, 0 deletions
diff --git a/sys-libs/zlib/files/zlib-1.2.1-build-fPIC.patch b/sys-libs/zlib/files/zlib-1.2.1-build-fPIC.patch
new file mode 100644
index 000000000000..86d05c8a61c5
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.1-build-fPIC.patch
@@ -0,0 +1,72 @@
+--- zlib-1.2.1/Makefile.in
++++ zlib-1.2.1/Makefile.in
+@@ -49,6 +49,8 @@
+ OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
+ zutil.o inflate.o infback.o inftrees.o inffast.o
+
++PIC_OBJS = $(OBJS:%.o=%.lo)
++
+ OBJA =
+ # to use the asm code: make OBJA=match.o
+
+@@ -77,8 +79,11 @@
+ mv _match.o match.o
+ rm -f _match.s
+
+-$(SHAREDLIBV): $(OBJS)
+- $(LDSHARED) -o $@ $(OBJS) -lc
++%.lo: %.c
++ $(CC) $(CFLAGS) -DPIC -fPIC -c $< -o $@
++
++$(SHAREDLIBV): $(PIC_OBJS)
++ $(LDSHARED) -o $@ $(PIC_OBJS) -lc
+ rm -f $(SHAREDLIB) $(SHAREDLIBM)
+ ln -s $@ $(SHAREDLIB)
+ ln -s $@ $(SHAREDLIBM)
+@@ -89,13 +94,10 @@
+ minigzip$(EXE): minigzip.o $(LIBS)
+ $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
+
+-install: $(LIBS)
++install-libs: $(LIBS)
+ -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
+- -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
+ -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
+ -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
+- cp zlib.h zconf.h $(includedir)
+- chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
+ cp $(LIBS) $(libdir)
+ cd $(libdir); chmod 755 $(LIBS)
+ -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
+@@ -110,6 +112,11 @@
+ # The ranlib in install is needed on NeXTSTEP which checks file times
+ # ldconfig is for Linux
+
++install: install-libs
++ -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi
++ cp zlib.h zconf.h $(includedir)
++ chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
++
+ uninstall:
+ cd $(includedir); \
+ cd $(libdir); rm -f libz.a; \
+@@ -127,7 +127,7 @@
+
+ mostlyclean: clean
+ clean:
+- rm -f *.o *~ example$(EXE) minigzip$(EXE) \
++ rm -f *.lo *.o *~ example$(EXE) minigzip$(EXE) \
+ libz.* foo.gz so_locations \
+ _match.s maketree contrib/infback9/*.o
+
+--- zlib-1.2.1/configure
++++ zlib-1.2.1/configure
+@@ -160,7 +160,7 @@
+ if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
+ test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
+ CFLAGS="$SFLAGS"
+- LIBS="$SHAREDLIBV"
++ LIBS="$LIBS $SHAREDLIBV"
+ echo Building shared library $SHAREDLIBV with $CC.
+ elif test -z "$old_cc" -a -z "$old_cflags"; then
+ echo No shared library support.
diff --git a/sys-libs/zlib/files/zlib-1.2.1-configure.patch b/sys-libs/zlib/files/zlib-1.2.1-configure.patch
new file mode 100644
index 000000000000..477fc5c26b53
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.1-configure.patch
@@ -0,0 +1,103 @@
+--- configure.orig 2004-06-29 18:49:20.065187520 -0400
++++ configure 2004-06-29 18:52:54.142642800 -0400
+@@ -160,8 +160,8 @@
+ if test $shared -eq 1; then
+ echo Checking for shared library support...
+ # we must test in two steps (cc then ld), required at least on SunOS 4.x
+- if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" &&
+- test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then
++ if ($CC -c $SFLAGS $test.c) 2>/dev/null &&
++ ($LDSHARED -o $test$shared_ext $test.o) 2>/dev/null; then
+ CFLAGS="$SFLAGS"
+ LIBS="$LIBS $SHAREDLIBV"
+ echo Building shared library $SHAREDLIBV with $CC.
+@@ -185,7 +185,7 @@
+ #include <unistd.h>
+ int main() { return 0; }
+ EOF
+-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ sed < zconf.in.h "/HAVE_UNISTD_H/s%0%1%" > zconf.h
+ echo "Checking for unistd.h... Yes."
+ else
+@@ -208,7 +208,7 @@
+ }
+ EOF
+
+-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()"
+
+ cat > $test.c <<EOF
+@@ -232,7 +232,7 @@
+ }
+ EOF
+
+- if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
++ if ($CC $CFLAGS -o $test $test.c) 2>/dev/null; then
+ echo "Checking for vsnprintf() in stdio.h... Yes."
+
+ cat >$test.c <<EOF
+@@ -257,7 +257,7 @@
+ }
+ EOF
+
+- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++ if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking for return value of vsnprintf()... Yes."
+ else
+ CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
+@@ -295,7 +295,7 @@
+ }
+ EOF
+
+- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++ if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking for return value of vsprintf()... Yes."
+ else
+ CFLAGS="$CFLAGS -DHAS_vsprintf_void"
+@@ -325,7 +325,7 @@
+ }
+ EOF
+
+- if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then
++ if ($CC $CFLAGS -o $test $test.c) 2>/dev/null; then
+ echo "Checking for snprintf() in stdio.h... Yes."
+
+ cat >$test.c <<EOF
+@@ -344,7 +344,7 @@
+ }
+ EOF
+
+- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++ if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking for return value of snprintf()... Yes."
+ else
+ CFLAGS="$CFLAGS -DHAS_snprintf_void"
+@@ -376,7 +376,7 @@
+ }
+ EOF
+
+- if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++ if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking for return value of sprintf()... Yes."
+ else
+ CFLAGS="$CFLAGS -DHAS_sprintf_void"
+@@ -392,7 +392,7 @@
+ #include <errno.h>
+ int main() { return 0; }
+ EOF
+-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ echo "Checking for errno.h... Yes."
+ else
+ echo "Checking for errno.h... No."
+@@ -407,7 +407,7 @@
+ return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0);
+ }
+ EOF
+-if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then
++if ($CC -c $CFLAGS $test.c) 2>/dev/null; then
+ CFLAGS="$CFLAGS -DUSE_MMAP"
+ echo Checking for mmap support... Yes.
+ else
diff --git a/sys-libs/zlib/files/zlib-1.2.1-fPIC.patch b/sys-libs/zlib/files/zlib-1.2.1-fPIC.patch
new file mode 100644
index 000000000000..5ccbddfd0fbe
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.1-fPIC.patch
@@ -0,0 +1,16 @@
+--- zlib-1.2.1/configure
++++ zlib-1.2.1/configure
+@@ -73,7 +73,12 @@
+
+ if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) 2>/dev/null; then
+ CC="$cc"
+- SFLAGS=${CFLAGS-"-fPIC -O3"}
++ #SFLAGS=${CFLAGS-"-fPIC -O3"}
++ # the above is horribly wrong on a few archs where -fPIC should ALWAYS be
++ # used in the creation of shared libraries. without the following, the
++ # shared lib test will sometimes fail even when shared libs -can- be created.
++ SFLAGS=${CFLAGS-"-O3"}
++ SFLAGS="${SFLAGS} -fPIC"
+ CFLAGS="$cflags"
+ case `(uname -s || echo unknown) 2>/dev/null` in
+ Linux | linux | GNU | GNU/*)
diff --git a/sys-libs/zlib/files/zlib-1.2.1-glibc.patch b/sys-libs/zlib/files/zlib-1.2.1-glibc.patch
new file mode 100644
index 000000000000..db5e0df9fb58
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.1-glibc.patch
@@ -0,0 +1,12 @@
+diff -urN zlib-1.2.1-old/Makefile.in zlib-1.2.1/Makefile.in
+--- zlib-1.2.1-old/Makefile.in 2003-11-08 18:29:23.000000000 -0800
++++ zlib-1.2.1/Makefile.in 2003-12-02 12:12:43.000000000 -0800
+@@ -78,7 +78,7 @@
+ rm -f _match.s
+
+ $(SHAREDLIBV): $(OBJS)
+- $(LDSHARED) -o $@ $(OBJS)
++ $(LDSHARED) -o $@ $(OBJS) -lc
+ rm -f $(SHAREDLIB) $(SHAREDLIBM)
+ ln -s $@ $(SHAREDLIB)
+ ln -s $@ $(SHAREDLIBM)
diff --git a/sys-libs/zlib/files/zlib-1.2.3-LDFLAGS.patch b/sys-libs/zlib/files/zlib-1.2.3-LDFLAGS.patch
new file mode 100644
index 000000000000..86da956eb5f4
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.3-LDFLAGS.patch
@@ -0,0 +1,31 @@
+--- zlib-1.2.3/Makefile.in
++++ zlib-1.2.3/Makefile.in
+@@ -24,7 +24,7 @@
+ #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
+ # -Wstrict-prototypes -Wmissing-prototypes
+
+-LDFLAGS=libz.a
++TEST_LDFLAGS=libz.a
+ LDSHARED=$(CC)
+ CPP=$(CC) -E
+
+@@ -83,16 +83,16 @@
+ $(CC) $(CFLAGS) -DPIC -fPIC -c $< -o $@
+
+ $(SHAREDLIBV): $(PIC_OBJS)
+- $(LDSHARED) -o $@ $(PIC_OBJS) -lc
++ $(LDSHARED) -o $@ $(PIC_OBJS) -lc $(LDFLAGS)
+ rm -f $(SHAREDLIB) $(SHAREDLIBM)
+ ln -s $@ $(SHAREDLIB)
+ ln -s $@ $(SHAREDLIBM)
+
+ example$(EXE): example.o $(LIBS)
+- $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
++ $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) $(TEST_LDFLAGS)
+
+ minigzip$(EXE): minigzip.o $(LIBS)
+- $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
++ $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) $(TEST_LDFLAGS)
+
+ install-libs: $(LIBS)
+ -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
diff --git a/sys-libs/zlib/files/zlib-1.2.3-build.patch b/sys-libs/zlib/files/zlib-1.2.3-build.patch
new file mode 100644
index 000000000000..10435b85fbd6
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.3-build.patch
@@ -0,0 +1,66 @@
+--- zlib-1.2.3/configure
++++ zlib-1.2.3/configure
+@@ -23,7 +23,7 @@
+ VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
+ VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
+ VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
+-AR=${AR-"ar rc"}
++AR=${AR-"ar"}
+ RANLIB=${RANLIB-"ranlib"}
+ prefix=${prefix-/usr/local}
+ exec_prefix=${exec_prefix-'${prefix}'}
+--- zlib-1.2.3/Makefile.in
++++ zlib-1.2.3/Makefile.in
+@@ -70,7 +70,7 @@
+ fi
+
+ libz.a: $(OBJS) $(OBJA)
+- $(AR) $@ $(OBJS) $(OBJA)
++ $(AR) rc $@ $(OBJS) $(OBJA)
+ -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
+
+ match.o: match.S
+--- zlib-1.2.3/win32/Makefile.gcc
++++ zlib-1.2.3/win32/Makefile.gcc
+@@ -30,21 +30,23 @@
+ #LOC = -DASMV
+ #LOC = -DDEBUG -g
+
+-CC = gcc
+-CFLAGS = $(LOC) -O3 -Wall
++CC ?= gcc
++CFLAGS ?= $(LOC) -O3 -Wall
+
+-AS = $(CC)
+-ASFLAGS = $(LOC) -Wall
++AS ?= $(CC)
++ASFLAGS ?= $(LOC) -Wall
+
+ LD = $(CC)
+-LDFLAGS = $(LOC) -s
++LDFLAGS ?= $(LOC) -s
+
+-AR = ar
++AR ?= ar
+ ARFLAGS = rcs
+
+-RC = windres
++RC ?= windres
+ RCFLAGS = --define GCC_WINDRES
+
++DLLWRAP ?= dllwrap
++
+ CP = cp -fp
+ # If GNU install is available, replace $(CP) with install.
+ INSTALL = $(CP)
+@@ -79,9 +81,8 @@
+ $(IMPLIB): $(SHAREDLIB)
+
+ $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
+- dllwrap --driver-name $(CC) --def win32/zlib.def \
++ $(DLLWRAP) --driver-name $(CC) --def win32/zlib.def \
+ --implib $(IMPLIB) -o $@ $(OBJS) $(OBJA) zlibrc.o
+- strip $@
+
+ example: example.o $(STATICLIB)
+ $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
diff --git a/sys-libs/zlib/files/zlib-1.2.3-mingw-implib.patch b/sys-libs/zlib/files/zlib-1.2.3-mingw-implib.patch
new file mode 100644
index 000000000000..9726237d56d0
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.3-mingw-implib.patch
@@ -0,0 +1,13 @@
+http://bugs.gentoo.org/288212
+
+--- zlib-1.2.3/win32/Makefile.gcc
++++ zlib-1.2.3/win32/Makefile.gcc
+@@ -25,7 +25,7 @@
+
+ STATICLIB = libz.a
+ SHAREDLIB = zlib1.dll
+-IMPLIB = libzdll.a
++IMPLIB = libz.dll.a
+
+ #LOC = -DASMV
+ #LOC = -DDEBUG -g
diff --git a/sys-libs/zlib/files/zlib-1.2.3-r1-bsd-soname.patch b/sys-libs/zlib/files/zlib-1.2.3-r1-bsd-soname.patch
new file mode 100644
index 000000000000..872070b03027
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.3-r1-bsd-soname.patch
@@ -0,0 +1,15 @@
+Generate a DT_SONAME on *BSD machines
+
+http://bugs.gentoo.org/123571
+
+--- configure
++++ configure
+@@ -80,7 +80,7 @@
+ SFLAGS="${CFLAGS-"-O3"} -fPIC"
+ CFLAGS="$cflags"
+ case `(uname -s || echo unknown) 2>/dev/null` in
+- Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
++ Linux | linux | GNU | GNU/* | *BSD | DragonFly) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};;
+ CYGWIN* | Cygwin* | cygwin* | OS/2* )
+ EXE='.exe';;
+ QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4
diff --git a/sys-libs/zlib/files/zlib-1.2.3-visibility-support.patch b/sys-libs/zlib/files/zlib-1.2.3-visibility-support.patch
new file mode 100644
index 000000000000..ceb065e9c7bb
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.3-visibility-support.patch
@@ -0,0 +1,45 @@
+Only export symbols that should be exported.
+
+Patch by Mike Frysinger
+
+http://bugs.gentoo.org/32764
+http://bugs.gentoo.org/149929
+
+--- zlib-1.2.3/configure
++++ zlib-1.2.3/configure
+@@ -209,6 +209,20 @@
+ fi
+
+ cat > $test.c <<EOF
++int foo __attribute__ ((visibility ("hidden")));
++int main()
++{
++ return 0;
++}
++EOF
++if ($CC -c -fvisibility=hidden $CFLAGS $test.c) 2>/dev/null; then
++ CFLAGS="$CFLAGS -DHAS_attribute_visibility -fvisibility=hidden"
++ echo "Checking for attribute(visibility) support... Yes."
++else
++ echo "Checking for attribute(visibility) support... No."
++fi
++
++cat > $test.c <<EOF
+ #include <stdio.h>
+ #include <stdarg.h>
+ #include "zconf.h"
+--- zlib-1.2.3/zconf.in.h
++++ zlib-1.2.3/zconf.in.h
+@@ -244,7 +244,11 @@
+ #endif
+
+ #ifndef ZEXTERN
+-# define ZEXTERN extern
++# if defined(ZLIB_INTERNAL) && defined(HAS_attribute_visibility)
++# define ZEXTERN extern __attribute__ ((visibility("default")))
++# else
++# define ZEXTERN extern
++# endif
+ #endif
+ #ifndef ZEXPORT
+ # define ZEXPORT
diff --git a/sys-libs/zlib/files/zlib-1.2.4-minizip-autotools.patch b/sys-libs/zlib/files/zlib-1.2.4-minizip-autotools.patch
new file mode 100644
index 000000000000..81a62f0b1d18
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.4-minizip-autotools.patch
@@ -0,0 +1,64 @@
+sniped & improved from Fedora
+
+--- zlib-1.2.4/contrib/minizip/configure.ac
++++ zlib-1.2.4/contrib/minizip/configure.ac
+@@ -0,0 +1,12 @@
++# -*- Autoconf -*-
++# Process this file with autoconf to produce a configure script.
++
++AC_INIT([minizip], [@ZLIB_VER@], [bugzilla.redhat.com])
++AC_CONFIG_SRCDIR([minigzip.c])
++AM_INIT_AUTOMAKE([foreign])
++LT_INIT
++
++AC_SUBST([HAVE_UNISTD_H], [0])
++AC_CHECK_HEADER([unistd.h], [HAVE_UNISTD_H=1], [])
++AC_CONFIG_FILES([Makefile minizip.pc])
++AC_OUTPUT
+--- zlib-1.2.4/contrib/minizip/Makefile.am
++++ zlib-1.2.4/contrib/minizip/Makefile.am
+@@ -0,0 +1,28 @@
++lib_LTLIBRARIES = libminizip.la
++
++libminizip_la_SOURCES = \
++ ioapi.c \
++ mztools.c \
++ unzip.c \
++ zip.c
++
++libminizip_la_CFLAGS = -I../.. -L../..
++libminizip_la_LDFLAGS = -version-info 1:0:0 -lz
++
++minizip_includedir = $(includedir)/minizip
++minizip_include_HEADERS = \
++ crypt.h \
++ ioapi.h \
++ mztools.h \
++ unzip.h \
++ zip.h
++
++pkgconfigdir = $(libdir)/pkgconfig
++pkgconfig_DATA = minizip.pc
++
++EXTRA_PROGRAMS = miniunzip minizip
++
++miniunzip_SOURCES = miniunz.c
++miniunzip_LDADD = libminizip.la
++
++minizip_SOURCES = minizip.c
++minizip_LDADD = libminizip.la
+--- zlib-1.2.4/contrib/minizip/minizip.pc.in
++++ zlib-1.2.4/contrib/minizip/minizip.pc.in
+@@ -0,0 +1,12 @@
++prefix=@prefix@
++exec_prefix=@exec_prefix@
++libdir=@libdir@
++includedir=@includedir@/minizip
++
++Name: minizip
++Description: Minizip zip file manipulation library
++Requires:
++Version: @PACKAGE_VERSION@
++Libs: -L${libdir} -lminizip
++Libs.private: -lz
++Cflags: -I${includedir}
diff --git a/sys-libs/zlib/files/zlib-1.2.5-fbsd_chosts.patch b/sys-libs/zlib/files/zlib-1.2.5-fbsd_chosts.patch
new file mode 100644
index 000000000000..9b1f8331029d
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.5-fbsd_chosts.patch
@@ -0,0 +1,15 @@
+accept freebsd targets
+
+http://bugs.gentoo.org/316841
+
+--- zlib-1.2.5/configure
++++ zlib-1.2.5/configure
+@@ -118,7 +118,7 @@
+ uname=`(uname -s || echo unknown) 2>/dev/null`
+ fi
+ case "$uname" in
+- Linux* | linux* | GNU | GNU/* | *BSD | DragonFly) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
++ Linux* | linux* | GNU | GNU/* | *BSD | DragonFly | freebsd* ) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
+ CYGWIN* | Cygwin* | cygwin* | OS/2*)
+ EXE='.exe' ;;
+ MINGW*|mingw*)
diff --git a/sys-libs/zlib/files/zlib-1.2.5-ldflags.patch b/sys-libs/zlib/files/zlib-1.2.5-ldflags.patch
new file mode 100644
index 000000000000..dff534b457c3
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.5-ldflags.patch
@@ -0,0 +1,22 @@
+http://bugs.gentoo.org/319661
+
+LDFLAGS is only used with the shared lib, so dont link against the static zlib
+
+--- a/configure
++++ b/configure
+@@ -19,7 +19,6 @@
+ fi
+
+ STATICLIB=libz.a
+-LDFLAGS="${LDFLAGS} -L. ${STATICLIB}"
+ VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`
+ VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h`
+ VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h`
+@@ -174,7 +173,6 @@
+ LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;;
+ OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"}
+ CFLAGS=${CFLAGS-"-O -std1"}
+- LDFLAGS="${LDFLAGS} -Wl,-rpath,."
+ LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;;
+ OSF1*) SFLAGS=${CFLAGS-"-O -std1"}
+ CFLAGS=${CFLAGS-"-O -std1"}
diff --git a/sys-libs/zlib/files/zlib-1.2.5-lfs-decls.patch b/sys-libs/zlib/files/zlib-1.2.5-lfs-decls.patch
new file mode 100644
index 000000000000..8d7343084059
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.5-lfs-decls.patch
@@ -0,0 +1,15 @@
+http://bugs.gentoo.org/316377
+
+try to unbreak over-eager LFS logic in zlib header
+
+--- zlib-1.2.5/zlib.h
++++ zlib-1.2.5/zlib.h
+@@ -1578,7 +1578,7 @@
+ # 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/sys-libs/zlib/files/zlib-1.2.5.1-symlinks.patch b/sys-libs/zlib/files/zlib-1.2.5.1-symlinks.patch
new file mode 100644
index 000000000000..e747b01135a5
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.5.1-symlinks.patch
@@ -0,0 +1,33 @@
+From e41d99c135935b849e1e639632937829ff2000d8 Mon Sep 17 00:00:00 2001
+From: Mike Frysinger <vapier@gentoo.org>
+Date: Sun, 11 Sep 2011 14:32:53 -0400
+Subject: [PATCH] use relative symlinks for shared libs
+
+The DESTDIR should not be encoded into symlinks as it is only a
+temporary path. Further, since we install the symlinks into the
+same dir as the files, let's use relative links so that they can
+always resolve.
+
+Signed-off-by: Mike Frysinger <vapier@gentoo.org>
+---
+ Makefile.in | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Makefile.in b/Makefile.in
+index 861970d..299bd1d 100644
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -176,8 +176,8 @@ install-libs: $(LIBS)
+ chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
+ echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
+ rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
+- ln -s $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
+- ln -s $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
++ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
++ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
+ ($(LDCONFIG) || true) >/dev/null 2>&1; \
+ fi
+ cp zlib.3 $(DESTDIR)$(man3dir)
+--
+1.7.6
+
diff --git a/sys-libs/zlib/files/zlib-1.2.5.1-version.patch b/sys-libs/zlib/files/zlib-1.2.5.1-version.patch
new file mode 100644
index 000000000000..afaa1f050518
--- /dev/null
+++ b/sys-libs/zlib/files/zlib-1.2.5.1-version.patch
@@ -0,0 +1,22 @@
+From 70386acb30b690fc9fcfdac9e01c8ca29ff20ef5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?T=C3=B6r=C3=B6k=20Edwin?= <edwintorok@gmail.com>
+Date: Sun, 11 Sep 2011 10:00:52 +0300
+Subject: [PATCH] fix ld error: unable to find version dependency `ZLIB_1.2.5'
+
+---
+ zlib.map | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/zlib.map b/zlib.map
+index 65bcf17..f65a125 100644
+--- a/zlib.map
++++ b/zlib.map
+@@ -69,4 +69,4 @@ ZLIB_1.2.3.5 {
+
+ ZLIB_1.2.5.1 {
+ deflatePending;
+-} ZLIB_1.2.5;
++} ZLIB_1.2.3.5;
+--
+1.7.5.4
+