Bug 1399877 - globally define MOZ_DLL_PREFIX/MOZ_DLL_SUFFIX; r=gps

Several source files use DLL_PREFIX/DLL_SUFFIX defines, and they all set
them in moz.build using `DEFINES`.  This is problematic for the WSL
build because the quoting gets lost somewhere between bash and cl.exe.
We cannot simply set them globally in moz.configure because their
stringified definitions would conflict with the `set_config` of
DLL_PREFIX/DLL_SUFFIX.  Therefore, we globally define
MOZ_DLL_PREFIX/MOZ_DLL_SUFFIX and change all define-related uses of
DLL_PREFIX/DLL_SUFFIX to use their MOZ-equivalents instead.
This commit is contained in:
Ted Mielczarek 2018-09-11 13:31:20 -04:00
Родитель 9c2f4d30ba
Коммит d59bc31677
11 изменённых файлов: 20 добавлений и 30 удалений

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

@ -906,9 +906,9 @@ OSFileConstantsService::DefineOSFileConstants(JSContext* aCx,
// On other platforms, libxul is a library "xul" with regular
// library prefix/suffix.
nsAutoString libxul;
libxul.AppendLiteral(DLL_PREFIX);
libxul.AppendLiteral(MOZ_DLL_PREFIX);
libxul.AppendLiteral("xul");
libxul.AppendLiteral(DLL_SUFFIX);
libxul.AppendLiteral(MOZ_DLL_SUFFIX);
#endif // defined(XP_MACOSX)
if (!SetStringProperty(aCx, objPath, "libxul", libxul)) {
@ -953,14 +953,14 @@ OSFileConstantsService::DefineOSFileConstants(JSContext* aCx,
nsAutoString libsqlite3;
#if defined(ANDROID)
// On Android, we use the system's libsqlite3
libsqlite3.AppendLiteral(DLL_PREFIX);
libsqlite3.AppendLiteral(MOZ_DLL_PREFIX);
libsqlite3.AppendLiteral("sqlite3");
libsqlite3.AppendLiteral(DLL_SUFFIX);
libsqlite3.AppendLiteral(MOZ_DLL_SUFFIX);
#elif defined(XP_WIN)
// On Windows, for some reason, this is part of nss3.dll
libsqlite3.AppendLiteral(DLL_PREFIX);
libsqlite3.AppendLiteral(MOZ_DLL_PREFIX);
libsqlite3.AppendLiteral("nss3");
libsqlite3.AppendLiteral(DLL_SUFFIX);
libsqlite3.AppendLiteral(MOZ_DLL_SUFFIX);
#else
// On other platforms, we link sqlite3 into libxul
libsqlite3 = libxul;

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

@ -95,8 +95,5 @@ LOCAL_INCLUDES += [
'/xpcom/base',
]
DEFINES['DLL_PREFIX'] = '"%s"' % CONFIG['DLL_PREFIX']
DEFINES['DLL_SUFFIX'] = '"%s"' % CONFIG['DLL_SUFFIX']
MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
MOCHITEST_MANIFESTS += ['tests/mochitest.ini']

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

@ -223,8 +223,7 @@ include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
for var in ('MOZ_CHILD_PROCESS_NAME', 'MOZ_CHILD_PROCESS_BUNDLE',
'DLL_PREFIX', 'DLL_SUFFIX'):
for var in ('MOZ_CHILD_PROCESS_NAME', 'MOZ_CHILD_PROCESS_BUNDLE'):
DEFINES[var] = '"%s"' % CONFIG[var]
if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':

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

@ -76,9 +76,9 @@ Library::Name(JSContext* cx, unsigned argc, Value* vp)
}
AutoString resultString;
AppendString(cx, resultString, DLL_PREFIX);
AppendString(cx, resultString, MOZ_DLL_PREFIX);
AppendString(cx, resultString, str);
AppendString(cx, resultString, DLL_SUFFIX);
AppendString(cx, resultString, MOZ_DLL_SUFFIX);
if (!resultString)
return false;
auto resultStr = resultString.finish();

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

@ -741,8 +741,6 @@ DEFINES['EXPORT_JS_API'] = True
if CONFIG['JS_HAS_CTYPES']:
DEFINES['JS_HAS_CTYPES'] = True
for var in ('DLL_PREFIX', 'DLL_SUFFIX'):
DEFINES[var] = '"%s"' % CONFIG[var]
if CONFIG['MOZ_LINKER']:
DEFINES['MOZ_LINKER'] = True

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

@ -237,6 +237,7 @@ set_config('OBJ_SUFFIX', library_name_info.obj.suffix)
# Lots of compilation tests depend on this variable being present.
add_old_configure_assignment('OBJ_SUFFIX', library_name_info.obj.suffix)
set_config('IMPORT_LIB_SUFFIX', library_name_info.import_lib.suffix)
set_define('MOZ_DLL_PREFIX', depends(library_name_info.dll.prefix)(lambda s: '"%s"' % s))
set_define('MOZ_DLL_SUFFIX', depends(library_name_info.dll.suffix)(lambda s: '"%s"' % s))
# Depends on host_library_name_info, so needs to go here.

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

@ -1188,7 +1188,7 @@ LoadLoadableRoots(const nsCString& dir)
int unusedModType;
Unused << SECMOD_DeleteModule(kRootModuleName, &unusedModType);
// Some NSS command-line utilities will load a roots module under the name
// "Root Certs" if there happens to be a `DLL_PREFIX "nssckbi" DLL_SUFFIX`
// "Root Certs" if there happens to be a `MOZ_DLL_PREFIX "nssckbi" MOZ_DLL_SUFFIX`
// file in the directory being operated on. In some cases this can cause us to
// fail to load our roots module. In these cases, deleting the "Root Certs"
// module allows us to load the correct one. See bug 1406396.
@ -1199,7 +1199,7 @@ LoadLoadableRoots(const nsCString& dir)
fullLibraryPath.Assign(dir);
fullLibraryPath.AppendLiteral(FILE_PATH_SEPARATOR);
}
fullLibraryPath.Append(DLL_PREFIX "nssckbi" DLL_SUFFIX);
fullLibraryPath.Append(MOZ_DLL_PREFIX "nssckbi" MOZ_DLL_SUFFIX);
// Escape the \ and " characters.
fullLibraryPath.ReplaceSubstring("\\", "\\\\");
fullLibraryPath.ReplaceSubstring("\"", "\\\"");

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

@ -44,9 +44,6 @@ if not CONFIG['NSS_NO_EV_CERTS']:
'ExtendedValidation.cpp',
]
for var in ('DLL_PREFIX', 'DLL_SUFFIX'):
DEFINES[var] = '"%s"' % CONFIG[var]
LOCAL_INCLUDES += [
'/security/manager/ssl',
'/security/pkix/include',

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

@ -105,11 +105,11 @@ PKCS11ModuleDB::AddModule(const nsAString& aModuleName,
// "Root Certs" is the name some NSS command-line utilities will give the
// roots module if they decide to load it when there happens to be a
// `DLL_PREFIX "nssckbi" DLL_SUFFIX` file in the directory being operated on.
// This causes failures, so as a workaround, the PSM initialization code will
// unconditionally remove any module named "Root Certs". We should prevent the
// user from adding an unrelated module named "Root Certs" in the first place
// so PSM doesn't delete it. See bug 1406396.
// `MOZ_DLL_PREFIX "nssckbi" MOZ_DLL_SUFFIX` file in the directory being
// operated on. This causes failures, so as a workaround, the PSM
// initialization code will unconditionally remove any module named "Root
// Certs". We should prevent the user from adding an unrelated module named
// "Root Certs" in the first place so PSM doesn't delete it. See bug 1406396.
if (aModuleName.EqualsLiteral("Root Certs")) {
return NS_ERROR_ILLEGAL_VALUE;
}

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

@ -196,8 +196,6 @@ if CONFIG['NSS_DISABLE_DBM']:
DEFINES['SSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES'] = 'True'
DEFINES['NSS_ENABLE_ECC'] = 'True'
for var in ('DLL_PREFIX', 'DLL_SUFFIX'):
DEFINES[var] = '"%s"' % CONFIG[var]
if not CONFIG['MOZ_SYSTEM_NSS']:
USE_LIBS += [

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

@ -983,12 +983,12 @@ nsNSSComponent::CheckForSmartCardChanges()
}
// Returns by reference the path to the directory containing the file that has
// been loaded as DLL_PREFIX nss3 DLL_SUFFIX.
// been loaded as MOZ_DLL_PREFIX nss3 MOZ_DLL_SUFFIX.
static nsresult
GetNSS3Directory(nsCString& result)
{
UniquePRString nss3Path(
PR_GetLibraryFilePathname(DLL_PREFIX "nss3" DLL_SUFFIX,
PR_GetLibraryFilePathname(MOZ_DLL_PREFIX "nss3" MOZ_DLL_SUFFIX,
reinterpret_cast<PRFuncPtr>(NSS_Initialize)));
if (!nss3Path) {
MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nss not loaded?"));
@ -1068,7 +1068,7 @@ LoadLoadableRootsTask::LoadLoadableRoots()
// but also ensure the library is at least the version we expect.
Vector<nsCString> possibleCKBILocations;
// First try in the directory where we've already loaded
// DLL_PREFIX nss3 DLL_SUFFIX, since that's likely to be correct.
// MOZ_DLL_PREFIX nss3 MOZ_DLL_SUFFIX, since that's likely to be correct.
nsAutoCString nss3Dir;
nsresult rv = GetNSS3Directory(nss3Dir);
if (NS_SUCCEEDED(rv)) {