Project import
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..367aa04
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,104 @@
+#
+# Copyright (c) 2010-2012 Nest Labs, Inc.
+# All rights reserved.
+#
+# This document is the property of Nest. It is considered
+# confidential and proprietary information.
+#
+# This document may not be reproduced or transmitted in any form,
+# in whole or in part, without the express written permission of
+# Nest.
+#
+# Description:
+# This file is the makefile for the zlib compression library.
+#
+
+
+include pre.mak
+
+PackageName := zlib
+
+PackageExtension := tar.bz2
+PackageSeparator := -
+
+PackagePatchArgs :=
+
+PackageArchive := $(PackageName).$(PackageExtension)
+PackageSourceDir := $(PackageName)$(PackageSeparator)$(PackageVersion)
+
+PackageResultPath = $(call GenerateResultPaths,,usr)
+
+CleanPaths += $(PackageLicenseFile)
+
+SOURCEDIRS = $(PackageSourceDir)
+$(PackageSourceDir)_RULE_TARGET = $(BuildDirectory)/configure
+
+all: $(PackageDefaultGoal)
+
+# Generate the package license contents.
+
+$(PackageSourceDir)/zlib.h: $(BuildDirectory)/source
+
+$(PackageLicenseFile): $(PackageSourceDir)/zlib.h
+ $(Verbose)$(SED) -n -e '/^\/\* zlib\.h/,/\*\/$$/{;p;/\*\/$$/q;}' < $< > $@
+
+# Extract the source from the archive and apply patches, if any.
+
+$(PackageSourceDir): $(PackageArchive) $(PackagePatchPaths)
+ $(expand-and-patch-package)
+
+# Prepare the sources.
+
+$(BuildDirectory)/source: | $(PackageSourceDir) $(BuildDirectory)
+ $(Verbose)touch $@
+
+# Patch the sources, if necessary.
+
+$(BuildDirectory)/patch: $(BuildDirectory)/source
+ $(Verbose)touch $@
+
+# Configure the source for building.
+
+$(BuildDirectory)/configure: $(BuildDirectory)/source | $(PackageSourceDir) $(BuildDirectory)
+ $(Verbose)cd $(BuildDirectory) && \
+ CC="$(CC) $(CPPOPTFLAGS)" AR=$(AR) NM=$(NM) RANLIB=$(RANLIB) \
+ INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+ CFLAGS="$(call ToolGenerateIncludeArgument,$(LinuxIncludePath))" \
+ $(CURDIR)/$(PackageSourceDir)/configure \
+ $(ZlibTargetConfigOptions) \
+ --prefix=$(PackageResultPath) \
+ --shared
+ $(Verbose)touch $@
+
+# Build the source.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/build: $(BuildDirectory)/configure
+ $(Verbose)unset MAKEFLAGS && \
+ $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+ prefix=$(PackageResultPath) \
+ all
+ $(Verbose)touch $@
+
+# Stage the build to a temporary installation area.
+#
+# We have to unset MAKEFLAGS since they confuse the package build otherwise.
+
+$(BuildDirectory)/stage: $(BuildDirectory)/build | $(ResultDirectory)
+ $(Verbose)unset MAKEFLAGS && \
+ $(MAKE) $(JOBSFLAG) -C $(BuildDirectory) \
+ INSTALL="$(INSTALL) $(INSTALLFLAGS)" \
+ prefix=$(PackageResultPath) \
+ install
+ $(Verbose)touch $@
+
+.PHONY: stage
+stage: $(BuildDirectory)/stage
+
+clean:
+ $(Verbose)$(RM) $(RMFLAGS) -r $(PackageSourceDir)
+ $(Verbose)$(RM) $(RMFLAGS) -r $(BuildDirectory)
+ $(Verbose)$(RM) $(RMFLAGS) -r $(ResultDirectory)
+
+include post.mak
diff --git a/zlib.patches/zlib-50.description b/zlib.patches/zlib-50.description
new file mode 100644
index 0000000..92da47b
--- /dev/null
+++ b/zlib.patches/zlib-50.description
@@ -0,0 +1 @@
+Patch to allow building zlib with non-colocated source and object trees.
diff --git a/zlib.patches/zlib-50.patch b/zlib.patches/zlib-50.patch
new file mode 100644
index 0000000..9ef56b0
--- /dev/null
+++ b/zlib.patches/zlib-50.patch
@@ -0,0 +1,687 @@
+diff -aruN a/configure b/configure
+--- a/configure 2012-01-29 09:48:11.000000000 -0800
++++ b/configure 2012-02-08 12:53:27.214832230 -0800
+@@ -13,9 +13,15 @@
+ # If you have problems, try without defining CC and CFLAGS before reporting
+ # an error.
+
+-echo -------------------- >> configure.log
+-echo $0 $* >> configure.log
+-date >> configure.log
++confdir=`dirname "$0"`
++srcdir=$confdir
++builddir=`pwd`
++
++LOG="$builddir/configure.log"
++
++echo -------------------- >> ${LOG}
++echo $0 $* >> ${LOG}
++date >> ${LOG}
+
+ if [ -n "${CHOST}" ]; then
+ uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`"
+@@ -23,27 +29,27 @@
+ fi
+
+ STATICLIB=libz.a
+-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`
+-VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h`
++VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < $srcdir/zlib.h`
++VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < $srcdir/zlib.h`
++VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < $srcdir/zlib.h`
++VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < $srcdir/zlib.h`
+ if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then
+ AR=${AR-"${CROSS_PREFIX}ar"}
+- test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
++ test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a ${LOG}
+ else
+ AR=${AR-"ar"}
+- test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log
++ test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a ${LOG}
+ fi
+ ARFLAGS=${ARFLAGS-"rc"}
+ if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then
+ RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"}
+- test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log
++ test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a ${LOG}
+ else
+ RANLIB=${RANLIB-"ranlib"}
+ fi
+ if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then
+ NM=${NM-"${CROSS_PREFIX}nm"}
+- test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log
++ test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a ${LOG}
+ else
+ NM=${NM-"nm"}
+ fi
+@@ -72,10 +78,10 @@
+ do
+ case "$1" in
+ -h* | --help)
+- echo 'usage:' | tee -a configure.log
+- echo ' configure [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
+- echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
+- echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
++ echo 'usage:' | tee -a ${LOG}
++ echo ' configure [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a ${LOG}
++ echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a ${LOG}
++ echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a ${LOG}
+ exit 0 ;;
+ -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
+ -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
+@@ -94,9 +100,9 @@
+ -z* | --zprefix) zprefix=1; shift ;;
+ -6* | --64) build64=1; shift ;;
+ -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;;
+- --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;;
+- --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;;
+- *) echo "unknown option: $1"; echo "$0 --help for help" | tee -a configure.log; exit 1 ;;
++ --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a ${LOG}; shift ;;
++ --localstatedir=*) echo "ignored option: --localstatedir" | tee -a ${LOG}; shift ;;
++ *) echo "unknown option: $1"; echo "$0 --help for help" | tee -a ${LOG}; exit 1 ;;
+ esac
+ done
+
+@@ -106,11 +112,11 @@
+ {
+ case "$*" in
+ *$test.c*)
+- echo === $test.c === >> configure.log
+- cat $test.c >> configure.log
+- echo === >> configure.log;;
++ echo === $test.c === >> ${LOG}
++ cat $test.c >> ${LOG}
++ echo === >> ${LOG};;
+ esac
+- echo $* >> configure.log
++ echo $* >> ${LOG}
+ }
+
+ cat > $test.c <<EOF
+@@ -120,30 +126,30 @@
+ try()
+ {
+ show $*
+- test "`( $* ) 2>&1 | tee -a configure.log`" = ""
++ test "`( $* ) 2>&1 | tee -a ${LOG}`" = ""
+ }
+- echo - using any output from compiler to indicate an error >> configure.log
++ echo - using any output from compiler to indicate an error >> ${LOG}
+ else
+ try()
+ {
+ show $*
+- ( $* ) >> configure.log 2>&1
++ ( $* ) >> ${LOG} 2>&1
+ ret=$?
+ if test $ret -ne 0; then
+- echo "(exit code "$ret")" >> configure.log
++ echo "(exit code "$ret")" >> ${LOG}
+ fi
+ return $ret
+ }
+ fi
+
+-echo >> configure.log
++echo >> ${LOG}
+
+ cat > $test.c <<EOF
+ extern int getchar();
+ int hello() {return getchar();}
+ EOF
+
+-test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a configure.log
++test -z "$CC" && echo Checking for ${CROSS_PREFIX}gcc... | tee -a ${LOG}
+ cc=${CC-${CROSS_PREFIX}gcc}
+ cflags=${CFLAGS-"-O3"}
+ # to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
+@@ -155,8 +161,8 @@
+ esac
+
+ show $cc -c $cflags $test.c
+-if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) >> configure.log 2>&1; then
+- echo ... using gcc >> configure.log
++if test "$gcc" -eq 1 && ($cc -c $cflags $test.c) >> ${LOG} 2>&1; then
++ echo ... using gcc >> ${LOG}
+ CC="$cc"
+ CFLAGS="${CFLAGS--O3} ${ARCHS}"
+ SFLAGS="${CFLAGS--O3} -fPIC"
+@@ -173,16 +179,16 @@
+ fi
+ case "$uname" in
+ Linux* | linux* | GNU | GNU/* | solaris*)
+- LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;;
++ LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,$srcdir/zlib.map"} ;;
+ *BSD | *bsd* | DragonFly)
+- LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"}
++ LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,$srcdir/zlib.map"}
+ LDCONFIG="ldconfig -m" ;;
+ CYGWIN* | Cygwin* | cygwin* | OS/2*)
+ EXE='.exe' ;;
+ MINGW* | mingw*)
+ # temporary bypass
+ rm -f $test.[co] $test $test$shared_ext
+- echo "Please use win32/Makefile.gcc instead." | tee -a configure.log
++ echo "Please use win32/Makefile.gcc instead." | tee -a ${LOG}
+ exit 1
+ LDSHARED=${LDSHARED-"$cc -shared"}
+ LDSHAREDLIBC=""
+@@ -214,7 +220,7 @@
+ # find system name and corresponding cc options
+ CC=${CC-cc}
+ gcc=0
+- echo ... using $CC >> configure.log
++ echo ... using $CC >> ${LOG}
+ if test -z "$uname"; then
+ uname=`(uname -sr || echo unknown) 2>/dev/null`
+ fi
+@@ -293,19 +299,19 @@
+ SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"}
+ SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"}
+
+-echo >> configure.log
++echo >> ${LOG}
+
+ if test $shared -eq 1; then
+- echo Checking for shared library support... | tee -a configure.log
++ echo Checking for shared library support... | tee -a ${LOG}
+ # we must test in two steps (cc then ld), required at least on SunOS 4.x
+ if try $CC -w -c $SFLAGS $test.c &&
+ try $LDSHARED $SFLAGS -o $test$shared_ext $test.o; then
+- echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
++ echo Building shared library $SHAREDLIBV with $CC. | tee -a ${LOG}
+ elif test -z "$old_cc" -a -z "$old_cflags"; then
+- echo No shared library support. | tee -a configure.log
++ echo No shared library support. | tee -a ${LOG}
+ shared=0;
+ else
+- echo 'No shared library support; try without defining CC and CFLAGS' | tee -a configure.log
++ echo 'No shared library support; try without defining CC and CFLAGS' | tee -a ${LOG}
+ shared=0;
+ fi
+ fi
+@@ -316,7 +322,7 @@
+ SHAREDLIB=""
+ SHAREDLIBV=""
+ SHAREDLIBM=""
+- echo Building static library $STATICLIB version $VER with $CC. | tee -a configure.log
++ echo Building static library $STATICLIB version $VER with $CC. | tee -a ${LOG}
+ else
+ ALL="static shared"
+ TEST="all teststatic testshared"
+@@ -325,17 +331,17 @@
+ CPP=${CPP-"$CC -E"}
+ case $CFLAGS in
+ *ASMV*)
+- echo >> configure.log
++ echo >> ${LOG}
+ show "$NM $test.o | grep _hello"
+- if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then
++ if test "`$NM $test.o | grep _hello | tee -a ${LOG}`" = ""; then
+ CPP="$CPP -DNO_UNDERLINE"
+- echo Checking for underline in external names... No. | tee -a configure.log
++ echo Checking for underline in external names... No. | tee -a ${LOG}
+ else
+- echo Checking for underline in external names... Yes. | tee -a configure.log
++ echo Checking for underline in external names... Yes. | tee -a ${LOG}
+ fi ;;
+ esac
+
+-echo >> configure.log
++echo >> ${LOG}
+
+ cat > $test.c <<EOF
+ #include <sys/types.h>
+@@ -346,11 +352,11 @@
+ SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1"
+ ALL="${ALL} all64"
+ TEST="${TEST} test64"
+- echo "Checking for off64_t... Yes." | tee -a configure.log
+- echo "Checking for fseeko... Yes." | tee -a configure.log
++ echo "Checking for off64_t... Yes." | tee -a ${LOG}
++ echo "Checking for fseeko... Yes." | tee -a ${LOG}
+ else
+- echo "Checking for off64_t... No." | tee -a configure.log
+- echo >> configure.log
++ echo "Checking for off64_t... No." | tee -a ${LOG}
++ echo >> ${LOG}
+ cat > $test.c <<EOF
+ #include <stdio.h>
+ int main(void) {
+@@ -359,17 +365,17 @@
+ }
+ EOF
+ if try $CC $CFLAGS -o $test $test.c; then
+- echo "Checking for fseeko... Yes." | tee -a configure.log
++ echo "Checking for fseeko... Yes." | tee -a ${LOG}
+ else
+ CFLAGS="${CFLAGS} -DNO_FSEEKO"
+ SFLAGS="${SFLAGS} -DNO_FSEEKO"
+- echo "Checking for fseeko... No." | tee -a configure.log
++ echo "Checking for fseeko... No." | tee -a ${LOG}
+ fi
+ fi
+
+-cp -p zconf.h.in zconf.h
++cp -p $srcdir/zconf.h.in zconf.h
+
+-echo >> configure.log
++echo >> ${LOG}
+
+ cat > $test.c <<EOF
+ #include <unistd.h>
+@@ -378,12 +384,12 @@
+ if try $CC -c $CFLAGS $test.c; then
+ sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
+ mv zconf.temp.h zconf.h
+- echo "Checking for unistd.h... Yes." | tee -a configure.log
++ echo "Checking for unistd.h... Yes." | tee -a ${LOG}
+ else
+- echo "Checking for unistd.h... No." | tee -a configure.log
++ echo "Checking for unistd.h... No." | tee -a ${LOG}
+ fi
+
+-echo >> configure.log
++echo >> ${LOG}
+
+ cat > $test.c <<EOF
+ #include <stdarg.h>
+@@ -392,16 +398,16 @@
+ if try $CC -c $CFLAGS $test.c; then
+ sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h
+ mv zconf.temp.h zconf.h
+- echo "Checking for stdarg.h... Yes." | tee -a configure.log
++ echo "Checking for stdarg.h... Yes." | tee -a ${LOG}
+ else
+- echo "Checking for stdarg.h... No." | tee -a configure.log
++ echo "Checking for stdarg.h... No." | tee -a ${LOG}
+ fi
+
+ if test $zprefix -eq 1; then
+ sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h
+ mv zconf.temp.h zconf.h
+- echo >> configure.log
+- echo "Using z_ prefix on all symbols." | tee -a configure.log
++ echo >> ${LOG}
++ echo "Using z_ prefix on all symbols." | tee -a ${LOG}
+ fi
+
+ if test $solo -eq 1; then
+@@ -418,7 +424,7 @@
+ CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
+ fi
+
+-echo >> configure.log
++echo >> ${LOG}
+
+ cat > $test.c <<EOF
+ #include <stdio.h>
+@@ -434,9 +440,9 @@
+ EOF
+
+ if try $CC -c $CFLAGS $test.c; then
+- echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log
++ echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a ${LOG}
+
+- echo >> configure.log
++ echo >> ${LOG}
+ cat > $test.c <<EOF
+ #include <stdio.h>
+ #include <stdarg.h>
+@@ -455,9 +461,9 @@
+ }
+ EOF
+ if try $CC $CFLAGS -o $test $test.c; then
+- echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log
++ echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a ${LOG}
+
+- echo >> configure.log
++ echo >> ${LOG}
+ cat >$test.c <<EOF
+ #include <stdio.h>
+ #include <stdarg.h>
+@@ -478,24 +484,24 @@
+ EOF
+
+ if try $CC -c $CFLAGS $test.c; then
+- echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log
++ echo "Checking for return value of vsnprintf()... Yes." | tee -a ${LOG}
+ else
+ CFLAGS="$CFLAGS -DHAS_vsnprintf_void"
+ SFLAGS="$SFLAGS -DHAS_vsnprintf_void"
+- echo "Checking for return value of vsnprintf()... No." | tee -a configure.log
+- echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log
+- echo " can build but will be open to possible string-format security" | tee -a configure.log
+- echo " vulnerabilities." | tee -a configure.log
++ echo "Checking for return value of vsnprintf()... No." | tee -a ${LOG}
++ echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a ${LOG}
++ echo " can build but will be open to possible string-format security" | tee -a ${LOG}
++ echo " vulnerabilities." | tee -a ${LOG}
+ fi
+ else
+ CFLAGS="$CFLAGS -DNO_vsnprintf"
+ SFLAGS="$SFLAGS -DNO_vsnprintf"
+- echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log
+- echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log
+- echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
+- echo " vulnerabilities." | tee -a configure.log
++ echo "Checking for vsnprintf() in stdio.h... No." | tee -a ${LOG}
++ echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a ${LOG}
++ echo " can build but will be open to possible buffer-overflow security" | tee -a ${LOG}
++ echo " vulnerabilities." | tee -a ${LOG}
+
+- echo >> configure.log
++ echo >> ${LOG}
+ cat >$test.c <<EOF
+ #include <stdio.h>
+ #include <stdarg.h>
+@@ -516,20 +522,20 @@
+ EOF
+
+ if try $CC -c $CFLAGS $test.c; then
+- echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log
++ echo "Checking for return value of vsprintf()... Yes." | tee -a ${LOG}
+ else
+ CFLAGS="$CFLAGS -DHAS_vsprintf_void"
+ SFLAGS="$SFLAGS -DHAS_vsprintf_void"
+- echo "Checking for return value of vsprintf()... No." | tee -a configure.log
+- echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log
+- echo " can build but will be open to possible string-format security" | tee -a configure.log
+- echo " vulnerabilities." | tee -a configure.log
++ echo "Checking for return value of vsprintf()... No." | tee -a ${LOG}
++ echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a ${LOG}
++ echo " can build but will be open to possible string-format security" | tee -a ${LOG}
++ echo " vulnerabilities." | tee -a ${LOG}
+ fi
+ fi
+ else
+- echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log
++ echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a ${LOG}
+
+- echo >> configure.log
++ echo >> ${LOG}
+ cat >$test.c <<EOF
+ #include <stdio.h>
+ int mytest()
+@@ -545,9 +551,9 @@
+ EOF
+
+ if try $CC $CFLAGS -o $test $test.c; then
+- echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log
++ echo "Checking for snprintf() in stdio.h... Yes." | tee -a ${LOG}
+
+- echo >> configure.log
++ echo >> ${LOG}
+ cat >$test.c <<EOF
+ #include <stdio.h>
+ int mytest()
+@@ -562,24 +568,24 @@
+ EOF
+
+ if try $CC -c $CFLAGS $test.c; then
+- echo "Checking for return value of snprintf()... Yes." | tee -a configure.log
++ echo "Checking for return value of snprintf()... Yes." | tee -a ${LOG}
+ else
+ CFLAGS="$CFLAGS -DHAS_snprintf_void"
+ SFLAGS="$SFLAGS -DHAS_snprintf_void"
+- echo "Checking for return value of snprintf()... No." | tee -a configure.log
+- echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log
+- echo " can build but will be open to possible string-format security" | tee -a configure.log
+- echo " vulnerabilities." | tee -a configure.log
++ echo "Checking for return value of snprintf()... No." | tee -a ${LOG}
++ echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a ${LOG}
++ echo " can build but will be open to possible string-format security" | tee -a ${LOG}
++ echo " vulnerabilities." | tee -a ${LOG}
+ fi
+ else
+ CFLAGS="$CFLAGS -DNO_snprintf"
+ SFLAGS="$SFLAGS -DNO_snprintf"
+- echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log
+- echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log
+- echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log
+- echo " vulnerabilities." | tee -a configure.log
++ echo "Checking for snprintf() in stdio.h... No." | tee -a ${LOG}
++ echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a ${LOG}
++ echo " can build but will be open to possible buffer-overflow security" | tee -a ${LOG}
++ echo " vulnerabilities." | tee -a ${LOG}
+
+- echo >> configure.log
++ echo >> ${LOG}
+ cat >$test.c <<EOF
+ #include <stdio.h>
+ int mytest()
+@@ -594,20 +600,20 @@
+ EOF
+
+ if try $CC -c $CFLAGS $test.c; then
+- echo "Checking for return value of sprintf()... Yes." | tee -a configure.log
++ echo "Checking for return value of sprintf()... Yes." | tee -a ${LOG}
+ else
+ CFLAGS="$CFLAGS -DHAS_sprintf_void"
+ SFLAGS="$SFLAGS -DHAS_sprintf_void"
+- echo "Checking for return value of sprintf()... No." | tee -a configure.log
+- echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log
+- echo " can build but will be open to possible string-format security" | tee -a configure.log
+- echo " vulnerabilities." | tee -a configure.log
++ echo "Checking for return value of sprintf()... No." | tee -a ${LOG}
++ echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a ${LOG}
++ echo " can build but will be open to possible string-format security" | tee -a ${LOG}
++ echo " vulnerabilities." | tee -a ${LOG}
+ fi
+ fi
+ fi
+
+ if test "$gcc" -eq 1; then
+- echo >> configure.log
++ echo >> ${LOG}
+ cat > $test.c <<EOF
+ #if ((__GNUC__-0) * 10 + __GNUC_MINOR__-0 >= 33)
+ # define ZLIB_INTERNAL __attribute__((visibility ("hidden")))
+@@ -621,52 +627,52 @@
+ }
+ EOF
+ if try $CC -c $CFLAGS $test.c; then
+- echo "Checking for attribute(visibility) support... Yes." | tee -a configure.log
++ echo "Checking for attribute(visibility) support... Yes." | tee -a ${LOG}
+ else
+ CFLAGS="$CFLAGS -DNO_VIZ"
+ SFLAGS="$SFLAGS -DNO_VIZ"
+- echo "Checking for attribute(visibility) support... No." | tee -a configure.log
++ echo "Checking for attribute(visibility) support... No." | tee -a ${LOG}
+ fi
+ fi
+
+ rm -f $test.[co] $test $test$shared_ext $test.gcno
+
+ # show the results in the log
+-echo >> configure.log
+-echo ALL = $ALL >> configure.log
+-echo AR = $AR >> configure.log
+-echo ARFLAGS = $ARFLAGS >> configure.log
+-echo CC = $CC >> configure.log
+-echo CFLAGS = $CFLAGS >> configure.log
+-echo CPP = $CPP >> configure.log
+-echo EXE = $EXE >> configure.log
+-echo LDCONFIG = $LDCONFIG >> configure.log
+-echo LDFLAGS = $LDFLAGS >> configure.log
+-echo LDSHARED = $LDSHARED >> configure.log
+-echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log
+-echo OBJC = $OBJC >> configure.log
+-echo PIC_OBJC = $PIC_OBJC >> configure.log
+-echo RANLIB = $RANLIB >> configure.log
+-echo SFLAGS = $SFLAGS >> configure.log
+-echo SHAREDLIB = $SHAREDLIB >> configure.log
+-echo SHAREDLIBM = $SHAREDLIBM >> configure.log
+-echo SHAREDLIBV = $SHAREDLIBV >> configure.log
+-echo STATICLIB = $STATICLIB >> configure.log
+-echo TEST = $TEST >> configure.log
+-echo VER = $VER >> configure.log
+-echo exec_prefix = $exec_prefix >> configure.log
+-echo includedir = $includedir >> configure.log
+-echo libdir = $libdir >> configure.log
+-echo mandir = $mandir >> configure.log
+-echo prefix = $prefix >> configure.log
+-echo sharedlibdir = $sharedlibdir >> configure.log
+-echo uname = $uname >> configure.log
+-echo -------------------- >> configure.log
+-echo >> configure.log
+-echo >> configure.log
++echo >> ${LOG}
++echo ALL = $ALL >> ${LOG}
++echo AR = $AR >> ${LOG}
++echo ARFLAGS = $ARFLAGS >> ${LOG}
++echo CC = $CC >> ${LOG}
++echo CFLAGS = $CFLAGS >> ${LOG}
++echo CPP = $CPP >> ${LOG}
++echo EXE = $EXE >> ${LOG}
++echo LDCONFIG = $LDCONFIG >> ${LOG}
++echo LDFLAGS = $LDFLAGS >> ${LOG}
++echo LDSHARED = $LDSHARED >> ${LOG}
++echo LDSHAREDLIBC = $LDSHAREDLIBC >> ${LOG}
++echo OBJC = $OBJC >> ${LOG}
++echo PIC_OBJC = $PIC_OBJC >> ${LOG}
++echo RANLIB = $RANLIB >> ${LOG}
++echo SFLAGS = $SFLAGS >> ${LOG}
++echo SHAREDLIB = $SHAREDLIB >> ${LOG}
++echo SHAREDLIBM = $SHAREDLIBM >> ${LOG}
++echo SHAREDLIBV = $SHAREDLIBV >> ${LOG}
++echo STATICLIB = $STATICLIB >> ${LOG}
++echo TEST = $TEST >> ${LOG}
++echo VER = $VER >> ${LOG}
++echo exec_prefix = $exec_prefix >> ${LOG}
++echo includedir = $includedir >> ${LOG}
++echo libdir = $libdir >> ${LOG}
++echo mandir = $mandir >> ${LOG}
++echo prefix = $prefix >> ${LOG}
++echo sharedlibdir = $sharedlibdir >> ${LOG}
++echo uname = $uname >> ${LOG}
++echo -------------------- >> ${LOG}
++echo >> ${LOG}
++echo >> ${LOG}
+
+ # udpate Makefile
+-sed < Makefile.in "
++sed < $srcdir/Makefile.in "
+ /^CC *=/s#=.*#=$CC#
+ /^CFLAGS *=/s#=.*#=$CFLAGS#
+ /^SFLAGS *=/s#=.*#=$SFLAGS#
+@@ -693,9 +699,11 @@
+ /^PIC_OBJC *=/s#=.*#= $PIC_OBJC#
+ /^all: */s#:.*#: $ALL#
+ /^test: */s#:.*#: $TEST#
++/^builddir *=/s#=.*#=$builddir#
++/^srcdir *=/s#=.*#=$srcdir#
+ " > Makefile
+
+-sed < zlib.pc.in "
++sed < $srcdir/zlib.pc.in "
+ /^CC *=/s#=.*#=$CC#
+ /^CFLAGS *=/s#=.*#=$CFLAGS#
+ /^CPP *=/s#=.*#=$CPP#
+@@ -715,6 +723,8 @@
+ /^includedir *=/s#=.*#=$includedir#
+ /^mandir *=/s#=.*#=$mandir#
+ /^LDFLAGS *=/s#=.*#=$LDFLAGS#
++/^builddir *=/s#=.*#=$builddir#
++/^srcdir *=/s#=.*#=$srcdir#
+ " | sed -e "
+ s/\@VERSION\@/$VER/g;
+ " > zlib.pc
+diff -aruN a/Makefile.in b/Makefile.in
+--- a/Makefile.in 2012-01-28 14:48:50.000000000 -0800
++++ b/Makefile.in 2012-02-08 12:53:35.695989833 -0800
+@@ -45,6 +45,8 @@
+ SHELL=/bin/sh
+ EXE=
+
++builddir = .
++srcdir = .
+ prefix = /usr/local
+ exec_prefix = ${prefix}
+ libdir = ${exec_prefix}/lib
+@@ -55,6 +57,8 @@
+ pkgconfigdir = ${libdir}/pkgconfig
+ tempfile := $(shell mktemp -u __XXXXXX)
+
++VPATH = ${srcdir}
++
+ OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
+ OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
+ OBJC = $(OBJZ) $(OBJG)
+@@ -111,8 +115,8 @@
+ fi
+ -@rm -f foo.gz
+
+-infcover.o: test/infcover.c zlib.h zconf.h
+- $(CC) $(CFLAGS) -I. -c -o $@ test/infcover.c
++infcover.o: test/infcover.c $(srcdir)/zlib.h zconf.h
++ $(CC) $(CFLAGS) -I. -I$(srcdir) -c -o $@ test/infcover.c
+
+ infcover: infcover.o libz.a
+ $(CC) $(CFLAGS) -o $@ infcover.o libz.a
+@@ -138,17 +142,17 @@
+ mv _match.o match.lo
+ rm -f _match.s
+
+-example.o: test/example.c zlib.h zconf.h
+- $(CC) $(CFLAGS) -I. -c -o $@ test/example.c
++example.o: $(srcdir)/test/example.c $(srcdir)/zlib.h zconf.h
++ $(CC) $(CFLAGS) -I. -I$(srcdir) -c -o $@ $(srcdir)/test/example.c
+
+-minigzip.o: test/minigzip.c zlib.h zconf.h
+- $(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c
++minigzip.o: $(srcdir)/test/minigzip.c $(srcdir)/zlib.h zconf.h
++ $(CC) $(CFLAGS) -I. -I$(srcdir) -c -o $@ $(srcdir)/test/minigzip.c
+
+-example64.o: test/example.c zlib.h zconf.h
+- $(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/example.c
++example64.o: $(srcdir)/test/example.c $(srcdir)/zlib.h zconf.h
++ $(CC) $(CFLAGS) -I. -I$(srcdir) -D_FILE_OFFSET_BITS=64 -c -o $@ $(srcdir)/test/example.c
+
+-minigzip64.o: test/minigzip.c zlib.h zconf.h
+- $(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/minigzip.c
++minigzip64.o: test/minigzip.c $(srcdir)/zlib.h zconf.h
++ $(CC) $(CFLAGS) -I. -I$(srcdir) -D_FILE_OFFSET_BITS=64 -c -o $@ $(srcdir)/test/minigzip.c
+
+ .SUFFIXES: .lo
+
+@@ -201,7 +205,7 @@
+ ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
+ ($(LDCONFIG) || true) >/dev/null 2>&1; \
+ fi
+- cp zlib.3 $(DESTDIR)$(man3dir)
++ cp $(srcdir)/zlib.3 $(DESTDIR)$(man3dir)
+ chmod 644 $(DESTDIR)$(man3dir)/zlib.3
+ cp zlib.pc $(DESTDIR)$(pkgconfigdir)
+ chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
+@@ -210,7 +214,7 @@
+
+ install: install-libs
+ -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
+- cp zlib.h zconf.h $(DESTDIR)$(includedir)
++ cp $(srcdir)/zlib.h zconf.h $(DESTDIR)$(includedir)
+ chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
+
+ uninstall:
+@@ -227,14 +231,14 @@
+ zlib.3.pdf: zlib.3
+ groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf
+
+-zconf.h.cmakein: zconf.h.in
++zconf.h.cmakein: $(srcdir)/zconf.h.in
+ -@echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" > $(tempfile)
+- -@sed -f $(tempfile) zconf.h.in > zconf.h.cmakein
+- -@touch -r zconf.h.in zconf.h.cmakein
++ -@sed -f $(tempfile) $< > $@
++ -@touch -r $< $@
+ -@rm $(tempfile)
+
+-zconf: zconf.h.in
+- cp -p zconf.h.in zconf.h
++zconf: $(srcdir)/zconf.h.in
++ cp -p $< zconf.h
+
+ mostlyclean: clean
+ clean:
diff --git a/zlib.patches/zlib-51.description b/zlib.patches/zlib-51.description
new file mode 100644
index 0000000..7e26145
--- /dev/null
+++ b/zlib.patches/zlib-51.description
@@ -0,0 +1 @@
+This patch ensures that the native version of libtool is selected rather than any GNU-based optional versions that might be installed and in the PATH such as /opt/local/bin or /usr/local/bin.
diff --git a/zlib.patches/zlib-51.patch b/zlib.patches/zlib-51.patch
new file mode 100644
index 0000000..85de4b0
--- /dev/null
+++ b/zlib.patches/zlib-51.patch
@@ -0,0 +1,12 @@
+diff -aruN a/configure b/configure
+--- a/configure 2012-02-08 13:48:51.000000000 -0800
++++ b/configure 2012-02-08 13:47:50.000000000 -0800
+@@ -212,7 +212,7 @@
+ SHAREDLIBV=libz.$VER$shared_ext
+ SHAREDLIBM=libz.$VER1$shared_ext
+ LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"}
+- AR="libtool"
++ AR="/usr/bin/libtool"
+ ARFLAGS="-o" ;;
+ *) LDSHARED=${LDSHARED-"$cc -shared"} ;;
+ esac
diff --git a/zlib.patches/zlib-52.description b/zlib.patches/zlib-52.description
new file mode 100644
index 0000000..1e703cf
--- /dev/null
+++ b/zlib.patches/zlib-52.description
@@ -0,0 +1 @@
+Update Makefile.in to use /usr/bin/install instead of straight copying for install target
diff --git a/zlib.patches/zlib-52.patch b/zlib.patches/zlib-52.patch
new file mode 100644
index 0000000..8b38f8b
--- /dev/null
+++ b/zlib.patches/zlib-52.patch
@@ -0,0 +1,69 @@
+diff -aruN a/zlib-1.2.6/Makefile.in b/zlib-1.2.6/Makefile.in
+--- a/zlib-1.2.6/Makefile.in 2014-06-10 12:01:33.545047312 -0700
++++ b/zlib-1.2.6/Makefile.in 2014-06-10 14:33:50.674540434 -0700
+@@ -17,7 +17,6 @@
+ # make install prefix=$HOME
+
+ CC=cc
+-
+ CFLAGS=-O
+ #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
+ #CFLAGS=-g -DDEBUG
+@@ -44,6 +43,7 @@
+ TAR=tar
+ SHELL=/bin/sh
+ EXE=
++INSTALL=/usr/bin/install -c -C
+
+ builddir = .
+ srcdir = .
+@@ -187,35 +187,28 @@
+ $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
+
+ install-libs: $(LIBS)
+- -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
+- -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
+- -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
+- -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
+- -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
+- cp $(STATICLIB) $(DESTDIR)$(libdir)
+- chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
++ @$(INSTALL) -d $(DESTDIR)$(exec_prefix)
++ @$(INSTALL) -d $(DESTDIR)$(libdir)
++ @$(INSTALL) -d $(DESTDIR)$(sharedlibdir)
++ @$(INSTALL) -d $(DESTDIR)$(man3dir)
++ @$(INSTALL) -d $(DESTDIR)$(pkgconfigdir)
++ @$(INSTALL) -m 644 $(STATICLIB) $(DESTDIR)$(libdir)
+ -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
+ -@if test -n "$(SHAREDLIBV)"; then \
+- cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
+- echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
+- chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
+- echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
+- rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
+- ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
+- ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
++ $(INSTALL) -m 755 $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
++ echo "$(INSTALL) -m 755 $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
++ ln -sf $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
++ ln -sf $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
+ ($(LDCONFIG) || true) >/dev/null 2>&1; \
+ fi
+- cp $(srcdir)/zlib.3 $(DESTDIR)$(man3dir)
+- chmod 644 $(DESTDIR)$(man3dir)/zlib.3
+- cp zlib.pc $(DESTDIR)$(pkgconfigdir)
+- chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
++ @$(INSTALL) -m 644 $(srcdir)/zlib.3 $(DESTDIR)$(man3dir)
++ @$(INSTALL) -m 644 zlib.pc $(DESTDIR)$(pkgconfigdir)
+ # The ranlib in install is needed on NeXTSTEP which checks file times
+ # ldconfig is for Linux
+
+ install: install-libs
+- -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
+- cp $(srcdir)/zlib.h zconf.h $(DESTDIR)$(includedir)
+- chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
++ $(INSTALL) -d $(DESTDIR)$(includedir)
++ $(INSTALL) -m 644 $(srcdir)/zlib.h zconf.h $(DESTDIR)$(includedir)
+
+ uninstall:
+ cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h
diff --git a/zlib.tar.bz2 b/zlib.tar.bz2
new file mode 100644
index 0000000..c6479ba
--- /dev/null
+++ b/zlib.tar.bz2
Binary files differ
diff --git a/zlib.url b/zlib.url
new file mode 100644
index 0000000..9c929ec
--- /dev/null
+++ b/zlib.url
@@ -0,0 +1 @@
+http://www.zlib.net/zlib-1.2.6.tar.bz2
diff --git a/zlib.version b/zlib.version
new file mode 100644
index 0000000..3c43790
--- /dev/null
+++ b/zlib.version
@@ -0,0 +1 @@
+1.2.6