tor-browser

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

moz.build (4025B)


      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 with Files("**"):
      8     BUG_COMPONENT = ("Firefox Build System", "General")
      9 
     10 with Files("mozunit/**"):
     11     BUG_COMPONENT = ("Testing", "Python Test")
     12 
     13 DIST_INSTALL = False
     14 # For sanity's sake, we compile nsinstall without the wrapped system
     15 # headers, so that we can use it to set up the wrapped system headers.
     16 NoVisibilityFlags()
     17 
     18 CONFIGURE_SUBST_FILES += [
     19     "tests/src-simple/Makefile",
     20 ]
     21 
     22 if CONFIG["HOST_OS_ARCH"] != "WINNT":
     23     HOST_SOURCES += [
     24         "nsinstall.c",
     25         "pathsub.c",
     26     ]
     27     HostProgram("nsinstall_real")
     28 
     29 PYTHON_UNITTEST_MANIFESTS += [
     30     "tests/python.toml",
     31 ]
     32 
     33 if CONFIG["CC_TYPE"] in ("clang", "gcc") and CONFIG["MOZ_OPTIMIZE"]:
     34     CFLAGS += ["-O3"]
     35 
     36 HOST_DEFINES["UNICODE"] = True
     37 HOST_DEFINES["_UNICODE"] = True
     38 
     39 include("stl-headers.mozbuild")
     40 if CONFIG["WRAP_STL_INCLUDES"]:
     41     stl_compiler = None
     42     if CONFIG["OS_TARGET"] == "WINNT":
     43         stl_compiler = "msvc"
     44     else:
     45         stl_compiler = "gcc"
     46 
     47     if stl_compiler:
     48         # Note that the 'stl_wrappers' folder is known to the build system as
     49         # containing generated files; if this is changed here then the code in
     50         # GeneratedFile.__init__ in python/mozbuild/mozbuild/frontend/data.py
     51         # might need to be updated accordingly as well.
     52         template_file = "%s-stl-wrapper.template.h" % stl_compiler
     53         output_dir = "/dist/stl_wrappers"
     54         # We have to use a sentinel file as the first file because the
     55         # file_generate action will create it for us, but we want to create all
     56         # the files in gen_wrappers()
     57         outputs = tuple(
     58             ["stl.sentinel"] + ["%s/%s" % (output_dir, h) for h in stl_headers]
     59         )
     60         GeneratedFile(
     61             *outputs,
     62             script="make-stl-wrappers.py",
     63             entry_point="gen_wrappers",
     64             inputs=[template_file],
     65             flags=[TOPOBJDIR + output_dir, stl_compiler] + stl_headers
     66         )
     67 
     68     # Wrap <windows.h> to make it easier to use correctly
     69     # NOTE: If we aren't wrapping STL includes, we're building part of the browser
     70     # which won't need this wrapper, such as L10N. Just don't try to generate the
     71     # wrapper in that case.
     72     if CONFIG["OS_TARGET"] == "WINNT":
     73         GeneratedFile(
     74             "/dist/stl_wrappers/windows.h",
     75             script="make-windows-h-wrapper.py",
     76             entry_point="generate",
     77             inputs=[
     78                 "windows-h-constant.decls.h",
     79                 "windows-h-unicode.decls.h",
     80                 "windows-h-wrapper.template.h",
     81             ],
     82             flags=[stl_compiler],
     83         )
     84         GeneratedFile(
     85             "/dist/stl_wrappers/shlwapi.h",
     86             script="make-windows-h-wrapper.py",
     87             entry_point="generate",
     88             inputs=[
     89                 "shlwapi-h-constant.decls.h",
     90                 "shlwapi-h-unicode.decls.h",
     91                 "shlwapi-h-wrapper.template.h",
     92             ],
     93             flags=[stl_compiler],
     94         )
     95 
     96 if CONFIG["WRAP_SYSTEM_INCLUDES"]:
     97     include("system-headers.mozbuild")
     98     if CONFIG["ANDROID_SYSTEM_HEADERS"]:
     99         system_headers += CONFIG["ANDROID_SYSTEM_HEADERS"]
    100     output_dir = "/dist/system_wrappers"
    101     outputs = tuple(
    102         ["system-header.sentinel"]
    103         + ["%s/%s" % (output_dir, h) for h in stl_headers + system_headers]
    104     )
    105     GeneratedFile(
    106         *outputs,
    107         script="make-system-wrappers.py",
    108         entry_point="gen_wrappers",
    109         flags=[TOPOBJDIR + output_dir] + stl_headers + system_headers
    110     )
    111 
    112 if CONFIG["COMPILE_ENVIRONMENT"] and CONFIG["CBINDGEN"]:
    113     GeneratedFile(
    114         "cbindgen-metadata.json",
    115         script="/build/RunCbindgen.py",
    116         entry_point="generate_metadata",
    117         inputs=["!/.cargo/config.toml"],
    118     )