Bug 1442791 - Build _linux files on BSDs in ANGLE. - r=jrmuizel

MozReview-Commit-ID: DWgXTnUtyrp
This commit is contained in:
Jeff Gilbert 2018-03-21 14:23:13 -07:00
parent 54acb2e320
commit 1cae699f31
9 changed files with 54 additions and 45 deletions

View File

@ -47,7 +47,7 @@ LOCAL_INCLUDES += [
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
#
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
@ -118,19 +118,22 @@ SOURCES += [
'../../checkout/src/common/uniform_type_info_autogen.cpp',
'../../checkout/src/common/utilities.cpp',
]
if CONFIG['OS_ARCH'] == 'Darwin':
SOURCES += [
'../../checkout/src/common/system_utils_mac.cpp',
]
if CONFIG['OS_ARCH'] == 'Linux':
SOURCES += [
'../../checkout/src/common/system_utils_linux.cpp',
]
if CONFIG['OS_ARCH'] == 'WINNT':
SOURCES += [
'../../checkout/src/common/system_utils_win.cpp',
]
#
if CONFIG['OS_ARCH'] not in ('Darwin', 'WINNT'):
SOURCES += [
'../../checkout/src/common/system_utils_linux.cpp',
]
#LDFLAGS += [
# '/DEBUG',
# '/WX',

View File

@ -47,7 +47,7 @@ LOCAL_INCLUDES += [
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
#
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
@ -105,6 +105,7 @@ LOCAL_INCLUDES += [
SOURCES += [
'../../checkout/src/gpu_info_util/SystemInfo.cpp',
]
if CONFIG['OS_ARCH'] == 'WINNT':
SOURCES += [
'../../checkout/src/gpu_info_util/SystemInfo_win.cpp',
@ -121,7 +122,7 @@ DIRS += [
OS_LIBS += [
'setupapi',
]
#
#LDFLAGS += [
# '/DEBUG',
# '/WX',

View File

@ -46,7 +46,7 @@ LOCAL_INCLUDES += [
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
#
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
@ -115,7 +115,7 @@ USE_LIBS += [
DIRS += [
'../angle_common',
]
#
#LDFLAGS += [
# '/DEBUG',
# '/WX',

View File

@ -52,7 +52,7 @@ LOCAL_INCLUDES += [
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
#
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
@ -274,7 +274,7 @@ OS_LIBS += [
'dxguid',
'setupapi',
]
#
#LDFLAGS += [
# '/DEBUG',
# '/WX',

View File

@ -49,7 +49,7 @@ LOCAL_INCLUDES += [
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
#
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
@ -141,7 +141,7 @@ OS_LIBS += [
'winspool',
'ws2_32',
]
#
#LDFLAGS += [
# '/DEBUG',
# '/DYNAMICBASE:NO',
@ -155,7 +155,7 @@ OS_LIBS += [
# '/SUBSYSTEM:CONSOLE,5.02',
# '/WX',
#]
DEFFILE = SRCDIR + '/../../checkout/src/libEGL/libEGL.def'
RCFILE = '../../checkout/src/libEGL/libEGL.rc'
GeckoSharedLibrary('libEGL', linkage=None)

View File

@ -53,7 +53,7 @@ LOCAL_INCLUDES += [
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
#
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
@ -159,7 +159,7 @@ OS_LIBS += [
'winspool',
'ws2_32',
]
#
#LDFLAGS += [
# '/DEBUG',
# '/DYNAMICBASE:NO',
@ -173,7 +173,7 @@ OS_LIBS += [
# '/SUBSYSTEM:CONSOLE,5.02',
# '/WX',
#]
DEFFILE = SRCDIR + '/../../checkout/src/libGLESv2/libGLESv2.def'
RCFILE = '../../checkout/src/libGLESv2/libGLESv2.rc'
GeckoSharedLibrary('libGLESv2', linkage=None)

View File

@ -46,7 +46,7 @@ LOCAL_INCLUDES += [
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
#
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
@ -122,7 +122,7 @@ USE_LIBS += [
DIRS += [
'../angle_common',
]
#
#LDFLAGS += [
# '/DEBUG',
# '/WX',

View File

@ -49,7 +49,7 @@ LOCAL_INCLUDES += [
'../../checkout/src/',
'../../checkout/src/common/third_party/base/',
]
#
#CXXFLAGS += [
# '/bigobj',
# '/d2FastFail',
@ -228,7 +228,7 @@ DIRS += [
'../angle_common',
'../preprocessor',
]
#
#LDFLAGS += [
# '/DEBUG',
# '/WX',

View File

@ -218,15 +218,15 @@ checkout_dir.mkdir(exist_ok=True)
def sortedi(x):
return sorted(x, key=str.lower)
def append_arr(dest, name, vals):
def append_arr(dest, name, vals, indent=0):
if not vals:
return
dest.append('')
dest.append('{} += ['.format(name))
dest.append('{}{} += ['.format(' '*4*indent, name))
for x in sortedi(vals):
dest.append(" '{}',".format(x))
dest.append(']')
dest.append("{}'{}',".format(' '*4*(indent+1), x))
dest.append('{}]'.format(' '*4*indent))
dest.append('')
return
INCLUDE_REGEX = re.compile('# *include *"(.+)"')
@ -395,8 +395,8 @@ def export_target(root):
target_dir.mkdir(exist_ok=True)
lines = COMMON_HEADER[:]
lines.append('')
for x in sorted(set(accum_desc['defines'])):
try:
(k, v) = x.split('=', 1)
@ -410,6 +410,7 @@ def export_target(root):
lines.append(line)
except KeyError:
print('[{}] Unrecognized define: {}'.format(name, k))
lines.append('')
cxxflags = set(accum_desc['cflags'] + accum_desc['cflags_cc'])
@ -418,8 +419,7 @@ def export_target(root):
assert x.startswith('//'), x
yield '../../checkout/' + x[2:]
sources = []
sources_by_os_arch = {}
sources_by_config = {}
extras = dict()
for x in fixup_paths(accum_desc['sources']):
(b, e) = x.rsplit('.', 1)
@ -427,13 +427,16 @@ def export_target(root):
continue
elif e in ['cpp', 'cc']:
if b.endswith('_win'):
sources_by_os_arch.setdefault('WINNT', []).append(x)
config = "CONFIG['OS_ARCH'] == 'WINNT'"
elif b.endswith('_linux'):
sources_by_os_arch.setdefault('Linux', []).append(x)
# Include these on BSDs too.
config = "CONFIG['OS_ARCH'] not in ('Darwin', 'WINNT')"
elif b.endswith('_mac'):
sources_by_os_arch.setdefault('Darwin', []).append(x)
config = "CONFIG['OS_ARCH'] == 'Darwin'"
else:
sources.append(x)
config = '' # None can't compare against str.
sources_by_config.setdefault(config, []).append(x)
continue
elif e == 'rc':
assert 'RCFILE' not in extras
@ -452,20 +455,22 @@ def export_target(root):
def append_arr_commented(dest, name, src):
lines = []
append_arr(lines, name, src)
lines = map(lambda x: '#' + x, lines)
def comment(x):
if x:
x = '#' + x
return x
lines = map(comment, lines)
dest += lines
append_arr(lines, 'LOCAL_INCLUDES', fixup_paths(accum_desc['include_dirs']))
append_arr_commented(lines, 'CXXFLAGS', cxxflags)
append_arr(lines, 'SOURCES', sources)
for (os_arch,v) in sorted_items(sources_by_os_arch):
lines += [
"if CONFIG['OS_ARCH'] == '{}':".format(os_arch),
" SOURCES += [",
]
lines += ("{}'{}',".format(' '*8, x) for x in sorted(set(v)))
lines += [" ]"]
for (config,v) in sorted_items(sources_by_config):
indent = 0
if config:
lines.append("if {}:".format(config))
indent = 1
append_arr(lines, 'SOURCES', v, indent=indent)
append_arr(lines, 'USE_LIBS', use_libs)
append_arr(lines, 'DIRS', ['../' + x for x in use_libs])
@ -477,9 +482,9 @@ def export_target(root):
lib_type = root['type']
if lib_type == 'shared_library':
lines.append("\nGeckoSharedLibrary('{}', linkage=None)".format(name))
lines.append("GeckoSharedLibrary('{}', linkage=None)".format(name))
elif lib_type == 'static_library':
lines.append("\nLibrary('{}')".format(name))
lines.append("Library('{}')".format(name))
else:
assert False, lib_type