~ubuntu-branches/debian/experimental/kopete/experimental

« back to all changes in this revision

Viewing changes to protocols/jabber/googletalk/libjingle/talk/main.scons

  • Committer: Package Import Robot
  • Author(s): Maximiliano Curia
  • Date: 2015-02-24 11:32:57 UTC
  • mfrom: (1.1.41 vivid)
  • Revision ID: package-import@ubuntu.com-20150224113257-gnupg4v7lzz18ij0
Tags: 4:14.12.2-1
* New upstream release (14.12.2).
* Bump Standards-Version to 3.9.6, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- Python -*-
2
 
#
3
 
# All the helper functions are defined in:
4
 
#  - site_scons/talk.py
5
 
# Use 'import talk' in any .scons file to get access to it.
6
 
# Add any new helper functions to it; unittest are available
7
 
# in talk_unittest.py.
8
 
#
9
 
# Each 'component' that is built is defined in a .scons file.
10
 
# See talk.Components(...) for further info on file naming convention.
11
 
#
12
 
# To add a new platform clone and modify the root_env object. Remember to add
13
 
# the new environment object to the envs list otherwise it will not be included
14
 
# in the build.
15
 
#
16
 
#
17
 
#
18
 
import talk
19
 
import os
20
 
import platform
21
 
 
22
 
#-------------------------------------------------------------------------------
23
 
# The build files/directories to 'build'.
24
 
# If the name is the name of a directory then that directory shall contain a
25
 
# .scons file with the same name as the directory itself:
26
 
#  Ex: The directory session/phone contains a file called phone.scons
27
 
# This list must be in order of library dependencies. e.g., if
28
 
# session/phone/phone.scons defines a target that links to a library target
29
 
# defined in sound/sound.scons, then 'sound' must come first.
30
 
# When no particular order is imposed by library dependencies, try to keep in
31
 
# mostly alphabetical order.
32
 
#
33
 
components = talk.Components("libjingle.scons")
34
 
 
35
 
#-------------------------------------------------------------------------------
36
 
# Build environments
37
 
#
38
 
 
39
 
# The list of build environments.
40
 
envs = []
41
 
 
42
 
# The root of all builds.
43
 
root_env = Environment(
44
 
  tools = [
45
 
    'component_bits',
46
 
    'component_setup',
47
 
    'replace_strings',
48
 
    'talk_noops',
49
 
    #'talk_utils',
50
 
  ],
51
 
  BUILD_SCONSCRIPTS = components,
52
 
  DESTINATION_ROOT = '$MAIN_DIR/build',
53
 
  CPPPATH = [
54
 
    '$OBJ_ROOT',     # generated headers are relative to here
55
 
    '$MAIN_DIR/..',  # TODO: how can we use GOOGLECLIENT instead?
56
 
  ],
57
 
  CPPDEFINES = [
58
 
    'LOGGING=1',
59
 
 
60
 
    # Feature selection
61
 
    'FEATURE_ENABLE_SSL',
62
 
    'FEATURE_ENABLE_VOICEMAIL',
63
 
    'FEATURE_ENABLE_PSTN',
64
 
    'HAVE_SRTP',
65
 
  ],
66
 
  # Ensure the os environment is captured for any scripts we call out to
67
 
  ENV = os.environ,
68
 
)
69
 
 
70
 
# This is where we set common environments
71
 
#
72
 
# Detect if building on 64-bit or 32-bit platform.
73
 
DeclareBit('build_platform_64bit', 'Platform of the build machine is 64-bit')
74
 
if platform.architecture()[0] == "64bit":
75
 
  root_env.SetBits('build_platform_64bit')
76
 
 
77
 
# This bit denotes that an env is for 64-bit builds. When set, all build
78
 
# artifacts will be 64-bit. When unset, all build artifacts will be 32-bit.
79
 
DeclareBit('host_platform_64bit', 'Platform of the host machine (where artifacts will execute) is 64-bit')
80
 
 
81
 
def CrossBuilding(env):
82
 
  return env.Bit('host_platform_64bit') != env.Bit('build_platform_64bit')
83
 
root_env.AddMethod(CrossBuilding)
84
 
 
85
 
DeclareBit('use_static_openssl', 'Build OpenSSL as a static library')
86
 
 
87
 
DeclareBit('have_dbus_glib',
88
 
           'Whether the build system has the dbus-glib-1 package')
89
 
DeclareBit('have_libpulse',
90
 
           'Whether the build system has the libpulse package')
91
 
 
92
 
 
93
 
# List all the locales we localize to.
94
 
root_env.AppendUnique(locales = [
95
 
    'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en', 'en-GB', 'es',
96
 
    'es-419', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'hi', 'hr', 'hu', 'id',
97
 
    'is', 'it', 'iw', 'ja', 'kn', 'ko', 'lt', 'lv', 'ml', 'mr', 'ms', 'nl',
98
 
    'no', 'or', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru', 'sk', 'sl', 'sr', 'sv',
99
 
    'ta', 'te', 'th', 'tl', 'tr', 'uk', 'ur', 'vi', 'zh-CN', 'zh-TW'])
100
 
 
101
 
AddTargetGroup('all_breakpads', 'breakpad files can be built')
102
 
 
103
 
#-------------------------------------------------------------------------------
104
 
# W I N D O W S
105
 
#
106
 
win_env = root_env.Clone(
107
 
  tools = [
108
 
    'atlmfc_vc80',
109
 
    #'code_signing',
110
 
    'component_targets_msvs',
111
 
    'directx_9_0_c',
112
 
    #'grid_builder',
113
 
    'midl',
114
 
    'target_platform_windows'
115
 
  ],
116
 
  # Don't use default vc80 midl.exe.  It doesn't understand vista_sdk idl files.
117
 
  MIDL = '$PLATFORM_SDK_VISTA_6_0_DIR/Bin/midl.exe ',
118
 
  WIX_DIR = '$GOOGLECLIENT/third_party/wix/v3_0_2925/files',
119
 
  # Flags for debug and optimization are added to CCFLAGS instead
120
 
  CCPDBFLAGS = '',
121
 
  CCFLAGS_DEBUG = '',
122
 
  CCFLAGS_OPTIMIZED = '',
123
 
  # We force a x86 target even when building on x64 Windows platforms.
124
 
  TARGET_ARCH = 'x86',
125
 
)
126
 
 
127
 
win_env.Decider('MD5-timestamp')
128
 
win_env.Append(
129
 
  COMPONENT_LIBRARY_PUBLISH = True,  # Put dlls in output dir too
130
 
  CCFLAGS = [
131
 
    '/Fd${TARGET}.pdb', # pdb per object allows --jobs=
132
 
    '/WX',          # warnings are errors
133
 
    '/Zc:forScope', # handle 'for (int i = 0 ...)' right
134
 
    '/EHs-c-',      # disable C++ EH
135
 
    '/GR-',         # disable RTTI
136
 
    '/Gy',          # enable function level linking
137
 
    '/wd4996',      # ignore POSIX deprecated warnings
138
 
 
139
 
    # promote certain level 4 warnings
140
 
    '/w14701',     # potentially uninitialized var
141
 
    '/w14702',     # unreachable code
142
 
    '/w14706',     # assignment within a conditional
143
 
    '/w14709',     # comma operator within array index
144
 
    '/w14063',     # case 'identifier' is not a valid value for switch of enum
145
 
    '/w14064',     # switch of incomplete enum 'enumeration'
146
 
    '/w14057',     # 'identifier1' indirection to slightly different base
147
 
                   #   types from 'identifier2'
148
 
    '/w14263',     # member function does not override any base class virtual
149
 
                   #   member function
150
 
    '/w14266',     # no override available for virtual memberfunction from base
151
 
                   #  'type'; function is hidden
152
 
    '/w14296',     # expression is always false
153
 
    '/w14355',     # 'this' : used in base member initializer list
154
 
  ],
155
 
  CPPDEFINES = [
156
 
    '_ATL_CSTRING_EXPLICIT_CONSTRUCTORS',
157
 
    # TODO: encapsulate all string operations that are not based
158
 
    # on std::string/std::wstring and make sure we use the safest versions
159
 
    # available on all platforms.
160
 
    '_CRT_SECURE_NO_WARNINGS',
161
 
    '_SCL_SECURE_NO_WARNINGS',
162
 
    '_USE_32BIT_TIME_T',
163
 
    '_UNICODE',
164
 
    'UNICODE',
165
 
    '_HAS_EXCEPTIONS=0',
166
 
    'WIN32',
167
 
    # TODO: remove this from logging.cc and enable here instead.
168
 
    #'WIN32_LEAN_AND_MEAN',
169
 
 
170
 
    'WINVER=0x0500',
171
 
    '_WIN32_WINNT=0x0501',
172
 
    '_WIN32_IE=0x0501',
173
 
    # The Vista platform SDK 6.0 needs at least
174
 
    # this NTDDI version or else the headers
175
 
    # that LMI includes from it won't compile.
176
 
    'NTDDI_VERSION=NTDDI_WINXP',
177
 
 
178
 
    # npapi.h requires the following:
179
 
    '_WINDOWS',
180
 
  ],
181
 
  CPPPATH = [
182
 
    '$THIRD_PARTY/wtl_71/include',
183
 
    '$PLATFORM_SDK_VISTA_6_0_DIR/Include',
184
 
  ],
185
 
  LIBPATH = [
186
 
    '$PLATFORM_SDK_VISTA_6_0_DIR/Lib'
187
 
  ],
188
 
  LINKFLAGS = [
189
 
    '-manifest' # TODO: Why do we need this?
190
 
  ],
191
 
  MIDLFLAGS = [
192
 
    '/win32',
193
 
    '/I$PLATFORM_SDK_VISTA_6_0_DIR/include'
194
 
  ]
195
 
)
196
 
 
197
 
# Merge in additional windows locales not supported yet on posix
198
 
win_env.AppendUnique(locales = [
199
 
    'af', 'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en', 'en-GB',
200
 
    'es', 'es-419', 'et', 'eu', 'fa', 'fi', 'fil', 'fr', 'fr-CA', 'gl', 'gu',
201
 
    'hi', 'hr', 'hu', 'id', 'is', 'it', 'iw', 'ja', 'kn', 'ko', 'lt', 'lv',
202
 
    'ml', 'mr', 'ms', 'nl', 'no', 'or', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
203
 
    'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tl', 'tr', 'uk', 'ur',
204
 
    'vi', 'zh-CN', 'zh-HK', 'zh-TW', 'zu'])
205
 
 
206
 
# TODO: Figure out what this does; found it in
207
 
# omaha/main.scons. This fixes the problem with redefinition
208
 
# of OS_WINDOWS symbol.
209
 
win_env.FilterOut(CPPDEFINES = ['OS_WINDOWS=OS_WINDOWS'])
210
 
 
211
 
# Set up digital signing
212
 
DeclareBit('test_signing', 'Sign binaries with the test certificate')
213
 
win_env.SetBitFromOption('test_signing', False)
214
 
if win_env.Bit('test_signing'):
215
 
   win_env.Replace(
216
 
     CERTIFICATE_PATH = win_env.File(
217
 
         '$GOOGLECLIENT/tools/test_key/testkey.pfx').abspath,
218
 
     CERTIFICATE_PASSWORD = 'test',
219
 
   )
220
 
AddTargetGroup('signed_binaries', 'digitally signed binaries can be built')
221
 
 
222
 
win_dbg_env = win_env.Clone(
223
 
  BUILD_TYPE = 'dbg',
224
 
  BUILD_TYPE_DESCRIPTION = 'Windows debug build',
225
 
  BUILD_GROUPS = ['default', 'all'],
226
 
  tools = ['target_debug'],
227
 
)
228
 
 
229
 
win_dbg_env.Prepend(
230
 
  CCFLAGS = [
231
 
    '/ZI',     # enable debugging
232
 
    '/Od',     # disable optimizations
233
 
    '/MTd',    # link with LIBCMTD.LIB debug lib
234
 
    '/RTC1',   # enable runtime checks
235
 
  ],
236
 
)
237
 
 
238
 
envs.append(win_dbg_env)
239
 
 
240
 
win_dbg64_env = win_dbg_env.Clone(
241
 
  BUILD_TYPE = 'dbg64',
242
 
  BUILD_TYPE_DESCRIPTION = 'Windows debug 64bit build',
243
 
  BUILD_GROUPS = ['all'],
244
 
)
245
 
 
246
 
win_dbg64_env.Append(
247
 
  ARFLAGS = [
248
 
    '/MACHINE:x64',
249
 
  ],
250
 
  CPPDEFINES = [
251
 
    'WIN64',
252
 
    'ARCH_CPU_64_BITS',
253
 
  ],
254
 
  LIBFLAGS = [
255
 
    '/MACHINE:x64',
256
 
  ],
257
 
  LINKFLAGS = [
258
 
    '/MACHINE:x64',
259
 
  ],
260
 
)
261
 
 
262
 
win_dbg64_env.FilterOut(CPPDEFINES = ['_USE_32BIT_TIME_T'])
263
 
 
264
 
win_dbg64_env.Prepend(
265
 
  LIBPATH = [
266
 
      '$VC80_DIR/vc/lib/amd64',
267
 
      '$ATLMFC_VC80_DIR/lib/amd64',
268
 
      '$PLATFORM_SDK_VISTA_6_0_DIR/Lib/x64',
269
 
  ],
270
 
)
271
 
win_dbg64_env.PrependENVPath(
272
 
  'PATH',
273
 
  win_dbg64_env.Dir('$VC80_DIR/vc/bin/x86_amd64'))
274
 
 
275
 
envs.append(win_dbg64_env)
276
 
 
277
 
 
278
 
win_coverage_env = win_dbg_env.Clone(
279
 
  tools = ['code_coverage'],
280
 
  BUILD_TYPE = 'coverage',
281
 
  BUILD_TYPE_DESCRIPTION = 'Windows code coverage build',
282
 
  BUILD_GROUPS = ['all'],
283
 
)
284
 
 
285
 
win_coverage_env.Append(
286
 
  CPPDEFINES = [
287
 
    'COVERAGE_ENABLED',
288
 
  ],
289
 
)
290
 
 
291
 
envs.append(win_coverage_env)
292
 
 
293
 
win_opt_env = win_env.Clone(
294
 
  BUILD_TYPE = 'opt',
295
 
  BUILD_TYPE_DESCRIPTION = 'Windows opt build',
296
 
  BUILD_GROUPS = ['all'],
297
 
  tools = ['target_optimized'],
298
 
)
299
 
 
300
 
win_opt_env.Prepend(
301
 
  CCFLAGS=[
302
 
      '/Zi',     # enable debugging
303
 
      '/O1',     # optimize for size
304
 
      '/MT',     # link with LIBCMT.LIB (multi-threaded, static linked crt)
305
 
      '/GS',     # enable security checks
306
 
  ],
307
 
  LINKFLAGS = [
308
 
    '/safeseh',  # protect against attacks against exception handlers
309
 
    '/opt:ref',  # Remove unused references (functions/data).
310
 
  ],
311
 
)
312
 
 
313
 
envs.append(win_opt_env)
314
 
 
315
 
#-------------------------------------------------------------------------------
316
 
# P O S I X
317
 
#
318
 
posix_env = root_env.Clone()
319
 
posix_env.Append(
320
 
  CPPDEFINES = [
321
 
    'HASHNAMESPACE=__gnu_cxx',
322
 
    'HASH_NAMESPACE=__gnu_cxx',
323
 
    'POSIX',
324
 
    'DISABLE_DYNAMIC_CAST',
325
 
    'HAVE_OPENSSL_SSL_H=1',
326
 
    # The POSIX standard says we have to define this.
327
 
    '_REENTRANT',
328
 
  ],
329
 
  CCFLAGS = [
330
 
    '-Wall',
331
 
    '-Werror',
332
 
    '-Wno-switch',
333
 
    '-fno-exceptions',
334
 
    # Needed for a clean ABI and for link-time dead-code removal to work
335
 
    # properly.
336
 
    '-fvisibility=hidden',
337
 
    # Generate debugging info in the DWARF2 format.
338
 
    '-gdwarf-2',
339
 
    # Generate maximal debugging information. (It is stripped from what we ship
340
 
    # to users, so we want it for both dbg and opt.)
341
 
    # Note that hammer automatically supplies "-g" for mac/linux dbg, so that
342
 
    # flag must be filtered out of linux_dbg and mac_dbg envs below.
343
 
    '-g3',
344
 
  ],
345
 
  CXXFLAGS = [
346
 
    '-Wno-non-virtual-dtor',
347
 
    '-Wno-ctor-dtor-privacy',
348
 
    '-fno-rtti',
349
 
  ],
350
 
)
351
 
 
352
 
#-------------------------------------------------------------------------------
353
 
# M A C OSX
354
 
#
355
 
mac_env = posix_env.Clone(
356
 
  tools = [
357
 
    'target_platform_mac',
358
 
    #'talk_mac',
359
 
    #'fill_plist',
360
 
  ],
361
 
)
362
 
# Use static OpenSSL on mac so that we can use the latest APIs on all
363
 
# supported mac platforms (10.5+).
364
 
mac_env.SetBits('use_static_openssl')
365
 
mac_env.Append(
366
 
  CPPDEFINES = [
367
 
    'OSX',
368
 
  ],
369
 
  CCFLAGS = [
370
 
    '-m32',
371
 
    '-arch', 'i386',
372
 
    '-isysroot', '/Developer/SDKs/MacOSX10.5.sdk',
373
 
    '-fasm-blocks',
374
 
  ],
375
 
  LINKFLAGS = [
376
 
    '-Wl,-search_paths_first',
377
 
    # This flag makes all members of a static library be included in the
378
 
    # final exe - that increases the size of the exe, but without it
379
 
    # Obj-C categories aren't properly included in the exe.
380
 
    # TODO: consider only defining for libs that actually have objc.
381
 
    '-ObjC',
382
 
    '-arch', 'i386',
383
 
    '-mmacosx-version-min=10.5',
384
 
    '-isysroot', '/Developer/SDKs/MacOSX10.5.sdk',
385
 
    '-m32',
386
 
    '-dead_strip',
387
 
  ],
388
 
  FRAMEWORKS = [
389
 
    'CoreServices',
390
 
    'Carbon',
391
 
    'Security',
392
 
    'SystemConfiguration',
393
 
    'OpenGL',
394
 
    'CoreAudio',
395
 
    'Quartz',
396
 
    'QuickTime',
397
 
    'Cocoa',
398
 
    'QTKit',
399
 
  ]
400
 
)
401
 
 
402
 
mac_dbg_env = mac_env.Clone(
403
 
  BUILD_TYPE = 'dbg',
404
 
  BUILD_TYPE_DESCRIPTION = 'Mac debug build',
405
 
  BUILD_GROUPS = ['default', 'all'],
406
 
  tools = ['target_debug'],
407
 
)
408
 
mac_dbg_env.Append(
409
 
  CCFLAGS = [
410
 
    '-O0',
411
 
  ],
412
 
  CPPDEFINES = [
413
 
    'DEBUG=1',
414
 
  ],
415
 
)
416
 
# Remove -g set by hammer, which is not what we want (we have set -g3 above).
417
 
mac_dbg_env.FilterOut(CCFLAGS = ['-g'])
418
 
envs.append(mac_dbg_env)
419
 
 
420
 
mac_opt_env = mac_env.Clone(
421
 
  BUILD_TYPE = 'opt',
422
 
  BUILD_TYPE_DESCRIPTION = 'Mac opt build',
423
 
  BUILD_GROUPS = ['all'],
424
 
  tools = ['target_optimized'],
425
 
)
426
 
mac_opt_env.Append(
427
 
  CCFLAGS = [
428
 
    # TODO: Figure out how hammer can compile without
429
 
    # this flag, then remove.  Confirmed asserts are preprocessed
430
 
    # out.  Maybe it's a different version of gcc?
431
 
    '-Wno-unused-variable',
432
 
  ],
433
 
  # Hammer automatically specifies -Os for mac opt.
434
 
)
435
 
envs.append(mac_opt_env)
436
 
 
437
 
#-------------------------------------------------------------------------------
438
 
# L I N U X
439
 
#
440
 
linux_common_env = posix_env.Clone(
441
 
  tools = [
442
 
    'target_platform_linux',
443
 
    'talk_linux',
444
 
  ],
445
 
)
446
 
 
447
 
linux_common_env.Append(
448
 
  CPPDEFINES = [
449
 
    'LINUX',
450
 
  ],
451
 
  CCFLAGS = [
452
 
    # Needed for link-time dead-code removal to work properly.
453
 
    '-ffunction-sections',
454
 
    '-fdata-sections',
455
 
  ],
456
 
  LINKFLAGS = [
457
 
    # Enable dead-code removal.
458
 
    '-Wl,--gc-sections',
459
 
    # Elide dependencies on shared libraries that we're not actually using.
460
 
    '-Wl,--as-needed',
461
 
    '-Wl,--start-group',
462
 
  ],
463
 
  _LIBFLAGS = ['-Wl,--end-group'],
464
 
)
465
 
 
466
 
# Remove default rpath set by Hammer. Hammer sets it to LIB_DIR, which is wrong.
467
 
# The rpath is the _run-time_ library search path for the resulting binary, i.e.
468
 
# the one used by ld.so at load time. Setting it equal to the path to build
469
 
# output on the build machine is nonsense.
470
 
linux_common_env.Replace(
471
 
  RPATH = [],
472
 
)
473
 
 
474
 
# Enable the optional DBus-GLib code if the build machine has the required
475
 
# dependency.
476
 
linux_common_env.EnableFeatureWherePackagePresent('have_dbus_glib',
477
 
                                                  'HAVE_DBUS_GLIB',
478
 
                                                  'dbus-glib-1')
479
 
 
480
 
def linux_common_include_x86_32(env):
481
 
  """Include x86-32 settings into an env based on linux_common."""
482
 
  env.Append(
483
 
    CCFLAGS = [
484
 
      '-m32',
485
 
    ],
486
 
    LINKFLAGS = [
487
 
      '-m32',
488
 
    ],
489
 
  )
490
 
 
491
 
def linux_common_include_x86_64(env):
492
 
  """Include x86-64 settings into an env based on linux_common."""
493
 
  env.Append(
494
 
    CCFLAGS = [
495
 
      '-m64',
496
 
      '-fPIC',
497
 
    ],
498
 
    LINKFLAGS = [
499
 
      '-m64',
500
 
    ],
501
 
  )
502
 
  env.SetBits('host_platform_64bit')
503
 
 
504
 
#-------------------------------------------------------------------------------
505
 
# L I N U X -- T R A D I T I O N A L -- X 8 6
506
 
#
507
 
# Settings that are specific to our desktop Linux x86 targets.
508
 
linux_x86_32_env = linux_common_env.Clone()
509
 
linux_common_include_x86_32(linux_x86_32_env)
510
 
 
511
 
linux_x86_64_env = linux_common_env.Clone()
512
 
linux_common_include_x86_64(linux_x86_64_env)
513
 
 
514
 
def gen_linux_x86(base_env, type_suffix, desc_suffix):
515
 
  linux_env = base_env.Clone()
516
 
  # OpenSSL has infamously poor ABI stability, so that building against one
517
 
  # version and running against a different one often will not work. Since our
518
 
  # non-ChromeOS Linux builds are used on many different distros and distro
519
 
  # versions, this means we can't safely dynamically link to OpenSSL because the
520
 
  # product would end up being broken on any computer with a different version
521
 
  # installed. So instead we build it ourself and statically link to it.
522
 
  linux_env.SetBits('use_static_openssl')
523
 
  # Enable the optional PulseAudio code if the build machine has the required
524
 
  # dependency. (Not doing this for linux_common_env because we don't want
525
 
  # PulseAudio used on ChromeOS.)
526
 
  linux_env.EnableFeatureWherePackagePresent('have_libpulse',
527
 
                                             'HAVE_LIBPULSE',
528
 
                                             'libpulse')
529
 
 
530
 
  groups = ['all']
531
 
  if not linux_env.CrossBuilding():
532
 
    groups = groups + ['all-native']
533
 
    # The native-arch dbg build is the default.
534
 
    dbg_groups = groups + ['default']
535
 
    native_desc = ', native '
536
 
    # No suffix for native modes.
537
 
    type_suffix = ''
538
 
  else:
539
 
    groups = groups + ['all-cross']
540
 
    dbg_groups = groups
541
 
    native_desc = ', cross-built for '
542
 
 
543
 
  linux_dbg_env = linux_env.Clone(
544
 
    BUILD_TYPE = 'dbg' + type_suffix,
545
 
    BUILD_TYPE_DESCRIPTION = 'Linux debug build%s%s' % (native_desc,
546
 
        desc_suffix),
547
 
    BUILD_GROUPS = dbg_groups,
548
 
    tools = ['target_debug'],
549
 
  )
550
 
  # Remove -g set by hammer, which is not what we want (we have set -g3 above).
551
 
  linux_dbg_env.FilterOut(CCFLAGS = ['-g'])
552
 
  envs.append(linux_dbg_env)
553
 
 
554
 
  linux_opt_env = linux_env.Clone(
555
 
    BUILD_TYPE = 'opt' + type_suffix,
556
 
    BUILD_TYPE_DESCRIPTION = 'Linux optimized build%s%s' % (native_desc,
557
 
        desc_suffix),
558
 
    BUILD_GROUPS = groups,
559
 
    tools = ['target_optimized'],
560
 
  )
561
 
  # Remove -O2 set by hammer, which is not what we want.
562
 
  linux_opt_env.FilterOut(CCFLAGS = ['-O2'])
563
 
  linux_opt_env.Append(CCFLAGS = ['-Os'])
564
 
  envs.append(linux_opt_env)
565
 
 
566
 
gen_linux_x86(linux_x86_32_env, '32', '32-bit')
567
 
gen_linux_x86(linux_x86_64_env, '64', '64-bit')
568
 
 
569
 
#-------------------------------------------------------------------------------
570
 
# L I N U X -- C R O S S -- B U I L D
571
 
 
572
 
# Cross build requires the following tool names be provided by the environment:
573
 
linux_cross_common_env = linux_common_env.Clone(
574
 
  AR = os.environ.get("AR"),
575
 
  AS = os.environ.get("AS"),
576
 
  LD = os.environ.get("LD"),
577
 
  NM = os.environ.get("NM"),
578
 
  RANLIB = os.environ.get("RANLIB"),
579
 
  CC = str(os.environ.get("CC")) +
580
 
    ' --sysroot=' + str(os.environ.get("SYSROOT")),
581
 
  CXX = str(os.environ.get("CXX")) +
582
 
    ' --sysroot=' + str(os.environ.get("SYSROOT")),
583
 
)
584
 
 
585
 
# The rest of these paths and flags are optional:
586
 
if os.environ.get("CPPPATH"):
587
 
  linux_cross_common_env.Append(
588
 
    CPPPATH = os.environ.get("CPPPATH").split(':'),
589
 
  )
590
 
if os.environ.get("LIBPATH"):
591
 
  linux_cross_common_env.Append(
592
 
    LIBPATH = os.environ.get("LIBPATH").split(':'),
593
 
  )
594
 
if os.environ.get("CFLAGS"):
595
 
  linux_cross_common_env.Append(
596
 
    CFLAGS = os.environ.get("CFLAGS").split(' '),
597
 
  )
598
 
if os.environ.get("CCFLAGS"):
599
 
  linux_cross_common_env.Append(
600
 
    CCFLAGS = os.environ.get("CCFLAGS").split(' '),
601
 
  )
602
 
if os.environ.get("CXXFLAGS"):
603
 
  linux_cross_common_env.Append(
604
 
    CXXFLAGS = os.environ.get("CXXFLAGS").split(' '),
605
 
  )
606
 
if os.environ.get("LIBFLAGS"):
607
 
  linux_cross_common_env.Append(
608
 
    _LIBFLAGS = os.environ.get("LIBFLAGS").split(' '),
609
 
  )
610
 
if os.environ.get("LINKFLAGS"):
611
 
  linux_cross_common_env.Prepend(
612
 
    LINKFLAGS = os.environ.get("LINKFLAGS").split(' '),
613
 
  )
614
 
 
615
 
#-------------------------------------------------------------------------------
616
 
# L I N U X -- C R O S S -- B U I L D -- A R M
617
 
 
618
 
linux_cross_arm_env = linux_cross_common_env.Clone()
619
 
linux_cross_arm_env.Append(
620
 
  CPPDEFINES = [
621
 
    'NACL_BUILD_ARCH=arm',
622
 
    'DISABLE_EFFECTS=1',
623
 
  ],
624
 
  CCFLAGS = [
625
 
    '-fPIC',
626
 
  ],
627
 
)
628
 
DeclareBit('arm', 'ARM build')
629
 
linux_cross_arm_env.SetBits('arm')
630
 
 
631
 
# Detect NEON support from the -mfpu build flag.
632
 
DeclareBit('arm_neon', 'ARM supporting neon')
633
 
if '-mfpu=neon' in linux_cross_arm_env['CFLAGS'] or \
634
 
   '-mfpu=neon' in linux_cross_arm_env['CCFLAGS'] or \
635
 
   '-mfpu=neon' in linux_cross_arm_env['CXXFLAGS']:
636
 
  print "Building with ARM NEON support."
637
 
  linux_cross_arm_env.SetBits('arm_neon')
638
 
 
639
 
 
640
 
linux_cross_arm_dbg_env = linux_cross_arm_env.Clone(
641
 
  BUILD_TYPE = 'arm-dbg',
642
 
  BUILD_TYPE_DESCRIPTION = 'Cross-compiled ARM debug build',
643
 
  BUILD_GROUPS = ['arm'],
644
 
  tools = ['target_debug'],
645
 
)
646
 
envs.append(linux_cross_arm_dbg_env)
647
 
 
648
 
linux_cross_arm_opt_env = linux_cross_arm_env.Clone(
649
 
  BUILD_TYPE = 'arm-opt',
650
 
  BUILD_TYPE_DESCRIPTION = 'Cross-compiled ARM optimized build',
651
 
  BUILD_GROUPS = ['arm'],
652
 
  tools = ['target_optimized'],
653
 
)
654
 
envs.append(linux_cross_arm_opt_env)
655
 
 
656
 
 
657
 
 
658
 
# TODO(): Clone linux envs for 64bit.  See 'variant' documentation.
659
 
 
660
 
# Create a group for installers
661
 
AddTargetGroup('all_installers', 'installers that can be built')
662
 
 
663
 
# Parse child .scons files
664
 
BuildEnvironments(envs)
665
 
 
666
 
# Explicitly set which targets to build when not stated on commandline
667
 
Default(None)
668
 
# Build the following, which excludes unit test output (ie running them)
669
 
# To run unittests, specify the test to run, or run_all_tests.  See -h option.
670
 
Default(['all_libraries', 'all_programs', 'all_test_programs'])
671
 
 
672
 
# .sln creation code lifted from googleclient/bar/main.scons.  Must be after
673
 
# the call to BuildEnvironments for all_foo aliases to be defined.
674
 
# Run 'hammer --mode=all --vsproj' to generate
675
 
DeclareBit('vsproj', 'Generate Visual Studio projects and solution files.')
676
 
win_env.SetBitFromOption('vsproj', False)
677
 
 
678
 
if win_env.Bit('vsproj'):
679
 
  vs_env = win_env.Clone()
680
 
  vs_env.Append(
681
 
    COMPONENT_VS_SOURCE_SUFFIXES = [
682
 
      '.def',
683
 
      '.grd',
684
 
      '.html',
685
 
      '.idl',
686
 
      '.mk',
687
 
      '.txt',
688
 
      '.py',
689
 
      '.scons',
690
 
      '.wxs.template',
691
 
    ]
692
 
  )
693
 
 
694
 
  # Source project
695
 
  p = vs_env.ComponentVSDirProject(
696
 
    'flute_source',
697
 
    ['$MAIN_DIR',
698
 
    ],
699
 
    COMPONENT_VS_SOURCE_FOLDERS = [
700
 
      # Files are assigned to first matching folder. Folder names of None
701
 
      # are filters.
702
 
      (None, '$DESTINATION_ROOT'),
703
 
      ('flute', '$MAIN_DIR'),
704
 
      ('google3', '$GOOGLE3'),
705
 
      ('third_party', '$THIRD_PARTY'),
706
 
    ],
707
 
    # Force source project to main dir, so that Visual Studio can find the
708
 
    # source files corresponding to build errors.
709
 
    COMPONENT_VS_PROJECT_DIR = '$MAIN_DIR',
710
 
  )
711
 
  vs_env.AlwaysBuild(p)
712
 
 
713
 
  # Solution and target projects
714
 
  s = vs_env.ComponentVSSolution(
715
 
    # 'libjingle',  # Please uncomment this line if you build VS proj files.
716
 
    ['all_libraries', 'all_programs', 'all_test_programs'],
717
 
    projects = [p],
718
 
  )
719
 
 
720
 
  print '***Unfortunately the vsproj creator isn\'t smart enough to '
721
 
  print '***automatically get the correct output locations.  It is very easy'
722
 
  print '***though to change it in the properties pane to the following'
723
 
  print '***$(SolutionDir)/build/<foo>/staging/<bar>.exe'
724
 
  Default(None)
725
 
  Default([s])