| 1 |
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- |
| 2 |
# vim: set filetype=python: |
| 3 |
# This Source Code Form is subject to the terms of the Mozilla Public |
| 4 |
# License, v. 2.0. If a copy of the MPL was not distributed with this |
| 5 |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 6 |
|
| 7 |
CONFIGURE_SUBST_FILES += [ |
| 8 |
"js-config", |
| 9 |
"js.pc", |
| 10 |
] |
| 11 |
|
| 12 |
LIBRARY_DEFINES["EXPORT_JS_API"] = True |
| 13 |
|
| 14 |
# Note: The static standalone js library is currently broken due |
| 15 |
# to static mozglue missing, see bug 1588340 for more information. |
| 16 |
LIBRARY_DEFINES["MOZ_HAS_MOZGLUE"] = True |
| 17 |
|
| 18 |
LIBRARY_DEFINES["MOZ_SUPPORT_LEAKCHECKING"] = True |
| 19 |
|
| 20 |
# JavaScript must be built shared, even for static builds, as it is used by |
| 21 |
# other modules which are always built shared. Failure to do so results in |
| 22 |
# the js code getting copied into xpinstall and jsd as well as mozilla-bin, |
| 23 |
# and then the static data cells used for locking no longer work. |
| 24 |
# |
| 25 |
# In fact, we now build both a static and a shared library, as the |
| 26 |
# JS shell would like to link to the static library. |
| 27 |
|
| 28 |
if CONFIG["JS_SHARED_LIBRARY"]: |
| 29 |
GeckoSharedLibrary("js") |
| 30 |
SHARED_LIBRARY_NAME = CONFIG["JS_LIBRARY_NAME"] |
| 31 |
|
| 32 |
# Ensure symbol versions of shared library on Linux do not conflict |
| 33 |
# with those in libxul. |
| 34 |
if CONFIG["OS_TARGET"] == "Linux": |
| 35 |
GeneratedFile( |
| 36 |
"symverscript", |
| 37 |
script="/build/gen_symverscript.py", |
| 38 |
inputs=["symverscript.in"], |
| 39 |
flags=[CONFIG["JS_LIBRARY_NAME"].replace("-", "_")], |
| 40 |
) |
| 41 |
SYMBOLS_FILE = "!symverscript" |
| 42 |
else: |
| 43 |
Library("js") |
| 44 |
|
| 45 |
FORCE_STATIC_LIB = True |
| 46 |
STATIC_LIBRARY_NAME = "js_static" |
| 47 |
|
| 48 |
if CONFIG["JS_HAS_INTL_API"]: |
| 49 |
USE_LIBS += [ |
| 50 |
"icu", |
| 51 |
] |
| 52 |
|
| 53 |
USE_LIBS += [ |
| 54 |
"fdlibm", |
| 55 |
"nspr", |
| 56 |
] |
| 57 |
|
| 58 |
if not CONFIG["USE_LIBZ_RS"]: |
| 59 |
USE_LIBS += [ |
| 60 |
"zlib", |
| 61 |
] |
| 62 |
|
| 63 |
if CONFIG["OS_ARCH"] != "WINNT": |
| 64 |
OS_LIBS += [ |
| 65 |
"m", |
| 66 |
] |
| 67 |
|
| 68 |
if CONFIG["OS_ARCH"] == "FreeBSD": |
| 69 |
OS_LIBS += [ |
| 70 |
"-pthread", |
| 71 |
] |
| 72 |
|
| 73 |
if CONFIG["OS_ARCH"] == "Linux": |
| 74 |
OS_LIBS += [ |
| 75 |
"dl", |
| 76 |
] |
| 77 |
|
| 78 |
if CONFIG["OS_ARCH"] == "SunOS": |
| 79 |
OS_LIBS += [ |
| 80 |
"posix4", |
| 81 |
"dl", |
| 82 |
"nsl", |
| 83 |
"socket", |
| 84 |
] |
| 85 |
|
| 86 |
if CONFIG["OS_ARCH"] == "WINNT": |
| 87 |
OS_LIBS += [ |
| 88 |
"bcrypt", |
| 89 |
"ntdll", |
| 90 |
] |
| 91 |
# Version string comparison is generally wrong, but by the time it would |
| 92 |
# actually matter, either bug 1489995 would be fixed, or the build would |
| 93 |
# require version >= 1.78. |
| 94 |
if CONFIG["RUSTC_VERSION"] and CONFIG["RUSTC_VERSION"] >= "1.78.0": |
| 95 |
OS_LIBS += [ |
| 96 |
"synchronization", |
| 97 |
] |
| 98 |
|
| 99 |
OS_LIBS += CONFIG["LIBATOMIC_LIBS"] |
| 100 |
|
| 101 |
if CONFIG["TARGET_OS"] == "iOS": |
| 102 |
OS_LIBS += ["-framework BrowserEngineCore"] |
| 103 |
|
| 104 |
OS_LIBS += CONFIG["REALTIME_LIBS"] |
| 105 |
|
| 106 |
NO_EXPAND_LIBS = True |
| 107 |
|
| 108 |
DIST_INSTALL = True |
| 109 |
|
| 110 |
# Run SpiderMonkey style checker after linking the static library. This avoids |
| 111 |
# running the script for no-op builds. |
| 112 |
GeneratedFile( |
| 113 |
"spidermonkey_checks", |
| 114 |
script="/config/run_spidermonkey_checks.py", |
| 115 |
inputs=[ |
| 116 |
"!%sjs_static.%s" % (CONFIG["LIB_PREFIX"], CONFIG["LIB_SUFFIX"]), |
| 117 |
"/config/check_spidermonkey_style.py", |
| 118 |
"/config/check_macroassembler_style.py", |
| 119 |
"/config/check_js_opcode.py", |
| 120 |
], |
| 121 |
) |