tor-browser

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

moz.build (4965B)


      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", "General")
      9 
     10 with Files("firefox.exe.manifest"):
     11     BUG_COMPONENT = ("Core", "Widget: Win32")
     12 with Files("module.ver"):
     13     BUG_COMPONENT = ("Core", "Widget: Win32")
     14 with Files("splash.rc"):
     15     BUG_COMPONENT = ("Core", "Widget: Win32")
     16 
     17 with Files("macversion.py"):
     18     BUG_COMPONENT = ("Core", "Widget: Cocoa")
     19 with Files("macbuild/**"):
     20     BUG_COMPONENT = ("Core", "Widget: Cocoa")
     21 
     22 with Files("moz.build"):
     23     BUG_COMPONENT = ("Firefox Build System", "General")
     24 with Files("Makefile.in"):
     25     BUG_COMPONENT = ("Firefox Build System", "General")
     26 
     27 with Files("profile/channel-prefs.js"):
     28     BUG_COMPONENT = ("Firefox", "Installer")
     29 with Files("profile/firefox.js"):
     30     BUG_COMPONENT = ("Firefox", "General")
     31 
     32 if CONFIG["MOZ_MACBUNDLE_NAME"]:
     33     DIRS += ["macbuild/Contents"]
     34 
     35 browser_linkage = "standalone"
     36 if CONFIG["FUZZING_SNAPSHOT"] or CONFIG["AFLFUZZ"]:
     37     browser_linkage = "dependent"
     38 
     39 if CONFIG["MOZ_NO_PIE_COMPAT"]:
     40     GeckoProgram(CONFIG["MOZ_APP_NAME"] + "-bin", linkage=browser_linkage)
     41 
     42     DIRS += ["no-pie"]
     43 else:
     44     GeckoProgram(CONFIG["MOZ_APP_NAME"], linkage=browser_linkage)
     45 
     46 SOURCES += [
     47     "nsBrowserApp.cpp",
     48 ]
     49 
     50 # Neither channel-prefs.js nor firefox.exe want to end up in dist/bin/browser.
     51 DIST_SUBDIR = ""
     52 
     53 LOCAL_INCLUDES += [
     54     "!/build",
     55     "/toolkit/xre",
     56     "/xpcom/base",
     57     "/xpcom/build",
     58 ]
     59 
     60 if CONFIG["LIBFUZZER"]:
     61     USE_LIBS += ["fuzzer"]
     62     LOCAL_INCLUDES += [
     63         "/tools/fuzzing/libfuzzer",
     64     ]
     65 elif CONFIG["FUZZING_INTERFACES"]:
     66     USE_LIBS += ["fuzzer-interface"]
     67 
     68 if CONFIG["MOZ_GECKODRIVER"]:
     69     DEFINES["MOZ_GECKODRIVER"] = True
     70 
     71 if CONFIG["CC_TYPE"] == "clang-cl":
     72     # Always enter a Windows program through wmain, whether or not we're
     73     # a console application.
     74     WIN32_EXE_LDFLAGS += ["-ENTRY:wmainCRTStartup"]
     75 
     76 if CONFIG["OS_ARCH"] == "WINNT":
     77     RCINCLUDE = "splash.rc"
     78     DIRS += [
     79         "installation_dir_layout",
     80         # tor-browser#41798 don't build private_browsing.exe on Windows
     81         # "pbproxy",
     82         "winlauncher",
     83     ]
     84     USE_LIBS += [
     85         "winlauncher",
     86     ]
     87     LOCAL_INCLUDES += [
     88         "/browser/app/winlauncher",
     89     ]
     90     OS_LIBS += [
     91         "advapi32",
     92         "shell32",
     93         "uuid",
     94     ]
     95     DELAYLOAD_DLLS += [
     96         "advapi32.dll",
     97         "oleaut32.dll",
     98         "ole32.dll",
     99         "rpcrt4.dll",
    100         "shell32.dll",
    101         "version.dll",
    102     ]
    103 
    104     if CONFIG["CC_TYPE"] == "clang-cl":
    105         libpath_flag = "-LIBPATH:"
    106     else:
    107         libpath_flag = "-L"
    108 
    109     WIN32_EXE_LDFLAGS += [
    110         libpath_flag + OBJDIR + "/winlauncher/freestanding",
    111     ]
    112 
    113     # Don't build firefox.exe with CETCOMPAT, because we need to be able to
    114     # only enable it for processes that are not using JIT in xul.dll.
    115     LINK_FLAGS["CETCOMPAT"] = []
    116 
    117 if CONFIG["DESKTOP_LAUNCHER_ENABLED"]:
    118     DIRS += [
    119         "desktop-launcher",
    120     ]
    121 
    122 if CONFIG["OS_ARCH"] == "Darwin":
    123     OS_LIBS += [
    124         "-framework CoreFoundation",
    125     ]
    126 
    127 if CONFIG["MOZ_SANDBOX"] and CONFIG["OS_ARCH"] == "WINNT":
    128     # For sandbox includes and the include dependencies those have
    129     LOCAL_INCLUDES += [
    130         "/security/sandbox/chromium",
    131         "/security/sandbox/chromium-shim",
    132     ]
    133 
    134     USE_LIBS += [
    135         "sandbox_s",
    136     ]
    137 
    138     OS_LIBS += [
    139         "winmm",
    140     ]
    141     DELAYLOAD_DLLS += [
    142         "winmm.dll",
    143         "user32.dll",
    144         "userenv.dll",
    145         "usp10.dll",
    146     ]
    147 
    148 if CONFIG["TARGET_OS"] in ("WINNT", "OSX"):
    149     DIRS += ["nmhproxy"]
    150 
    151 # Control the default heap size.
    152 # This is the heap returned by GetProcessHeap().
    153 # As we use the CRT heap, the default size is too large and wastes VM.
    154 #
    155 # The default heap size is 1MB on Win32.
    156 # The heap will grow if need be.
    157 #
    158 # Set it to 256k.  See bug 127069.
    159 if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CC_TYPE"] not in ("clang", "gcc"):
    160     LDFLAGS += ["/HEAP:0x40000"]
    161 
    162 DisableStlWrapping()
    163 
    164 if CONFIG["HAVE_CLOCK_MONOTONIC"]:
    165     OS_LIBS += CONFIG["REALTIME_LIBS"]
    166 
    167 if CONFIG["MOZ_LINUX_32_SSE2_STARTUP_ERROR"]:
    168     DEFINES["MOZ_LINUX_32_SSE2_STARTUP_ERROR"] = True
    169     COMPILE_FLAGS["OS_CXXFLAGS"] = [
    170         f
    171         for f in COMPILE_FLAGS["OS_CXXFLAGS"]
    172         if not f.startswith("-march=") and f not in ("-msse", "-msse2", "-mfpmath=sse")
    173     ] + [
    174         "-mno-sse",
    175         "-mno-sse2",
    176         "-mfpmath=387",
    177     ]
    178 
    179 for icon in ("firefox", "document", "newwindow", "newtab", "pbmode", "document_pdf"):
    180     DEFINES[icon.upper() + "_ICO"] = '"%s/%s/%s.ico"' % (
    181         TOPSRCDIR,
    182         CONFIG["MOZ_BRANDING_DIRECTORY"],
    183         icon,
    184     )
    185 
    186 if CONFIG["MOZ_ASAN"] or CONFIG["MOZ_DEBUG"]:
    187     WINCONSOLE = True
    188 else:
    189     WINCONSOLE = False