From 97199591735ab2316737205ab9dc1e25c62768f2 Mon Sep 17 00:00:00 2001 From: "agl@chromium.org" Date: Thu, 6 Aug 2009 18:48:45 +0000 Subject: Linux: add GYP flag to build with system zlib. This follows the general style of r21663, which we agreed was the way to do this. Note that, currently, one cannot build with system zlib on a 64-bit system since it's missing a symlink to libz.so in /usr/lib32. http://codereview.chromium.org/164027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22638 0039d316-1c4b-4281-b951-d872f2087c98 --- third_party/zlib/contrib/minizip/ioapi.c | 9 +- third_party/zlib/contrib/minizip/mztools.c | 7 +- third_party/zlib/contrib/minizip/mztools.h | 6 +- third_party/zlib/contrib/minizip/unzip.c | 6 +- third_party/zlib/contrib/minizip/unzip.h | 6 +- third_party/zlib/contrib/minizip/zip.c | 6 +- third_party/zlib/contrib/minizip/zip.h | 6 +- third_party/zlib/zlib.gyp | 143 ++++++++++++++++++----------- 8 files changed, 121 insertions(+), 68 deletions(-) (limited to 'third_party/zlib') diff --git a/third_party/zlib/contrib/minizip/ioapi.c b/third_party/zlib/contrib/minizip/ioapi.c index 3916d04..3aad38a 100644 --- a/third_party/zlib/contrib/minizip/ioapi.c +++ b/third_party/zlib/contrib/minizip/ioapi.c @@ -10,12 +10,13 @@ #include #include -/* NOTE(erikkay): this modification was needed to avoid picking up the system - version of zlib.h on the Mac */ +#if defined(USE_SYSTEM_ZLIB) +#include +#else #include "third_party/zlib/zlib.h" -#include "ioapi.h" - +#endif +#include "ioapi.h" /* I've found an old Unix (a SunOS 4.1.3_U1) without all SEEK_* defined.... */ diff --git a/third_party/zlib/contrib/minizip/mztools.c b/third_party/zlib/contrib/minizip/mztools.c index 8a50ee4..bc19436 100644 --- a/third_party/zlib/contrib/minizip/mztools.c +++ b/third_party/zlib/contrib/minizip/mztools.c @@ -8,7 +8,12 @@ #include #include #include -#include "zlib.h" + +#if defined(USE_SYSTEM_ZLIB) +#include +#else +#include "third_party/zlib/zlib.h" +#endif #include "unzip.h" #define READ_8(adr) ((unsigned char)*(adr)) diff --git a/third_party/zlib/contrib/minizip/mztools.h b/third_party/zlib/contrib/minizip/mztools.h index eee78dc..4af7a46 100644 --- a/third_party/zlib/contrib/minizip/mztools.h +++ b/third_party/zlib/contrib/minizip/mztools.h @@ -11,8 +11,10 @@ extern "C" { #endif -#ifndef _ZLIB_H -#include "zlib.h" +#if defined(USE_SYSTEM_ZLIB) +#include +#else +#include "third_party/zlib/zlib.h" #endif #include "unzip.h" diff --git a/third_party/zlib/contrib/minizip/unzip.c b/third_party/zlib/contrib/minizip/unzip.c index 72d88f2..6f95973 100644 --- a/third_party/zlib/contrib/minizip/unzip.c +++ b/third_party/zlib/contrib/minizip/unzip.c @@ -38,9 +38,11 @@ woven in by Terry Thorsen 1/2003. #include #include #include -/* NOTE(erikkay): this modification was needed to avoid picking up the system - version of zlib.h on the Mac */ +#if defined(USE_SYSTEM_ZLIB) +#include +#else #include "third_party/zlib/zlib.h" +#endif #include "unzip.h" #ifdef STDC diff --git a/third_party/zlib/contrib/minizip/unzip.h b/third_party/zlib/contrib/minizip/unzip.h index b247937..4e75c70 100644 --- a/third_party/zlib/contrib/minizip/unzip.h +++ b/third_party/zlib/contrib/minizip/unzip.h @@ -49,8 +49,10 @@ extern "C" { #endif -#ifndef _ZLIB_H -#include "zlib.h" +#if defined(USE_SYSTEM_ZLIB) +#include +#else +#include "third_party/zlib/zlib.h" #endif #ifndef _ZLIBIOAPI_H diff --git a/third_party/zlib/contrib/minizip/zip.c b/third_party/zlib/contrib/minizip/zip.c index 7fbe002..87b15b6 100644 --- a/third_party/zlib/contrib/minizip/zip.c +++ b/third_party/zlib/contrib/minizip/zip.c @@ -14,7 +14,11 @@ #include #include #include -#include "zlib.h" +#if defined(USE_SYSTEM_ZLIB) +#include +#else +#include "third_party/zlib/zlib.h" +#endif #include "zip.h" #ifdef STDC diff --git a/third_party/zlib/contrib/minizip/zip.h b/third_party/zlib/contrib/minizip/zip.h index acacce8..77a2374 100644 --- a/third_party/zlib/contrib/minizip/zip.h +++ b/third_party/zlib/contrib/minizip/zip.h @@ -50,8 +50,10 @@ extern "C" { #endif -#ifndef _ZLIB_H -#include "zlib.h" +#if defined(USE_SYSTEM_ZLIB) +#include +#else +#include "third_party/zlib/zlib.h" #endif #ifndef _ZLIBIOAPI_H diff --git a/third_party/zlib/zlib.gyp b/third_party/zlib/zlib.gyp index bcec3a9..922676d 100644 --- a/third_party/zlib/zlib.gyp +++ b/third_party/zlib/zlib.gyp @@ -6,62 +6,97 @@ 'includes': [ '../../build/common.gypi', ], - 'targets': [ - { - 'target_name': 'zlib', - 'type': '<(library)', - 'msvs_guid': '8423AF0D-4B88-4EBF-94E1-E4D00D00E21C', - 'sources': [ - 'contrib/minizip/ioapi.c', - 'contrib/minizip/ioapi.h', - 'contrib/minizip/iowin32.c', - 'contrib/minizip/iowin32.h', - 'contrib/minizip/unzip.c', - 'contrib/minizip/unzip.h', - 'contrib/minizip/zip.c', - 'contrib/minizip/zip.h', - 'adler32.c', - 'compress.c', - 'crc32.c', - 'crc32.h', - 'deflate.c', - 'deflate.h', - 'gzio.c', - 'infback.c', - 'inffast.c', - 'inffast.h', - 'inffixed.h', - 'inflate.c', - 'inflate.h', - 'inftrees.c', - 'inftrees.h', - 'mozzconf.h', - 'trees.c', - 'trees.h', - 'uncompr.c', - 'zconf.h', - 'zlib.h', - 'zutil.c', - 'zutil.h', - ], - 'include_dirs': [ - '.', - # For contrib/minizip - '../..', + 'variables': { + 'use_system_zlib%': 0, + }, + 'conditions': [ + ['use_system_zlib==0', { + 'targets': [ + { + 'target_name': 'zlib', + 'type': '<(library)', + 'msvs_guid': '8423AF0D-4B88-4EBF-94E1-E4D00D00E21C', + 'sources': [ + 'contrib/minizip/ioapi.c', + 'contrib/minizip/ioapi.h', + 'contrib/minizip/iowin32.c', + 'contrib/minizip/iowin32.h', + 'contrib/minizip/unzip.c', + 'contrib/minizip/unzip.h', + 'contrib/minizip/zip.c', + 'contrib/minizip/zip.h', + 'adler32.c', + 'compress.c', + 'crc32.c', + 'crc32.h', + 'deflate.c', + 'deflate.h', + 'gzio.c', + 'infback.c', + 'inffast.c', + 'inffast.h', + 'inffixed.h', + 'inflate.c', + 'inflate.h', + 'inftrees.c', + 'inftrees.h', + 'mozzconf.h', + 'trees.c', + 'trees.h', + 'uncompr.c', + 'zconf.h', + 'zlib.h', + 'zutil.c', + 'zutil.h', + ], + 'include_dirs': [ + '.', + # For contrib/minizip + '../..', + ], + 'direct_dependent_settings': { + 'include_dirs': [ + '.', + ], + }, + 'conditions': [ + ['OS!="win"', { + 'product_name': 'z', + 'sources!': [ + 'contrib/minizip/iowin32.c' + ], + }], + ], + }, ], - 'direct_dependent_settings': { - 'include_dirs': [ - '.', - ], - }, - 'conditions': [ - ['OS!="win"', { - 'product_name': 'z', - 'sources!': [ - 'contrib/minizip/iowin32.c' + }, { + 'targets': [ + { + 'target_name': 'zlib', + 'type': '<(library)', + 'direct_dependent_settings': { + 'defines': [ + 'USE_SYSTEM_ZLIB', + ], + }, + 'defines': [ + 'USE_SYSTEM_ZLIB', + ], + 'sources': [ + 'contrib/minizip/ioapi.c', + 'contrib/minizip/ioapi.h', + 'contrib/minizip/unzip.c', + 'contrib/minizip/unzip.h', + 'contrib/minizip/zip.c', + 'contrib/minizip/zip.h', ], - }], + 'link_settings': { + 'libraries': [ + '-lz', + ], + }, + }, ], - }, + }], ], } -- cgit v1.1