Bug 1523204 - Streamline the DIA SDK setup. r=chmanchester

We currently rely on WIN_DIA_SDK_BIN_DIR being passed, but we can
actually derive it from the DIA SDK directory. So we now do that, except
when it's given explicitly.

While in the vicinity, move the dia2.h check to python configure.

With WIN_DIA_SDK_BIN_DIR being derived and not set when dia2.h is not
found, we don't really need MSVC_HAS_DIA_SDK anymore, so we just check
for WIN_DIA_SDK_BIN_DIR to determine whether to build dump_syms or not.

One exception to the above is when WIN_DIA_SDK_BIN_DIR is passed in,
which we only keep for the in-tree mozconfigs for now. We'll remove that
possibility after bug 1523201.

Depends on D17892

Differential Revision: https://phabricator.services.mozilla.com/D17893

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-01-29 07:38:14 +00:00
Родитель 95cdfbcd30
Коммит 4913b1c2d2
3 изменённых файлов: 50 добавлений и 37 удалений

Просмотреть файл

@ -280,18 +280,18 @@ option(env='DIA_SDK_PATH', nargs=1,
@depends(vc_path, 'DIA_SDK_PATH')
@checking('for the Debug Interface Access SDK', lambda x: x or 'not found')
@imports('os')
@imports(_from='os.path', _import='isdir')
def dia_sdk_dir(vc_path, dia_sdk_path):
if dia_sdk_path:
return os.path.normpath(dia_sdk_path[0])
path = os.path.normpath(dia_sdk_path[0])
if vc_path:
elif vc_path:
# This would be easier if we had the installationPath that
# get_vc_paths works with, since 'DIA SDK' is relative to that.
path = os.path.normpath(os.path.join(
vc_path, r'..\..\..\..\DIA SDK'))
if isdir(path):
return path
if os.path.exists(os.path.join(path, 'include', 'dia2.h')):
return path
@depends(vc_path, valid_windows_sdk_dir, valid_ucrt_sdk_dir, dia_sdk_dir)
@ -333,20 +333,13 @@ set_config('INCLUDE', include_path)
@template
def lib_path_for(host_or_target):
@depends(host_or_target, dependable(host_or_target is host), vc_path,
valid_windows_sdk_dir, valid_ucrt_sdk_dir, dia_sdk_dir)
@imports('os')
def lib_path(target, is_host, vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_dir):
if not vc_path:
def dia_sdk_subdir(host_or_target, subdir):
@depends(dia_sdk_dir, host_or_target, dependable(subdir))
def dia_sdk_subdir(dia_sdk_dir, target, subdir):
if not dia_sdk_dir:
return
sdk_target = {
'x86': 'x86',
'x86_64': 'x64',
'arm': 'arm',
'aarch64': 'arm64',
}.get(target.cpu)
# For some reason the DIA SDK still uses the old-style targets
# even in a newer MSVC.
old_target = {
'x86': '',
'x86_64': 'amd64',
@ -360,6 +353,42 @@ def lib_path_for(host_or_target):
# interpret as a "string continues on next line" indicator, use variable
# args.
old_target = (old_target,) if old_target else ()
return os.path.join(dia_sdk_dir, subdir, *old_target)
return dia_sdk_subdir
# XXX: remove after bug 1523201
js_option(env='WIN_DIA_SDK_BIN_DIR', nargs=1, help='Path to the DIA DLLs')
@depends('WIN_DIA_SDK_BIN_DIR', dia_sdk_subdir(host, 'bin'))
@imports('os')
def dia_sdk_bin_dir(from_env, guessed):
if from_env:
if not os.path.isdir(from_env[0]):
die('Invalid Windows DIA SDK directory: {}'.format(from_env))
return from_env[0]
return guessed
set_config('WIN_DIA_SDK_BIN_DIR', dia_sdk_bin_dir)
@template
def lib_path_for(host_or_target):
@depends(host_or_target, dependable(host_or_target is host), vc_path,
valid_windows_sdk_dir, valid_ucrt_sdk_dir, dia_sdk_subdir(host_or_target, 'lib'))
@imports('os')
def lib_path(target, is_host, vc_path, windows_sdk_dir, ucrt_sdk_dir, dia_sdk_lib_dir):
if not vc_path:
return
sdk_target = {
'x86': 'x86',
'x86_64': 'x64',
'arm': 'arm',
'aarch64': 'arm64',
}.get(target.cpu)
# MSVC2017 switched to use the same target naming as the sdk.
atlmfc_dir = os.path.join(vc_path, 'atlmfc', 'lib', sdk_target)
@ -377,10 +406,8 @@ def lib_path_for(host_or_target):
os.path.join(windows_sdk_dir.lib, 'um', sdk_target),
os.path.join(ucrt_sdk_dir.lib, 'ucrt', sdk_target),
))
if dia_sdk_dir:
# For some reason the DIA SDK still uses the old-style targets
# even in a newer MSVC.
libs.append(os.path.join(dia_sdk_dir, 'lib', *old_target))
if dia_sdk_lib_dir:
libs.append(dia_sdk_lib_dir)
return libs
return lib_path

Просмотреть файл

@ -168,11 +168,6 @@ case "$target" in
MSVC_C_RUNTIME_DLL=vcruntime140.dll
MSVC_CXX_RUNTIME_DLL=msvcp140.dll
MOZ_CHECK_HEADER(dia2.h, MSVC_HAS_DIA_SDK=1)
if test -n "$MSVC_HAS_DIA_SDK"; then
AC_DEFINE(MSVC_HAS_DIA_SDK)
fi
# C5038: Enable initializer list order warnings
# The -w1#### flag treats warning C#### as if it was a warning level
# 1 warning, and thus enables it because we enable /W3 warnings. We
@ -208,14 +203,6 @@ case "$target" in
WIN_UCRT_REDIST_DIR=`cd "$WIN_UCRT_REDIST_DIR" && pwd -W`
fi
if test -n "$WIN_DIA_SDK_BIN_DIR"; then
if test ! -d "$WIN_DIA_SDK_BIN_DIR"; then
AC_MSG_ERROR([Invalid Windows DIA SDK directory: ${WIN_DIA_SDK_BIN_DIR}])
fi
WIN_DIA_SDK_BIN_DIR=`cd "$WIN_DIA_SDK_BIN_DIR" && pwd -W`
fi
AC_SUBST(MSVC_HAS_DIA_SDK)
AC_SUBST(MSVC_C_RUNTIME_DLL)
AC_SUBST(MSVC_CXX_RUNTIME_DLL)
@ -3469,7 +3456,6 @@ fi
dnl win32 options
AC_SUBST(WIN32_REDIST_DIR)
AC_SUBST(WIN_UCRT_REDIST_DIR)
AC_SUBST(WIN_DIA_SDK_BIN_DIR)
dnl ========================================================
dnl ICU Support

Просмотреть файл

@ -35,7 +35,7 @@ if CONFIG['MOZ_CRASHREPORTER']:
'breakpad-windows-libxul',
]
if CONFIG['MSVC_HAS_DIA_SDK']:
if CONFIG['WIN_DIA_SDK_BIN_DIR']:
DIRS += ['google-breakpad/src/tools/windows/dump_syms']
if CONFIG['MOZ_CRASHREPORTER_INJECTOR']: