tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

moz.build (3438B)


      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         "synchronization",
     91     ]
     92 
     93 OS_LIBS += CONFIG["LIBATOMIC_LIBS"]
     94 
     95 if CONFIG["TARGET_OS"] == "iOS":
     96     OS_LIBS += ["-framework BrowserEngineCore"]
     97 
     98 OS_LIBS += CONFIG["REALTIME_LIBS"]
     99 
    100 NO_EXPAND_LIBS = True
    101 
    102 DIST_INSTALL = True
    103 
    104 # JS developers want this to run even if tests are disabled. It may be worth
    105 # considering moving the check to `mach lint` at some point.
    106 if CONFIG["ENABLE_TESTS"] or CONFIG["JS_STANDALONE"]:
    107     # Run SpiderMonkey style checker after linking the static library. This avoids
    108     # running the script for no-op builds.
    109     GeneratedFile(
    110         "spidermonkey_checks",
    111         script="/config/run_spidermonkey_checks.py",
    112         inputs=[
    113             "!%sjs_static.%s" % (CONFIG["LIB_PREFIX"], CONFIG["LIB_SUFFIX"]),
    114             "/config/check_spidermonkey_style.py",
    115             "/config/check_macroassembler_style.py",
    116             "/config/check_js_opcode.py",
    117         ],
    118     )
    119 
    120 if CONFIG["NM"]:
    121     # check_vanilla_allocations.py is tailored to Linux, so only run it there.
    122     # That should be enough to catch any problems.
    123     LegacyTest(
    124         f"%{CONFIG['PYTHON3']}",
    125         "/config/check_vanilla_allocations.py",
    126         f"!lib{STATIC_LIBRARY_NAME}.a",
    127     )