summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-06 19:04:50 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-06 19:04:50 +0000
commit7ef52bf5efc171bfe16db94580ea6b3b49691bd3 (patch)
treee63dc8e500aa97dbc6a87d0680f3708c00b3cd1c
parent8c9f3b39071d565c338726109c4a2ac57fc906c6 (diff)
downloadchromium_src-7ef52bf5efc171bfe16db94580ea6b3b49691bd3.zip
chromium_src-7ef52bf5efc171bfe16db94580ea6b3b49691bd3.tar.gz
chromium_src-7ef52bf5efc171bfe16db94580ea6b3b49691bd3.tar.bz2
Linux: add GYP flag to build with system libbz2.
This follows the general style of r21663, which we agreed was the way to do this. Note that, currently, one cannot build with system libbz2 on a 64-bit system since it's not part of the ia32-compat package. http://codereview.chromium.org/165016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22640 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/metrics/metrics_service.cc7
-rw-r--r--chrome/common/bzip2_unittest.cc7
-rw-r--r--net/base/bzip2_filter.h7
-rw-r--r--net/base/bzip2_filter_unittest.cc7
-rw-r--r--third_party/bzip2/bzip2.gyp85
5 files changed, 80 insertions, 33 deletions
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index c610cdf..ae4330d 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -162,6 +162,12 @@
#include <objbase.h>
#endif
+#if defined(USE_SYSTEM_LIBBZ2)
+#include <bzlib.h>
+#else
+#include "third_party/bzip2/bzlib.h"
+#endif
+
#include "base/file_path.h"
#include "base/histogram.h"
#include "base/path_service.h"
@@ -191,7 +197,6 @@
#include "chrome/common/render_messages.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"
-#include "third_party/bzip2/bzlib.h"
#if defined(OS_POSIX)
// TODO(port): Move these headers above as they are ported.
diff --git a/chrome/common/bzip2_unittest.cc b/chrome/common/bzip2_unittest.cc
index 49fa809..0f14205 100644
--- a/chrome/common/bzip2_unittest.cc
+++ b/chrome/common/bzip2_unittest.cc
@@ -2,9 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#if defined(USE_SYSTEM_LIBBZ2)
+#include <bzlib.h>
+#else
+#include "third_party/bzip2/bzlib.h"
+#endif
+
#include "base/basictypes.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/bzip2/bzlib.h"
namespace {
class Bzip2Test : public testing::Test {
diff --git a/net/base/bzip2_filter.h b/net/base/bzip2_filter.h
index e5e88f6..5a9e7b6 100644
--- a/net/base/bzip2_filter.h
+++ b/net/base/bzip2_filter.h
@@ -20,9 +20,14 @@
#ifndef NET_BASE_BZIP2_FILTER_H_
#define NET_BASE_BZIP2_FILTER_H_
+#if defined(USE_SYSTEM_LIBBZ2)
+#include <bzlib.h>
+#else
+#include "third_party/bzip2/bzlib.h"
+#endif
+
#include "base/scoped_ptr.h"
#include "net/base/filter.h"
-#include "third_party/bzip2/bzlib.h"
class BZip2Filter : public Filter {
public:
diff --git a/net/base/bzip2_filter_unittest.cc b/net/base/bzip2_filter_unittest.cc
index 9b1eab5..7705ebb 100644
--- a/net/base/bzip2_filter_unittest.cc
+++ b/net/base/bzip2_filter_unittest.cc
@@ -5,6 +5,12 @@
#include <fstream>
#include <iostream>
+#if defined(USE_SYSTEM_LIBBZ2)
+#include <bzlib.h>
+#else
+#include "third_party/bzip2/bzlib.h"
+#endif
+
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/scoped_ptr.h"
@@ -13,7 +19,6 @@
#include "net/base/io_buffer.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
-#include "third_party/bzip2/bzlib.h"
namespace {
diff --git a/third_party/bzip2/bzip2.gyp b/third_party/bzip2/bzip2.gyp
index c9f59de..dd493b0 100644
--- a/third_party/bzip2/bzip2.gyp
+++ b/third_party/bzip2/bzip2.gyp
@@ -6,35 +6,62 @@
'includes': [
'../../build/common.gypi',
],
- 'targets': [
- {
- 'target_name': 'bzip2',
- 'type': '<(library)',
- 'defines': ['BZ_NO_STDIO'],
- 'msvs_guid': '2A70CBF0-847E-4E3A-B926-542A656DC7FE',
- 'sources': [
- 'blocksort.c',
- 'bzlib.c',
- 'bzlib.h',
- 'bzlib_private.h',
- 'compress.c',
- 'crctable.c',
- 'decompress.c',
- 'huffman.c',
- 'randtable.c',
+ 'variables': {
+ 'use_system_bzip2%': 0,
+ },
+ 'conditions': [
+ ['use_system_bzip2==0', {
+ 'targets': [
+ {
+ 'target_name': 'bzip2',
+ 'type': '<(library)',
+ 'defines': ['BZ_NO_STDIO'],
+ 'msvs_guid': '2A70CBF0-847E-4E3A-B926-542A656DC7FE',
+ 'sources': [
+ 'blocksort.c',
+ 'bzlib.c',
+ 'bzlib.h',
+ 'bzlib_private.h',
+ 'compress.c',
+ 'crctable.c',
+ 'decompress.c',
+ 'huffman.c',
+ 'randtable.c',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '.',
+ ],
+ },
+ 'conditions': [
+ ['OS=="win"', {
+ 'product_name': 'libbzip2',
+ }, { # else: OS!="win"
+ 'product_name': 'bz2',
+ }],
+ ],
+ },
],
- 'direct_dependent_settings': {
- 'include_dirs': [
- '.',
- ],
- },
- 'conditions': [
- ['OS=="win"', {
- 'product_name': 'libbzip2',
- }, { # else: OS!="win"
- 'product_name': 'bz2',
- }],
- ],
- },
+ }, {
+ 'targets': [
+ {
+ 'target_name': 'bzip2',
+ 'type': 'settings',
+
+ 'direct_dependent_settings': {
+ 'defines': [
+ 'USE_SYSTEM_LIBBZ2',
+ ],
+ },
+
+ # There aren't any pkg-config files for libbz2
+ 'link_settings': {
+ 'libraries': [
+ '-lbz2',
+ ],
+ },
+ },
+ ]
+ }],
],
}