Index: build/premake/extern_libs5.lua =================================================================== --- build/premake/extern_libs5.lua +++ build/premake/extern_libs5.lua @@ -586,7 +586,7 @@ compile_settings = function() if _OPTIONS["with-system-mozjs"] then if not _OPTIONS["android"] then - pkgconfig.add_includes("mozjs-60") + pkgconfig.add_includes("mozjs-68") end else if os.istarget("windows") then @@ -606,15 +606,15 @@ link_settings = function() if _OPTIONS["with-system-mozjs"] then if _OPTIONS["android"] then - links { "mozjs-60" } + links { "mozjs-68" } else - pkgconfig.add_links("mozjs-60") + pkgconfig.add_links("mozjs-68") end else filter { "Debug" } - links { "mozjs60-ps-debug" } + links { "mozjs68-ps-debug" } filter { "Release" } - links { "mozjs60-ps-release" } + links { "mozjs68-ps-release" } filter { } add_source_lib_paths("spidermonkey") end Index: build/workspaces/clean-workspaces.sh =================================================================== --- build/workspaces/clean-workspaces.sh +++ build/workspaces/clean-workspaces.sh @@ -36,11 +36,12 @@ (cd ../../libraries/source/spidermonkey && rm -rf ./lib) (cd ../../libraries/source/spidermonkey && rm -rf ./include-unix-debug) (cd ../../libraries/source/spidermonkey && rm -rf ./include-unix-release) - (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-62.9.1) + (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-68.12.1) fi # Still delete the directory of previous SpiderMonkey versions to # avoid wasting disk space if people clean workspaces after updating. +(cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-62.9.1) (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-52.9.1pre1) (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-45.0.2) (cd ../../libraries/source/spidermonkey && rm -rf ./mozjs-38.0.0) Index: libraries/source/spidermonkey/FixBindgenClang.diff =================================================================== --- /dev/null +++ libraries/source/spidermonkey/FixBindgenClang.diff @@ -0,0 +1,492 @@ + +# HG changeset patch +# User Mike Hommey +# Date 1559702900 0 +# Node ID ccd1356fc8f1d0bfa9d896e88d3cc924425623da +# Parent b26eb4a5540b3bf21b0e0eb91e975cb69c4462b1 +Bug 1526857 - Improve bindgen configuration wrt clang. r=chmanchester + +The current setup for bindgen relies on either finding clang/libclang +from the output of llvm-config, or from the paths given via the +configure flags --with-clang-path/--with-libclang-path. + +One _very_ common problem is that the llvm-config we end up using does +not correspond to the clang used for compilation, which has some +undesirable side effect, like failing to build. + +So instead of relying on llvm-config, we do the following: +- when the compiler is clang, we just use that +- when the compiler is clang-cl, we use clang from the same directory +- otherwise, we either try to find clang in PATH, or rely on + --with-clang-path. + +Once clang is found, we try to deduce the location of the corresponding +libclang via the output of `clang -print-search-dirs`, or rely on +--with-libclang-path. + +Differential Revision: https://phabricator.services.mozilla.com/D33241 + +diff --git a/build/moz.configure/bindgen.configure b/build/moz.configure/bindgen.configure +--- a/build/moz.configure/bindgen.configure ++++ b/build/moz.configure/bindgen.configure +@@ -63,220 +63,158 @@ set_config('CBINDGEN', cbindgen) + + # Bindgen can use rustfmt to format Rust file, but it's not required. + js_option(env='RUSTFMT', nargs=1, help='Path to the rustfmt program') + + rustfmt = check_prog('RUSTFMT', ['rustfmt'], paths=toolchain_search_path, + input='RUSTFMT', allow_missing=True) + + +-# We support setting up the appropriate options for bindgen via setting +-# LLVM_CONFIG or by providing explicit configure options. The Windows +-# installer of LLVM/Clang doesn't provide llvm-config, so we need both +-# methods to support all of our tier-1 platforms. +-@depends(host) +-@imports('os') +-def llvm_config_paths(host): +- llvm_supported_versions = ['6.0', '5.0', '4.0', '3.9'] +- llvm_config_progs = [] +- for version in llvm_supported_versions: +- llvm_config_progs += [ +- 'llvm-config-%s' % version, +- 'llvm-config-mp-%s' % version, # MacPorts' chosen naming scheme. +- 'llvm-config%s' % version.replace('.', ''), +- ] +- llvm_config_progs.append('llvm-config') +- +- # Homebrew on macOS doesn't make clang available on PATH, so we have to +- # look for it in non-standard places. +- if host.kernel == 'Darwin': +- brew = find_program('brew') +- if brew: +- brew_config = check_cmd_output(brew, 'config').strip() +- +- for line in brew_config.splitlines(): +- if line.startswith('HOMEBREW_PREFIX'): +- fields = line.split(None, 2) +- prefix = fields[1] if len(fields) == 2 else '' +- path = ['opt', 'llvm', 'bin', 'llvm-config'] +- llvm_config_progs.append(os.path.join(prefix, *path)) +- break +- +- # Also add in the location to which `mach bootstrap` or +- # `mach artifact toolchain` installs clang. +- mozbuild_state_dir = os.environ.get('MOZBUILD_STATE_PATH', +- os.path.expanduser(os.path.join('~', '.mozbuild'))) +- bootstrap_llvm_config = os.path.join(mozbuild_state_dir, 'clang', 'bin', 'llvm-config') +- +- llvm_config_progs.append(bootstrap_llvm_config) +- +- return llvm_config_progs +- +-js_option(env='LLVM_CONFIG', nargs=1, help='Path to llvm-config') +- +-llvm_config = check_prog('LLVM_CONFIG', llvm_config_paths, input='LLVM_CONFIG', +- what='llvm-config', allow_missing=True) +- + js_option('--with-libclang-path', nargs=1, + help='Absolute path to a directory containing Clang/LLVM libraries for bindgen (version 3.9.x or above)') + js_option('--with-clang-path', nargs=1, + help='Absolute path to a Clang binary for bindgen (version 3.9.x or above)') + +-def invoke_llvm_config(llvm_config, *options): +- '''Invoke llvm_config with the given options and return the first line of +- output.''' +- lines = check_cmd_output(llvm_config, *options).splitlines() +- return lines[0] + +-@imports(_from='textwrap', _import='dedent') +-def check_minimum_llvm_config_version(llvm_config): +- version = Version(invoke_llvm_config(llvm_config, '--version')) +- min_version = Version('3.9.0') +- if version < min_version: +- die(dedent('''\ +- llvm installation {} is incompatible with bindgen. ++@depends('--with-clang-path', c_compiler, cxx_compiler, toolchain_search_path, ++ target, macos_sdk) ++@checking('for clang for bindgen', lambda x: x.path if x else 'not found') ++def bindgen_clang_compiler(clang_path, c_compiler, cxx_compiler, ++ toolchain_search_path, target, macos_sdk): ++ # When the target compiler is clang, use that, including flags. ++ if cxx_compiler.type == 'clang': ++ if clang_path and clang_path[0] not in (c_compiler.compiler, ++ cxx_compiler.compiler): ++ die('--with-clang-path is not valid when the target compiler is %s', ++ cxx_compiler.type) ++ return namespace( ++ path=cxx_compiler.compiler, ++ flags=cxx_compiler.flags, ++ ) ++ # When the target compiler is clang-cl, use clang in the same directory, ++ # and figure the right flags to use. ++ if cxx_compiler.type == 'clang-cl': ++ if clang_path and os.path.dirname(clang_path[0]) != \ ++ os.path.dirname(cxx_compiler.compiler): ++ die('--with-clang-path must point to clang in the same directory ' ++ 'as the target compiler') ++ if not clang_path: ++ clang_path = [os.path.join(os.path.dirname(cxx_compiler.compiler), ++ 'clang')] + +- Please install version {} or greater of Clang + LLVM +- and ensure that the 'llvm-config' from that +- installation is first on your path. ++ clang_path = find_program(clang_path[0] if clang_path else 'clang++', ++ toolchain_search_path) ++ if not clang_path: ++ return ++ flags = prepare_flags(target, macos_sdk) ++ info = check_compiler([clang_path] + flags, 'C++', target) ++ return namespace( ++ path=clang_path, ++ flags=flags + info.flags, ++ ) + +- You can verify this by typing 'llvm-config --version'. +- '''.format(version, min_version))) + +-@depends(llvm_config, '--with-libclang-path', '--with-clang-path', +- host_library_name_info, host, build_project) +-@imports('os.path') ++@depends('--with-libclang-path', bindgen_clang_compiler, ++ host_library_name_info, host) ++@checking('for libclang for bindgen', lambda x: x if x else 'not found') + @imports('glob') +-@imports(_from='textwrap', _import='dedent') +-def bindgen_config_paths(llvm_config, libclang_path, clang_path, +- library_name_info, host, build_project): +- def search_for_libclang(path): +- # Try to ensure that the clang shared library that bindgen is going +- # to look for is actually present. The files that we search for +- # mirror the logic in clang-sys/build.rs. +- libclang_choices = [] +- if host.os == 'WINNT': +- libclang_choices.append('libclang.dll') +- libclang_choices.append('%sclang%s' % (library_name_info.dll.prefix, +- library_name_info.dll.suffix)) +- if host.kernel == 'Linux': +- libclang_choices.append('libclang.so.1') ++@imports(_from='os', _import='pathsep') ++@imports(_from='os.path', _import='split', _as='pathsplit') ++@imports('re') ++def bindgen_libclang_path(libclang_path, clang, library_name_info, host): ++ if not clang: ++ if libclang_path: ++ die('--with-libclang-path is not valid without a clang compiler ' ++ 'for bindgen') ++ return ++ ++ # Try to ensure that the clang shared library that bindgen is going ++ # to look for is actually present. The files that we search for ++ # mirror the logic in clang-sys/build.rs. ++ libclang_choices = [] ++ if host.os == 'WINNT': ++ libclang_choices.append('libclang.dll') ++ libclang_choices.append('%sclang%s' % (library_name_info.dll.prefix, ++ library_name_info.dll.suffix)) ++ if host.kernel == 'Linux': ++ libclang_choices.append('libclang.so.1') ++ ++ if host.os == 'OpenBSD': ++ libclang_choices.append('libclang.so.*.*') + +- if host.os == 'OpenBSD': +- libclang_choices = glob.glob(path + '/libclang.so.*.*') ++ candidates = [] ++ if not libclang_path: ++ # Try to find libclang_path based on clang search dirs. ++ clang_search_dirs = check_cmd_output(clang.path, '-print-search-dirs') ++ for line in clang_search_dirs.splitlines(): ++ name, _, value = line.partition(': =') ++ if host.os == 'WINNT' and name == 'programs': ++ # On Windows, libclang.dll is in bin/ rather than lib/, ++ # so scan the programs search dirs. ++ # To make matters complicated, clang before version 9 uses `:` ++ # separate between paths (and `;` in newer versions) ++ if pathsep in value: ++ dirs = value.split(pathsep) ++ else: ++ for part in value.split(':'): ++ # Assume that if previous "candidate" was of length 1, ++ # it's a drive letter and the current part is the rest of ++ # the corresponding full path. ++ if candidates and len(candidates[-1]) == 1: ++ candidates[-1] += ':' + part ++ else: ++ candidates.append(part) ++ elif host.os != 'WINNT' and name == 'libraries': ++ # On other platforms, use the directories from the libraries ++ # search dirs that looks like $something/clang/$version. ++ for dir in value.split(pathsep): ++ dir, version = pathsplit(dir) ++ if re.match(r'[0-9.]+', version): ++ dir, name = pathsplit(dir) ++ if name == 'clang': ++ candidates.append(dir) ++ else: ++ candidates.append(libclang_path[0]) + +- # At least one of the choices must be found. +- for choice in libclang_choices: +- libclang = os.path.join(path, choice) +- if os.path.exists(libclang): +- return (libclang, None) +- else: +- return (None, list(set(libclang_choices))) ++ for dir in candidates: ++ for pattern in libclang_choices: ++ log.debug('Trying "%s" in "%s"', pattern, dir) ++ libs = glob.glob(os.path.join(dir, pattern)) ++ if libs: ++ return libs[0] + ++ ++@depends(bindgen_clang_compiler, bindgen_libclang_path, build_project) ++def bindgen_config_paths(clang, libclang, build_project): + # XXX: we want this code to be run for both Gecko and JS, but we don't + # necessarily want to force a bindgen/Rust dependency on JS just yet. + # Actually, we don't want to force an error if we're not building the + # browser generally. We therefore whitelist the projects that require + # bindgen facilities at this point and leave it at that. +- bindgen_projects = ('browser', 'mobile/android') +- +- if not libclang_path and not clang_path: +- # We must have LLVM_CONFIG in this case. +- if not llvm_config: +- if build_project not in bindgen_projects: +- return namespace() +- +- die(dedent('''\ +- Could not find LLVM/Clang installation for compiling bindgen. +- Please specify the 'LLVM_CONFIG' environment variable +- (recommended), pass the '--with-libclang-path' and '--with-clang-path' +- options to configure, or put 'llvm-config' in your PATH. Altering your +- PATH may expose 'clang' as well, potentially altering your compiler, +- which may not be what you intended.''')) +- +- check_minimum_llvm_config_version(llvm_config) +- libclang_arg = '--bindir' if host.os == 'WINNT' else '--libdir' +- libclang_path = invoke_llvm_config(llvm_config, libclang_arg) +- clang_path = os.path.join(invoke_llvm_config(llvm_config, '--bindir'), +- 'clang') +- libclang_path = normsep(libclang_path) +- clang_path = normsep(clang_path) ++ if build_project in ('browser', 'mobile/android'): ++ if not clang: ++ die('Could not find clang to generate run bindings for C/C++. ' ++ 'Please install the necessary packages, run `mach bootstrap`, ' ++ 'or use --with-clang-path to give the location of clang.') + +- # Debian-based distros, at least, can have llvm-config installed +- # but not have other packages installed. Since the user is trying +- # to use their system packages, we can't be more specific about what +- # they need. +- clang_resolved = find_program(clang_path) +- if not clang_resolved: +- die(dedent('''\ +- The file {} returned by `llvm-config {}` does not exist. +- clang is required to build Firefox. Please install the +- necessary packages, or run `mach bootstrap`. +- '''.format(clang_path, '--bindir'))) ++ if not libclang: ++ die('Could not find libclang to generate rust bindings for C/C++. ' ++ 'Please install the necessary packages, run `mach bootstrap`, ' ++ 'or use --with-libclang-path to give the path containing it.') + +- if not os.path.exists(libclang_path): +- die(dedent('''\ +- The directory {} returned by `llvm-config {}` does not exist. +- clang is required to build Firefox. Please install the +- necessary packages, or run `mach bootstrap`. +- '''.format(libclang_path, libclang_arg))) +- +- (libclang, searched) = search_for_libclang(libclang_path) +- if not libclang: +- die(dedent('''\ +- Could not find the clang shared library in the path {} +- returned by `llvm-config {}` (searched for files {}). +- clang is required to build Firefox. Please install the +- necessary packages, or run `mach bootstrap`. +- '''.format(libclang_path, libclang_arg, searched))) +- ++ if clang and libclang: + return namespace( + libclang=libclang, +- libclang_path=libclang_path, +- clang_path=clang_resolved, ++ libclang_path=os.path.dirname(libclang), ++ clang_path=clang.path, ++ clang_flags=clang.flags, + ) + +- if (not libclang_path and clang_path) or \ +- (libclang_path and not clang_path): +- if build_project not in bindgen_projects: +- return namespace() + +- die(dedent('''\ +- You must provide both of --with-libclang-path and --with-clang-path +- or neither of them.''')) +- +- libclang_path = libclang_path[0] +- clang_path = clang_path[0] +- +- if not os.path.exists(libclang_path) or \ +- not os.path.isdir(libclang_path): +- die(dedent('''\ +- The argument to --with-libclang-path is not a directory: {} +- '''.format(libclang_path))) +- +- (libclang, searched) = search_for_libclang(libclang_path) +- if not libclang: +- die(dedent('''\ +- Could not find the clang shared library in the path {} +- specified by --with-libclang-path (searched for files {}). +- '''.format(libclang_path, searched))) +- +- clang_resolved = find_program(clang_path) +- if not clang_resolved: +- die(dedent('''\ +- The argument to --with-clang-path is not a file: {} +- '''.format(clang_path))) +- +- return namespace( +- libclang=libclang, +- libclang_path=libclang_path, +- clang_path=clang_resolved, +- ) +- +-@depends(bindgen_config_paths.libclang) ++@depends(bindgen_config_paths.libclang, when=bindgen_config_paths) + @checking('that libclang is new enough', lambda s: 'yes' if s else 'no') + @imports(_from='ctypes', _import='CDLL') + @imports(_from='textwrap', _import='dedent') + def min_libclang_version(libclang): + try: + lib = CDLL(libclang.encode('utf-8')) + # We want at least 4.0. The API we test below is enough for that. + # Just accessing it should throw if not found. +@@ -292,19 +230,19 @@ def min_libclang_version(libclang): + return False + + + set_config('MOZ_LIBCLANG_PATH', bindgen_config_paths.libclang_path) + set_config('MOZ_CLANG_PATH', bindgen_config_paths.clang_path) + + + @depends(target, target_is_unix, cxx_compiler, bindgen_cflags_android, +- bindgen_config_paths.clang_path, macos_sdk) ++ bindgen_config_paths.clang_flags) + def basic_bindgen_cflags(target, is_unix, compiler_info, android_cflags, +- clang_path, macos_sdk): ++ clang_flags): + args = [ + '-x', 'c++', '-fno-sized-deallocation', + '-DTRACING=1', '-DIMPL_LIBXUL', '-DMOZILLA_INTERNAL_API', + '-DRUST_BINDGEN' + ] + + if is_unix: + args += ['-DOS_POSIX=1'] +@@ -334,30 +272,17 @@ def basic_bindgen_cflags(target, is_unix + # static_assert(). + '-D_CRT_USE_BUILTIN_OFFSETOF', + # Enable hidden attribute (which is not supported by MSVC and + # thus not enabled by default with a MSVC-compatibile build) + # to exclude hidden symbols from the generated file. + '-DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1', + ] + +- # We want to pass the same base flags as we'd pass clang. +- # check_compiler from toolchain.configure gives us that. +- # XXX: We should actually use the compiler from toolchain.configure. +- # See bug 1526857. +- info = check_compiler([clang_path], 'C++', target) +- +- args += info.flags +- +- # XXX We wouldn't have to do this if we were using the compiler from +- # toolchain.configure, rather than just `check_compiler`. +- if macos_sdk and target.os == 'OSX': +- args += ['-isysroot', macos_sdk] +- +- return args ++ return args + (clang_flags or []) + + + js_option(env='BINDGEN_CFLAGS', + nargs=1, + help='Options bindgen should pass to the C/C++ parser') + + + @depends(basic_bindgen_cflags, 'BINDGEN_CFLAGS') +diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure +--- a/build/moz.configure/toolchain.configure ++++ b/build/moz.configure/toolchain.configure +@@ -891,16 +891,22 @@ def provided_program(env_var): + wrapper=without_flags[:-1], + program=without_flags[-1], + flags=cmd[len(without_flags):], + ) + + return provided + + ++def prepare_flags(host_or_target, macos_sdk): ++ if macos_sdk and host_or_target.os == 'OSX': ++ return ['-isysroot', macos_sdk] ++ return [] ++ ++ + @template + def compiler(language, host_or_target, c_compiler=None, other_compiler=None, + other_c_compiler=None): + '''Template handling the generic base checks for the compiler for the + given `language` on the given platform (`host_or_target`). + `host_or_target` is either `host` or `target` (the @depends functions + from init.configure. + When the language is 'C++', `c_compiler` is the result of the `compiler` +@@ -969,18 +975,18 @@ def compiler(language, host_or_target, c + # --with-ccache. + if provided_wrapper[:len(wrapper)] == wrapper: + provided_wrapper = provided_wrapper[len(wrapper):] + wrapper.extend(provided_wrapper) + flags = provided_compiler.flags + else: + flags = [] + +- if not flags and macos_sdk and host_or_target.os == 'OSX': +- flags = ['-isysroot', macos_sdk] ++ if not flags: ++ flags = prepare_flags(host_or_target, macos_sdk) + + info = check_compiler(wrapper + [compiler] + flags, language, + host_or_target) + + # Check that the additional flags we got are enough to not require any + # more flags. If we get an exception, just ignore it; it's liable to be + # invalid command-line flags, which means the compiler we're checking + # doesn't support those command-line flags and will fail one or more of +diff --git a/build/unix/mozconfig.unix b/build/unix/mozconfig.unix +--- a/build/unix/mozconfig.unix ++++ b/build/unix/mozconfig.unix +@@ -4,16 +4,17 @@ TOOLTOOL_DIR=${TOOLTOOL_DIR:-$topsrcdir} + + if [ -n "$FORCE_GCC" ]; then + CC="$TOOLTOOL_DIR/gcc/bin/gcc" + CXX="$TOOLTOOL_DIR/gcc/bin/g++" + + # We want to make sure we use binutils and other binaries in the tooltool + # package. + mk_add_options "export PATH=$TOOLTOOL_DIR/gcc/bin:$PATH" ++ ac_add_options --with-clang-path=$TOOLTOOL_DIR/clang/bin/clang + else + CC="$TOOLTOOL_DIR/clang/bin/clang" + CXX="$TOOLTOOL_DIR/clang/bin/clang++" + export ENABLE_CLANG_PLUGIN=1 + case "$PERFHERDER_EXTRA_OPTIONS" in + base-toolchains*) + # Clang versions < 7.0 don't support the -fcrash-diagnostics-dir flag. + ;; +diff --git a/taskcluster/scripts/builder/hazard-analysis.sh b/taskcluster/scripts/builder/hazard-analysis.sh Index: libraries/source/spidermonkey/FixPublicExport.diff =================================================================== --- /dev/null +++ libraries/source/spidermonkey/FixPublicExport.diff @@ -0,0 +1,21 @@ +--- a/js/public/AllocPolicy.h ++++ b/js/public/AllocPolicy.h +@@ -107,7 +107,7 @@ + * Non-inline helper to call JSRuntime::onOutOfMemory with minimal + * code bloat. + */ +- JS_FRIEND_API void* onOutOfMemory(arena_id_t arenaId, AllocFunction allocFunc, ++ void* onOutOfMemory(arena_id_t arenaId, AllocFunction allocFunc, + size_t nbytes, void* reallocPtr = nullptr); + + template +@@ -172,7 +172,7 @@ + js_free(p); + } + +- JS_FRIEND_API void reportAllocOverflow() const; ++ void reportAllocOverflow() const; + + bool checkSimulatedOOM() const { + if (js::oom::ShouldFailWithOOM()) { + Index: libraries/source/spidermonkey/README.txt =================================================================== --- libraries/source/spidermonkey/README.txt +++ libraries/source/spidermonkey/README.txt @@ -28,8 +28,15 @@ We provide precompiled binaries for Windows. If you still need to build on Windows, here's a short guide. -Setting up the build environment: -1. Go to https://firefox-source-docs.mozilla.org/setup/windows_build.html#mozillabuild -2. Download the latest mozbuild package and install it to C:/mozilla-build (default). -3. Run MozillaBuild 3.x (start-shell.bat) -4. cd to the build.sh directory and run ./build.sh +The basic idea is to follow the instructions to build Firefox: +https://firefox-source-docs.mozilla.org/setup/windows_build.html#mozillabuild +And after running "mach boostrap", run ./build.sh + +The customised option (which I used): +- Install mozilla-build per the instructions above +- Install rust (make sure to add it to your PATH) +- Open Powershell and run "rustup install i686-pc-windows-msvc" and "rustup install x86_64-pc-windows-msvc" +- Install LLVM 8 prebuilt binaries from https://releases.llvm.org somewhere (the script plans for C:/Program Files/LLVM) +- From powershell, run ". C:/mozilla-build/start-shell.bat", cd to 0ad/libraries/source/spidermonkey and then run "./build.sh" + +At that point, everything should be setup and run correctly. Index: libraries/source/spidermonkey/RenameLibs.diff =================================================================== --- libraries/source/spidermonkey/RenameLibs.diff +++ libraries/source/spidermonkey/RenameLibs.diff @@ -2,18 +2,18 @@ index 7d621b52ce..85e2934fa9 100644 --- a/js/src/old-configure +++ b/js/src/old-configure -@@ -10469,12 +10469,12 @@ done +@@ -7013,11 +7013,11 @@ -if test -n "$JS_STANDALONE"; then MOZ_APP_NAME="mozjs" - MOZ_APP_VERSION="$MOZILLA_SYMBOLVERSION" -JS_LIBRARY_NAME="mozjs-$MOZILLA_SYMBOLVERSION" +-else +-JS_LIBRARY_NAME="mozjs" +if test -n "$MOZ_DEBUG"; then +JS_LIBRARY_NAME="mozjs$MOZILLA_SYMBOLVERSION-ps-debug" - else --JS_LIBRARY_NAME="mozjs" ++else +JS_LIBRARY_NAME="mozjs$MOZILLA_SYMBOLVERSION-ps-release" fi JS_CONFIG_LIBS="$NSPR_LIBS $LIBS" Index: libraries/source/spidermonkey/StandardDbgMacro.diff =================================================================== --- /dev/null +++ libraries/source/spidermonkey/StandardDbgMacro.diff @@ -0,0 +1,58 @@ + +# HG changeset patch +# User Jeff Walden +# Date 1582109071 0 +# Node ID 0f4fc4e582d369244c46b28ee9f86d0b02dc9e39 +# Parent 2779aefcb6c5e2d1cedaf974fe67b30fbf7805d0 +Bug 1614243 - Make mfbt/DbgMacro.h use standard variadic macro syntax, not gcc/clang extension syntax. r=froydnj + +Differential Revision: https://phabricator.services.mozilla.com/D63283 + +diff --git a/mfbt/DbgMacro.h b/mfbt/DbgMacro.h +--- a/mfbt/DbgMacro.h ++++ b/mfbt/DbgMacro.h +@@ -167,18 +167,18 @@ std::ostream& operator<<(std::ostream& a + // B b1 = B(); // fine, initializes b1 directly + // + // B b2 = MOZ_DBG(B()); // compile error: MOZ_DBG needs to materialize a + // // temporary for B() so it can be passed to + // // operator<<, but that temporary is returned from + // // MOZ_DBG as an rvalue reference and so wants to + // // invoke B's move constructor to initialize b2 + #ifndef MOZILLA_OFFICIAL +-# define MOZ_DBG(expression_...) \ +- mozilla::detail::MozDbg(__FILE__, __LINE__, #expression_, expression_) ++# define MOZ_DBG(...) \ ++ mozilla::detail::MozDbg(__FILE__, __LINE__, #__VA_ARGS__, __VA_ARGS__) + #endif + + // Helper macro for MOZ_DEFINE_DBG. + #define MOZ_DBG_FIELD(name_) << #name_ << " = " << aValue.name_ + + // Macro to define an operator<<(ostream&) for a struct or class that displays + // the type name and the values of the specified member variables. Must be + // called inside the struct or class. +@@ -189,18 +189,18 @@ std::ostream& operator<<(std::ostream& a + // float x; + // float y; + // + // MOZ_DEFINE_DBG(Point, x, y) + // }; + // + // generates an operator<< that outputs strings like + // "Point { x = 1.0, y = 2.0 }". +-#define MOZ_DEFINE_DBG(type_, members_...) \ ++#define MOZ_DEFINE_DBG(type_, ...) \ + friend std::ostream& operator<<(std::ostream& aOut, const type_& aValue) { \ + return aOut << #type_ \ +- << (MOZ_ARG_COUNT(members_) == 0 ? "" : " { ") \ ++ << (MOZ_ARG_COUNT(__VA_ARGS__) == 0 ? "" : " { ") \ + MOZ_FOR_EACH_SEPARATED(MOZ_DBG_FIELD, (<< ", "), (), \ +- (members_)) \ +- << (MOZ_ARG_COUNT(members_) == 0 ? "" : " }"); \ ++ (__VA_ARGS__)) \ ++ << (MOZ_ARG_COUNT(__VA_ARGS__) == 0 ? "" : " }"); \ + } + + #endif // mozilla_DbgMacro_h + Index: libraries/source/spidermonkey/build.sh =================================================================== --- libraries/source/spidermonkey/build.sh +++ libraries/source/spidermonkey/build.sh @@ -3,10 +3,10 @@ set -e # This should match the version in config/milestone.txt -FOLDER="mozjs-60.9.1" +FOLDER="mozjs-68.12.1" # If same-version changes are needed, increment this. -LIB_VERSION="60.9.1+0" -LIB_NAME="mozjs60-ps" +LIB_VERSION="68.12.1+0" +LIB_NAME="mozjs68-ps" # Since this script is called by update-workspaces.sh, we want to quickly # avoid doing any work if SpiderMonkey is already built and up-to-date. @@ -43,7 +43,13 @@ # to match your environment. if [ "${OS}" = "Windows_NT" ] then - CONF_OPTS="${CONF_OPTS} --enable-nspr-build --with-visual-studio-version=2015" + # On windows, you may either use the full firefox build process (via mach bootstrap) + # or simply install LLVM to some convenient directory and hack the env. + if [ ! -d "~/.mozbuild"]; + then + export MOZBUILD_STATE_PATH="C:/Program Files/LLVM" + fi + CONF_OPTS="${CONF_OPTS} --enable-nspr-build --with-visual-studio-version=2017 --target=i686" else CONF_OPTS="${CONF_OPTS} --enable-posix-nspr-emulation" fi @@ -68,6 +74,13 @@ CONF_OPTS="${CONF_OPTS} --enable-valgrind" fi +# Quick sanity check to print explicit error messages +if [ ! "$(command -v rustc)" ] +then + echo "Error: rustc is not available. Install the rust toolchain before proceeding." + exit 1 +fi + # We need to be able to override CHOST in case it is 32bit userland on 64bit kernel CONF_OPTS="${CONF_OPTS} \ ${CBUILD:+--build=${CBUILD}} \ @@ -86,7 +99,7 @@ then # The tarball is committed to svn, but it's useful to let jenkins download it (when testing upgrade scripts). download="$(command -v wget || echo "curl -L -o "${FOLDER}.tar.bz2"")" - $download "https://github.com/wraitii/spidermonkey-tarballs/releases/download/v60.9.1/${FOLDER}.tar.bz2" + $download "https://github.com/wraitii/spidermonkey-tarballs/releases/download/v68.12.1/${FOLDER}.tar.bz2" fi tar xjf "${FOLDER}.tar.bz2" @@ -105,8 +118,9 @@ mkdir -p build-debug cd build-debug -# SM build scripts check for autoconf, but it isn't actually needed, so just pass something. -CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="false" ${CONF_OPTS} \ +# SM configure checks for autoconf and llvm-objdump, but neither are actually used for building. +# To avoid a dependency, pass something arbitrary (it does need to be an actual program). +CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="ls" LLVM_OBJDUMP="ls" ${CONF_OPTS} \ --enable-debug \ --disable-optimize \ --enable-gczeal @@ -115,7 +129,7 @@ mkdir -p build-release cd build-release -CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="false" ${CONF_OPTS} \ +CXXFLAGS="${CXXFLAGS}" ../js/src/configure AUTOCONF="ls" LLVM_OBJDUMP="ls" ${CONF_OPTS} \ --enable-optimize ${MAKE} ${MAKE_OPTS} cd .. Index: libraries/source/spidermonkey/patch.sh =================================================================== --- libraries/source/spidermonkey/patch.sh +++ libraries/source/spidermonkey/patch.sh @@ -13,3 +13,16 @@ # See https://bugzilla.mozilla.org/show_bug.cgi?id=1644600 # Many thanks to bellaz89 for finding this and reporting it patch -p1 < ../FixSharedArray.diff + +# Fix bindgen trying to use different clang settings. +# https://bugzilla.mozilla.org/show_bug.cgi?id=1526857 (landed in SM69) +patch -p1 < ../FixBindgenClang.diff + +# Fix gcc/clang macro extension +# https://bugzilla.mozilla.org/show_bug.cgi?id=1614243 (landed in SM75) +patch -p1 < ../StandardDbgMacro.diff + +# Fix public export on MSVC (C2487) +# https://bugzilla.mozilla.org/show_bug.cgi?id=1614243 +# (mentionned in the comments, no patch/commit found) +patch -p1 < ../FixPublicExport.diff Index: source/scriptinterface/ScriptTypes.h =================================================================== --- source/scriptinterface/ScriptTypes.h +++ source/scriptinterface/ScriptTypes.h @@ -73,7 +73,7 @@ # pragma GCC diagnostic pop #endif -#if MOZJS_MAJOR_VERSION != 60 +#if MOZJS_MAJOR_VERSION != 68 #error Your compiler is trying to use an incorrect major version of the \ SpiderMonkey library. The only version that works is the one in the \ libraries/spidermonkey/ directory, and it will not work with a typical \ @@ -81,7 +81,7 @@ include paths. #endif -#if MOZJS_MINOR_VERSION != 9 +#if MOZJS_MINOR_VERSION != 12 #error Your compiler is trying to use an untested minor version of the \ SpiderMonkey library. If you are a package maintainer, please make sure \ to check very carefully that this version does not change the behaviour \