| 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 |
GeckoProgram("js", linkage=None) |
| 8 |
if CONFIG["JS_BUNDLED_EDITLINE"]: |
| 9 |
DIRS += ["../editline"] |
| 10 |
USE_LIBS += ["editline"] |
| 11 |
USE_LIBS += ["static:js"] |
| 12 |
|
| 13 |
include("../js-config.mozbuild") |
| 14 |
include("../js-cxxflags.mozbuild") |
| 15 |
include("../js-standalone.mozbuild") |
| 16 |
|
| 17 |
UNIFIED_SOURCES += [ |
| 18 |
"js.cpp", |
| 19 |
"jsoptparse.cpp", |
| 20 |
"jsshell.cpp", |
| 21 |
"ModuleLoader.cpp", |
| 22 |
"OSObject.cpp", |
| 23 |
"ShellModuleObjectWrapper.cpp", |
| 24 |
"WasmTesting.cpp", |
| 25 |
] |
| 26 |
|
| 27 |
if CONFIG["FUZZING_INTERFACES"]: |
| 28 |
UNIFIED_SOURCES += ["jsrtfuzzing/jsrtfuzzing.cpp"] |
| 29 |
if CONFIG["LIBFUZZER"]: |
| 30 |
USE_LIBS += ["static:fuzzer"] |
| 31 |
else: |
| 32 |
USE_LIBS += ["static:fuzzer-interface"] |
| 33 |
|
| 34 |
if CONFIG["FUZZING_JS_FUZZILLI"] and CONFIG["OS_ARCH"] == "Linux": |
| 35 |
OS_LIBS += ["rt"] |
| 36 |
|
| 37 |
DEFINES["EXPORT_JS_API"] = True |
| 38 |
|
| 39 |
LOCAL_INCLUDES += [ |
| 40 |
"!..", |
| 41 |
"..", |
| 42 |
] |
| 43 |
|
| 44 |
OS_LIBS += CONFIG["EDITLINE_LIBS"] |
| 45 |
|
| 46 |
# Place a GDB Python auto-load file next to the shell executable, both in |
| 47 |
# the build directory and in the dist/bin directory. |
| 48 |
FINAL_TARGET_FILES += ["js-gdb.py"] |
| 49 |
OBJDIR_FILES.js.src.shell += ["!/dist/bin/js-gdb.py"] |
| 50 |
|
| 51 |
# People expect the js shell to wind up in the top-level JS dir. |
| 52 |
OBJDIR_FILES.js.src += ["!/dist/bin/js%s" % CONFIG["BIN_SUFFIX"]] |
| 53 |
|
| 54 |
# Stack size on Wasm/WASI |
| 55 |
# ================================== |
| 56 |
# Increase the default stack size (64KB) to 1MB. |
| 57 |
# Also make the stack grow towards 0 so that if SpiderMonkey's stack limiter is buggy, overflow will likely trap. |
| 58 |
if CONFIG["OS_ARCH"] == "WASI": |
| 59 |
LDFLAGS += ["-Wl,-z,stack-size=1048576", "-Wl,--stack-first"] |
| 60 |
OS_LIBS += ["wasi-emulated-process-clocks", "wasi-emulated-getpid"] |
| 61 |
|
| 62 |
# Make JS Shell builds run without LD_LIBRARY_PATH |
| 63 |
if CONFIG["OS_TARGET"] == "Android": |
| 64 |
LDFLAGS += [ |
| 65 |
"-Wl,-rpath=$ORIGIN", |
| 66 |
] |