2016-07-14 19:16:42 +03:00
|
|
|
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
|
2013-02-26 00:47:18 +04:00
|
|
|
# vim: set filetype=python:
|
|
|
|
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
2015-02-26 22:43:45 +03:00
|
|
|
with Files('**'):
|
2018-03-14 23:44:46 +03:00
|
|
|
BUG_COMPONENT = ('Firefox Build System', 'General')
|
2015-02-26 22:43:45 +03:00
|
|
|
|
2018-03-29 16:18:00 +03:00
|
|
|
with Files('mozunit/**'):
|
2018-01-29 20:57:54 +03:00
|
|
|
BUG_COMPONENT = ('Testing', 'Python Test')
|
|
|
|
|
2015-05-09 02:24:18 +03:00
|
|
|
DIST_INSTALL = False
|
2013-10-24 23:06:19 +04:00
|
|
|
# For sanity's sake, we compile nsinstall without the wrapped system
|
|
|
|
# headers, so that we can use it to set up the wrapped system headers.
|
2017-05-02 04:12:35 +03:00
|
|
|
NoVisibilityFlags()
|
2013-10-03 00:51:15 +04:00
|
|
|
|
2013-02-26 00:47:18 +04:00
|
|
|
CONFIGURE_SUBST_FILES += [
|
|
|
|
'tests/src-simple/Makefile',
|
|
|
|
]
|
|
|
|
|
2013-06-11 19:31:11 +04:00
|
|
|
if CONFIG['HOST_OS_ARCH'] != 'WINNT':
|
2013-10-25 03:23:05 +04:00
|
|
|
HOST_SOURCES += [
|
2013-06-11 19:31:11 +04:00
|
|
|
'nsinstall.c',
|
|
|
|
'pathsub.c',
|
|
|
|
]
|
Bug 1423802 - Handle stdc++compat and STLPORT_LIBS at the emitter level. r=nalexander
Bug 1256642 introduced magic at the emitter level to determine whether a
binary contains C++ sources and should be linked with the C compiler or
the C++ compiler.
Unfortunately, the Binary() moz.build template always adds C++ OS
libraries on Android (through STLPORT_LIBS), and C++ libraries on Linux
(stdc++compat).
The latter only ends up forcing every Binary() to be linked with the C++
linker, which is unfortunate, but doesn't cause much problems. The
former, however, involving OS libraries, the magic from bug 1256642
doesn't kick in, so we end up trying to link C++ OS libraries with the C
linker. Which ends up failing, because the libraries in STLPORT_LIBS
require -lm, which, while it's added by the C++ compiler when linking,
is not when the linkage is driven by the C compiler.
Because the fallible library, linked to all GeckoBinary()s is a C++
library, we still ended up linking with the C++ compiler on Android, so
this wasn't actually causing any problem... until I tried to remove that
fallible library in bug 1423803.
Anyways, the core problem is that moz.build evaluation is happening too
early to know whether any C++ sources are being linked together, so
there is no way the Binary() template can do the right thing. So this
change moves the logic to the emitter.
This also changes the type of STLPORT_LIBS to a list.
--HG--
extra : rebase_source : a70ddf7a132f94dc10e7e1db94ae80fb8d7a269f
2017-12-07 06:15:32 +03:00
|
|
|
HostProgram('nsinstall_real')
|
2013-11-22 18:03:21 +04:00
|
|
|
|
2016-11-16 17:59:22 +03:00
|
|
|
PYTHON_UNITTEST_MANIFESTS += [
|
|
|
|
'tests/python.ini',
|
2014-07-28 19:51:12 +04:00
|
|
|
]
|
2015-07-22 18:04:32 +03:00
|
|
|
|
2017-12-08 00:09:15 +03:00
|
|
|
if CONFIG['CC_TYPE'] in ('clang', 'gcc') and CONFIG['MOZ_OPTIMIZE']:
|
2015-07-22 18:04:32 +03:00
|
|
|
CFLAGS += ['-O3']
|
2015-08-31 03:05:38 +03:00
|
|
|
|
2015-09-08 18:35:43 +03:00
|
|
|
HOST_DEFINES = {
|
|
|
|
'UNICODE': True,
|
|
|
|
'_UNICODE': True,
|
|
|
|
}
|
2017-11-09 01:42:27 +03:00
|
|
|
|
|
|
|
include('stl-headers.mozbuild')
|
|
|
|
if CONFIG['WRAP_STL_INCLUDES']:
|
|
|
|
stl_compiler = None
|
2017-12-08 00:09:15 +03:00
|
|
|
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
|
2017-11-09 01:42:27 +03:00
|
|
|
stl_compiler = 'gcc'
|
2019-02-15 00:45:27 +03:00
|
|
|
elif CONFIG['CC_TYPE'] == 'clang-cl':
|
2017-11-09 01:42:27 +03:00
|
|
|
stl_compiler = 'msvc'
|
|
|
|
|
|
|
|
if stl_compiler:
|
2018-09-07 16:34:40 +03:00
|
|
|
# Note that the 'stl_wrappers' folder is known to the build system as
|
|
|
|
# containing generated files; if this is changed here then the code in
|
|
|
|
# GeneratedFile.__init__ in python/mozbuild/mozbuild/frontend/data.py
|
|
|
|
# might need to be updated accordingly as well.
|
2017-11-09 01:42:27 +03:00
|
|
|
template_file = SRCDIR + '/%s-stl-wrapper.template.h' % stl_compiler
|
|
|
|
output_dir = '../dist/stl_wrappers'
|
|
|
|
# We have to use a sentinel file as the first file because the
|
|
|
|
# file_generate action will create it for us, but we want to create all
|
|
|
|
# the files in gen_wrappers()
|
|
|
|
outputs = tuple(['stl.sentinel'] + ['%s/%s' % (output_dir, h) for h in stl_headers])
|
|
|
|
GENERATED_FILES += [outputs]
|
|
|
|
stl = GENERATED_FILES[outputs]
|
|
|
|
stl.script = 'make-stl-wrappers.py:gen_wrappers'
|
|
|
|
stl.flags = [output_dir, stl_compiler, template_file]
|
|
|
|
stl.flags.extend(stl_headers)
|
2017-11-09 03:58:56 +03:00
|
|
|
|
2018-09-25 18:34:53 +03:00
|
|
|
# Wrap <windows.h> to make it easier to use correctly
|
|
|
|
# NOTE: If we aren't wrapping STL includes, we're building part of the browser
|
|
|
|
# which won't need this wrapper, such as L10N. Just don't try to generate the
|
|
|
|
# wrapper in that case.
|
|
|
|
if CONFIG['OS_ARCH'] == 'WINNT':
|
2019-10-08 00:15:19 +03:00
|
|
|
GeneratedFile('../dist/stl_wrappers/windows.h',
|
|
|
|
script='make-windows-h-wrapper.py',
|
|
|
|
entry_point='generate',
|
|
|
|
inputs = ['windows-h-constant.decls.h',
|
|
|
|
'windows-h-unicode.decls.h',
|
|
|
|
'windows-h-wrapper.template.h'],
|
|
|
|
flags=[stl_compiler])
|
2018-09-25 18:34:53 +03:00
|
|
|
|
2017-11-09 03:58:56 +03:00
|
|
|
if CONFIG['WRAP_SYSTEM_INCLUDES']:
|
|
|
|
include('system-headers.mozbuild')
|
|
|
|
output_dir = '../dist/system_wrappers'
|
|
|
|
outputs = tuple(['system-header.sentinel'] + ['%s/%s' % (output_dir, h) for h in stl_headers + system_headers])
|
|
|
|
GENERATED_FILES += [outputs]
|
|
|
|
system = GENERATED_FILES[outputs]
|
|
|
|
system.script = 'make-system-wrappers.py:gen_wrappers'
|
|
|
|
system.flags = [output_dir]
|
|
|
|
system.flags.extend(stl_headers)
|
|
|
|
system.flags.extend(system_headers)
|