summaryrefslogtreecommitdiffstats
path: root/patches/0001-Mac-Use-libc-instead-of-stdlibc.patch
blob: a0e954005852aaa1c1480e921c8d7ac0f6e9701d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
From ef6535b235613885abc20eb61879c4f97874cb5b Mon Sep 17 00:00:00 2001
From: Zeno Albisser <zeno.albisser@digia.com>
Date: Thu, 27 Jun 2013 15:51:43 +0200
Subject: [PATCH] Mac: Use libc++ instead of stdlibc++.

- Add a missing include file to process_iterator_mac.cc.
- Disable Chromium clang plugins.
- Add a use_libcpp variable to common.gypi that can be used
  to build with libc++ instead of libstdc++.
  In this case several warnings also must be disabled,
  And the mac deployment target must be bumped to 10.7.
- ext/hash_map and ext/hash_set are deprecated.
  Use unordered containers as a replacement.
---
 base/process/process_iterator_mac.cc |  1 +
 build/common.gypi                    | 30 +++++++++++++++++++++++++++---
 third_party/protobuf/config.h        | 27 ++++++++++++++-------------
 3 files changed, 42 insertions(+), 16 deletions(-)

diff --git a/base/process/process_iterator_mac.cc b/base/process/process_iterator_mac.cc
index 29daa2d..e35c2ae 100644
--- a/base/process/process_iterator_mac.cc
+++ b/base/process/process_iterator_mac.cc
@@ -7,6 +7,7 @@
 #include <errno.h>
 #include <sys/sysctl.h>
 #include <sys/types.h>
+#include <unistd.h>
 
 #include "base/logging.h"
 #include "base/strings/string_util.h"
diff --git a/build/common.gypi b/build/common.gypi
index e13aba4..9961053 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -287,7 +287,7 @@
       # Run tools/clang/scripts/update.sh to make sure they are compiled.
       # This causes 'clang_chrome_plugins_flags' to be set.
       # Has no effect if 'clang' is not set as well.
-      'clang_use_chrome_plugins%': 1,
+      'clang_use_chrome_plugins%': 0,
 
       # Enable building with ASAN (Clang's -fsanitize=address option).
       # -fsanitize=address only works with clang, but asan=1 implies clang=1
@@ -1144,6 +1144,9 @@
     # rlz codes for searches but do not use the library.
     'enable_rlz%': 0,
 
+    # Compile with libc++ instead of libstdc++.
+    'use_libcpp%' : 0,
+
     # Turns on the i18n support in V8.
     'v8_enable_i18n_support': 1,
 
@@ -1414,10 +1417,10 @@
           # someplace that Xcode doesn't know about, set mac_sdk_path to the
           # path to the SDK; when set to a non-empty string, SDK detection
           # based on mac_sdk_min will be bypassed entirely.
-          'mac_sdk_min%': '10.6',
+          'mac_sdk_min%': '10.7',
           'mac_sdk_path%': '',
 
-          'mac_deployment_target%': '10.6',
+          'mac_deployment_target%': '10.7',
         },
 
         'mac_sdk_min': '<(mac_sdk_min)',
@@ -1427,6 +1430,7 @@
         # Compile in Breakpad support by default so that it can be
         # tested, even if it is not enabled by default at runtime.
         'mac_breakpad_compiled_in%': 1,
+
         'conditions': [
           # mac_product_name is set to the name of the .app bundle as it should
           # appear on disk.  This duplicates data from
@@ -1997,6 +2001,16 @@
       ['use_x11==1', {
         'defines': ['USE_X11=1'],
       }],
+      ['use_libcpp==1', {
+        'defines': ['USE_UNORDERED_CONTAINERS=1'],
+        'cflags_cc': [
+          '-Wno-deprecated-declarations',
+          '-Wno-newline-eof',
+          '-Wno-unused-value',
+          '-Wno-unused-variable',
+          '-stdlib=libc++'
+        ],
+      }],
       ['enable_one_click_signin==1', {
         'defines': ['ENABLE_ONE_CLICK_SIGNIN'],
       }],
@@ -3914,6 +3928,16 @@
                 '-Wno-deprecated-register',
               ],
             }],
+            ['use_libcpp==1', {
+              'OTHER_CPLUSPLUSFLAGS': ['-stdlib=libc++'],
+              'USE_LIBCPP': 'YES',
+              'WARNING_CFLAGS': [
+                '-Wno-deprecated-declarations',
+                '-Wno-newline-eof',
+                '-Wno-unused-value',
+                '-Wno-unused-variable',
+              ],
+            }],
             ['clang==1 and clang_use_chrome_plugins==1', {
               'OTHER_CFLAGS': [
                 '<@(clang_chrome_plugins_flags)',
diff --git a/third_party/protobuf/config.h b/third_party/protobuf/config.h
index dcc0041..affcf55 100644
--- a/third_party/protobuf/config.h
+++ b/third_party/protobuf/config.h
@@ -1,31 +1,32 @@
 /* config.h.  Generated from config.h.in by configure.  */
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
-/* the name of <hash_set> */
-#define HASH_MAP_CLASS hash_map
+#if defined(USE_UNORDERED_CONTAINERS)
+
+#define HASH_MAP_H <unordered_map>
+#define HASH_SET_H <unordered_set>
+#define HASH_NAMESPACE std
+#define HASH_MAP_CLASS unordered_map
+#define HASH_SET_CLASS unordered_set
 
-/* the location of <hash_map> */
-#if defined(USE_STLPORT)
-#define HASH_MAP_H <hash_map>
 #else
-#define HASH_MAP_H <ext/hash_map>
-#endif
 
-/* the namespace of hash_map/hash_set */
 #if defined(USE_STLPORT)
+#define HASH_MAP_H <hash_map>
+#define HASH_SET_H <hash_set>
 #define HASH_NAMESPACE std
 #else
+#define HASH_MAP_H <ext/hash_map>
+#define HASH_SET_H <ext/hash_set>
 #define HASH_NAMESPACE __gnu_cxx
 #endif
 
 /* the name of <hash_set> */
+#define HASH_MAP_CLASS hash_map
+
+/* the name of <hash_set> */
 #define HASH_SET_CLASS hash_set
 
-/* the location of <hash_set> */
-#if defined(USE_STLPORT)
-#define HASH_SET_H <hash_set>
-#else
-#define HASH_SET_H <ext/hash_set>
 #endif
 
 /* Define to 1 if you have the <dlfcn.h> header file. */
-- 
1.8.4.2