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
163
164
165
166
167
168
169
170
171
172
173
174
|
# Copyright (c) 2008 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
Import('env')
env = env.Clone(
GEARS_DIR = ".",
OPEN_DIR = "$GEARS_DIR/googleclient/gears/opensource/gears",
THIRD_PARTY_DIR = "$GEARS_DIR/googleclient/gears/opensource/third_party",
GENFILES_DIR = "$GEARS_DIR/genfiles",
PRIVATE_THIRD_PARTY_DIR = "$GEARS_DIR/googleclient/third_party",
)
# Argument switches
vars = Variables(None, ARGUMENTS)
vars.AddVariables(
EnumVariable('BROWSER',
'Which browser we want to build the plugin for',
'NPAPI', ['IE', 'FF2', 'FF3', 'SF', 'NPAPI']),
EnumVariable('MODE',
'Type of binary to generate',
'dbg', ['dbg', 'opt']),
BoolVariable('OFFICIAL_BUILD',
'Create a binary suitable for public release', 0)
)
vars.Update(env)
env.Append(
USING_CCTESTS = (env['MODE'] == 'dbg' or not env['OFFICIAL_BUILD'])
)
# Version
env.Append(
MAJOR = '0',
MINOR = '4',
BUILD = '17',
PATCH = '0',
VERSION = '${MAJOR}.${MINOR}.${BUILD}.${PATCH}',
FRIENDLY_NAME = 'Gears',
SHORT_NAME = 'gears',
)
# Platform
env.Append(
OS = '$PLATFORM',
ARCH = 'i386',
)
# C++ build flags.
# TODO: fix Gears to not require this removal.
env['CPPDEFINES'].remove('WIN32_LEAN_AND_MEAN')
env.Replace(
CPPPATH = [
'$OPEN_DIR',
'$OPEN_DIR/..',
'$THIRD_PARTY_DIR',
'$THIRD_PARTY_DIR/breakpad/src',
'$THIRD_PARTY_DIR/googleurl',
'$THIRD_PARTY_DIR/npapi',
'$THIRD_PARTY_DIR/zlib',
'$THIRD_PARTY_DIR/v8/bindings_local',
'$GEARS_DIR',
# TODO: switch over to Chrome's SDK.
# Note: these must come last because we want our own npapi.h to take
# precedence.
'$PRIVATE_THIRD_PARTY_DIR/platformsdk_vc80/files/include',
'$PRIVATE_THIRD_PARTY_DIR/atlmfc_vc80/files/include',
],
CCFLAGS = [],
)
if env['MODE'] == 'dbg':
env['CPPDEFINES'] += ['DEBUG=1']
env['CPPDEFINES'] += ['_DEBUG=1']
if env['USING_CCTESTS']:
env['CPPDEFINES'] += ['USING_CCTESTS=1']
if env['OFFICIAL_BUILD']:
env['CPPDEFINES'] += ['OFFICIAL_BUILD=1']
# TODO: if USING_PNG
env.Append(
CPPDEFINES = [
'PNG_USER_CONFIG',
],
)
# TODO: is this needed?
if env['PLATFORM'] == 'win32':
# We require APPVER=5.0 for things like HWND_MESSAGE.
# When APPVER=5.0, win32.mak in the Platform SDK sets:
# C defines: WINVER=0x0500
# _WIN32_WINNT=0x0500
# _WIN32_IE=0x0500
# _RICHEDIT_VER=0x0010
# RC defines: WINVER=0x0500
# MIDL flags: /target NT50
# Note: _WIN32_WINDOWS was replaced by _WIN32_WINNT for post-Win95 builds.
# Note: XP_WIN is only used by Firefox headers
env.Append(
CPPDEFINES = [
'STRICT',
'_USRDLL',
'_WINDLL',
# 'WINVER=0x0500',
# '_WIN32_WINNT=0x0500',
'_WIN32_IE=0x0500',
'_RICHEDIT_VER=0x0010',
'_MERGE_PROXYSTUB',
'BREAKPAD_AVOID_STREAMS', # TODO: move to breakpad env
'XP_WIN',
# In VC8, the way to disable exceptions is to remove all /EH* flags, and to
# define _HAS_EXCEPTIONS=0 (for C++ headers) and _ATL_NO_EXCEPTIONS (for ATL).
'_HAS_EXCEPTIONS=0',
'_ATL_NO_EXCEPTIONS',
# Do not export UTF functions.
'U_STATIC_IMPLEMENTATION',
],
LINKFLAGS = [
'/NOLOGO',
'/DEBUG',
'/RELEASE',
'/NODEFAULTLIB:msvcrt',
# Set the preferred base address. This value was chosen because (a) it's near
# the top of the valid address range, and (b) it doesn't conflict with other
# DLLs loaded by Chrome in either the browser or plugin process.
'/BASE:0x65000000',
# Flags for security hardening (only available for win32, not wince).
'/DYNAMICBASE',
'/SAFESEH',
],
CPPFLAGS = [
'/MTd', # TODO: release mode
'/Zi', # TODO: Chrome defines /Z7, no idea what these are.
'/Zc:wchar_t-',
'/c',
'/W3',
'/WX',
'/GR-',
],
CXXFLAGS = [
'/TP',
'/J',
],
)
# Load all the components
sconscripts = [
'SConscript.googleurl',
'SConscript.libgd',
'SConscript.libjpeg',
'SConscript.libpng',
'SConscript.portaudio',
'SConscript.sqlite',
'SConscript.zlib',
]
for each in sconscripts:
env.SConscript(each,
exports=['env'],
variant_dir=env.subst('$MODE/common').lower(),
duplicate=0)
env.SConscript('SConscript.dll',
exports=['env'],
variant_dir=env.subst('$MODE/$BROWSER').lower(),
duplicate=0)
|