# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- # 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/. CONFIGURE_SUBST_FILES += [ "js-config", "js.pc", ] LIBRARY_DEFINES["EXPORT_JS_API"] = True # Note: The static standalone js library is currently broken due # to static mozglue missing, see bug 1588340 for more information. LIBRARY_DEFINES["MOZ_HAS_MOZGLUE"] = True LIBRARY_DEFINES["MOZ_SUPPORT_LEAKCHECKING"] = True # JavaScript must be built shared, even for static builds, as it is used by # other modules which are always built shared. Failure to do so results in # the js code getting copied into xpinstall and jsd as well as mozilla-bin, # and then the static data cells used for locking no longer work. # # In fact, we now build both a static and a shared library, as the # JS shell would like to link to the static library. if CONFIG["JS_SHARED_LIBRARY"]: GeckoSharedLibrary("js") SHARED_LIBRARY_NAME = CONFIG["JS_LIBRARY_NAME"] # Ensure symbol versions of shared library on Linux do not conflict # with those in libxul. if CONFIG["OS_TARGET"] == "Linux": GeneratedFile( "symverscript", script="/build/gen_symverscript.py", inputs=["symverscript.in"], flags=[CONFIG["JS_LIBRARY_NAME"].replace("-", "_")], ) SYMBOLS_FILE = "!symverscript" else: Library("js") FORCE_STATIC_LIB = True STATIC_LIBRARY_NAME = "js_static" if CONFIG["JS_HAS_INTL_API"]: USE_LIBS += [ "icu", ] USE_LIBS += [ "fdlibm", "nspr", ] if not CONFIG["USE_LIBZ_RS"]: USE_LIBS += [ "zlib", ] if CONFIG["OS_ARCH"] != "WINNT": OS_LIBS += [ "m", ] if CONFIG["OS_ARCH"] == "FreeBSD": OS_LIBS += [ "-pthread", ] if CONFIG["OS_ARCH"] == "Linux": OS_LIBS += [ "dl", ] if CONFIG["OS_ARCH"] == "SunOS": OS_LIBS += [ "posix4", "dl", "nsl", "socket", ] if CONFIG["OS_ARCH"] == "WINNT": OS_LIBS += [ "bcrypt", "ntdll", ] # Version string comparison is generally wrong, but by the time it would # actually matter, either bug 1489995 would be fixed, or the build would # require version >= 1.78. if CONFIG["RUSTC_VERSION"] and CONFIG["RUSTC_VERSION"] >= "1.78.0": OS_LIBS += [ "synchronization", ] OS_LIBS += CONFIG["LIBATOMIC_LIBS"] if CONFIG["TARGET_OS"] == "iOS": OS_LIBS += ["-framework BrowserEngineCore"] OS_LIBS += CONFIG["REALTIME_LIBS"] NO_EXPAND_LIBS = True DIST_INSTALL = True # JS developers want this to run even if tests are disabled. It may be worth # considering moving the check to `mach lint` at some point. if CONFIG["ENABLE_TESTS"] or CONFIG["JS_STANDALONE"]: # Run SpiderMonkey style checker after linking the static library. This avoids # running the script for no-op builds. GeneratedFile( "spidermonkey_checks", script="/config/run_spidermonkey_checks.py", inputs=[ "!%sjs_static.%s" % (CONFIG["LIB_PREFIX"], CONFIG["LIB_SUFFIX"]), "/config/check_spidermonkey_style.py", "/config/check_macroassembler_style.py", "/config/check_js_opcode.py", ], ) if CONFIG["NM"]: # check_vanilla_allocations.py is tailored to Linux, so only run it there. # That should be enough to catch any problems. LegacyTest( f"%{CONFIG['PYTHON3']}", "/config/check_vanilla_allocations.py", f"!lib{STATIC_LIBRARY_NAME}.a", )