Bug 1888590 - Mark some subtests on trusted-types-event-handlers.html as failing...
[gecko.git] / toolkit / library / moz.build
blob9fa86b386b613d3dde8429b2c479763ed435f36c
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/.
8 @template
9 def Libxul_defines():
10     LIBRARY_DEFINES["MOZILLA_INTERNAL_API"] = True
11     LIBRARY_DEFINES["IMPL_LIBXUL"] = True
12     if not CONFIG["JS_SHARED_LIBRARY"]:
13         LIBRARY_DEFINES["STATIC_EXPORTABLE_JS_API"] = True
16 @template
17 def Libxul(name, output_category=None):
18     if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("cocoa", "uikit"):
19         # This is going to be a framework named "XUL", not an ordinary library named
20         # "libxul.dylib"
21         GeckoFramework(name, output_category=output_category, linkage=None)
22         SHARED_LIBRARY_NAME = "XUL"
23     else:
24         GeckoSharedLibrary(name, output_category=output_category, linkage=None)
25         SHARED_LIBRARY_NAME = "xul"
27     DELAYLOAD_DLLS += [
28         "avrt.dll",
29         "comdlg32.dll",
30         "credui.dll",
31         "d3d11.dll",
32         "D3DCompiler_47.dll",
33         "dhcpcsvc.dll",
34         "dnsapi.dll",
35         "dwmapi.dll",
36         "dxgi.dll",
37         "gdi32.dll",
38         "hid.dll",
39         "imm32.dll",
40         "iphlpapi.dll",
41         "msi.dll",
42         "msimg32.dll",
43         "netapi32.dll",
44         "ole32.dll",
45         "oleaut32.dll",
46         "secur32.dll",
47         "setupapi.dll",
48         "shell32.dll",
49         "shlwapi.dll",
50         "urlmon.dll",
51         "user32.dll",
52         "userenv.dll",
53         "usp10.dll",
54         "uxtheme.dll",
55         "wininet.dll",
56         "winmm.dll",
57         "winspool.drv",
58         "wtsapi32.dll",
59     ]
61     if CONFIG["ACCESSIBILITY"]:
62         DELAYLOAD_DLLS += ["oleacc.dll", "UIAutomationCore.dll"]
64     if CONFIG["MOZ_WEBRTC"]:
65         DELAYLOAD_DLLS += ["msdmo.dll"]
67     if CONFIG["OS_ARCH"] == "WINNT":
68         DELAYLOAD_DLLS += [
69             "api-ms-win-core-winrt-l1-1-0.dll",
70             "api-ms-win-core-winrt-string-l1-1-0.dll",
71         ]
73     if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["ACCESSIBILITY"]:
74         LOCAL_INCLUDES += ["!/accessible/interfaces/gecko/"]
76     if CONFIG["OS_ARCH"] == "WINNT":
77         LOCAL_INCLUDES += [
78             "/widget/windows",
79             "/xpcom/base",
80         ]
81         RCINCLUDE = "/toolkit/library/xulrunner.rc"
83     # Show a breakdown of linker time. (Too verbose for local builds.)
84     if CONFIG["CC_TYPE"] == "clang-cl" and not CONFIG["DEVELOPER_OPTIONS"]:
85         LDFLAGS += ["-time"]
87     Libxul_defines()
89     if CONFIG["MOZ_NEEDS_LIBATOMIC"]:
90         OS_LIBS += ["atomic"]
92     # TouchBar-related classes are only available in the 10.12.2 SDK and later.
93     # We need to weak link these classes until we've upgraded our SDK to at
94     # least 10.12.2.
95     # We're also linking against libresolv to solve bug 1367932.
96     if CONFIG["OS_ARCH"] == "Darwin":
97         LDFLAGS += ["-Wl,-U,_OBJC_CLASS_$_NSTouchBar"]
98         LDFLAGS += ["-Wl,-U,_OBJC_CLASS_$_NSSharingServicePickerTouchBarItem"]
99         LDFLAGS += ["-Wl,-U,_OBJC_METACLASS_$_NSTouchBar"]
100         LDFLAGS += ["-Wl,-U,_OBJC_CLASS_$_NSCustomTouchBarItem"]
101         LDFLAGS += ["-Wl,-U,_OBJC_CLASS_$_NSPopoverTouchBarItem"]
102         LDFLAGS += ["-lresolv"]
103         LDFLAGS += ["-Wl,-rpath,@executable_path/../Frameworks/ChannelPrefs.framework"]
105     if CONFIG["MOZ_DEBUG_SYMBOLS"] and CONFIG["CC_TYPE"] == "clang-cl":
106         LDFLAGS += ["-NATVIS:%s/toolkit/library/gecko.natvis" % TOPSRCDIR]
107     if CONFIG["RUSTC_NATVIS_LDFLAGS"]:
108         LDFLAGS += CONFIG["RUSTC_NATVIS_LDFLAGS"]
110     if CONFIG["OS_TARGET"] != "Android" and name == "xul-real":
111         SYMBOLS_FILE = "../libxul.symbols"
114 # The real libxul definition is in ./build/moz.build, but we define a
115 # xul library here such that # FINAL_LIBRARY = 'xul' refers to here, which
116 # is then linked to both build/libxul and gtest/libxul.
117 Library("xul")
119 STATIC_LIBRARY_NAME = "xul_s"
121 # Use a FINAL_LIBRARY for Libxul_defines to propagate from there. They wouldn't
122 # propagate from here.
123 FINAL_LIBRARY = "xul-real"
125 if CONFIG["OS_ARCH"] == "WINNT":
126     SOURCES += [
127         "nsDllMain.cpp",
128     ]
130 LOCAL_INCLUDES += [
131     "/config",
132     # need widget/windows for resource.h (included from widget.rc)
133     "/widget/windows",
136 if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CC_TYPE"] not in ("clang", "gcc"):
137     LOCAL_INCLUDES += [
138         "/xpcom/base",
139     ]
141 DIRS += [
142     "build",
143     "gtest",
146 # js needs to come after xul for now, because it is an archive and its content
147 # is discarded when it comes first.
148 USE_LIBS += [
149     "js",
152 USE_LIBS += [
153     "gkcodecs",
154     "lgpllibs",
155     "nspr",
156     "nss",
157     "psshparser",
158     "sqlite",
159     "zlib",
162 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
163     # The mozgtk library is a workaround that makes Gtk+ use libwayland-client
164     # instead of mozwayland. The reason it works is that by being a dependency
165     # of libxul, mozgtk appears in dependentlibs.list, preceding mozwayland
166     # (which is important and guaranteed by the USE_LIBS order in this file).
167     # That, in turn, makes firefox dlopen() mozgtk before mozwayland, which
168     # will trigger the loading of the Gtk+ libraries (mozgtk depending on them).
169     # Those libraries, if they depend on libwayland-client, will use the symbols
170     # from libwayland-client because mozwayland is not loaded yet.
171     # When eventually libxul is loaded after both mozgtk and mozwayland, it will
172     # get symbols from libwayland-client too.
173     # In the case where Gtk+ doesn't have wayland support, libwayland-client is
174     # not loaded, and libxul ends up using the mozwayland symbols.
175     USE_LIBS += [
176         "mozgtk",
177     ]
178     OS_LIBS += CONFIG["MOZ_GTK3_LIBS"]
180 if CONFIG["MOZ_WAYLAND"]:
181     USE_LIBS += [
182         "mozwayland",
183     ]
185 if CONFIG["MOZ_JPROF"]:
186     USE_LIBS += [
187         "jprof",
188     ]
190 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk" or CONFIG["MOZ_TREE_FREETYPE"]:
191     USE_LIBS += [
192         "freetype",
193     ]
195 if CONFIG["MOZ_WEBRTC"]:
196     if CONFIG["OS_TARGET"] == "WINNT":
197         OS_LIBS += [
198             "secur32",
199             "iphlpapi",
200             "strmiids",
201             "dmoguids",
202             "wmcodecdspuuid",
203             "amstrmid",
204             "msdmo",
205             "wininet",
206         ]
208 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
209     OS_LIBS += [
210         "-framework Foundation",
211         "-framework CoreFoundation",
212         "-framework CoreLocation",
213         "-framework QuartzCore",
214         "-framework Carbon",
215         "-framework CoreAudio",
216         "-framework CoreVideo",
217         "-framework AudioToolbox",
218         "-framework AudioUnit",
219         "-framework AddressBook",
220         "-framework OpenGL",
221         "-framework Security",
222         "-framework ServiceManagement",
223         "-framework CoreServices",
224         "-framework ApplicationServices",
225         "-framework AppKit",
226         "-framework CoreMIDI",
227         "-framework SystemConfiguration",
228         "-framework AVFoundation",
229         "-framework CoreMedia",
230         "-framework IOKit",
231         "-F%s" % CONFIG["MACOS_PRIVATE_FRAMEWORKS_DIR"],
232         "-framework CoreUI",
233         "-framework CoreSymbolication",
234         "cups",
235     ]
236     USE_LIBS += [
237         "ChannelPrefs",
238     ]
240 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
241     OS_LIBS += [
242         "-framework Foundation",
243         "-framework CoreFoundation",
244         "-framework CoreGraphics",
245         "-framework CoreText",
246         "-framework AVFoundation",
247         "-framework AudioToolbox",
248         "-framework CoreMedia",
249         "-framework CoreVideo",
250         "-framework OpenGLES",
251         "-framework QuartzCore",
252         "-framework Security",
253     ]
255 if CONFIG["MOZ_WMF"]:
256     OS_LIBS += [
257         "mfuuid",
258         "wmcodecdspuuid",
259         "strmiids",
260     ]
262 if CONFIG["OS_ARCH"] == "FreeBSD":
263     OS_LIBS += [
264         "util",
265     ]
267 if CONFIG["OS_ARCH"] == "WINNT":
268     OS_LIBS += [
269         "crypt32",
270         "gdi32",
271         "shell32",
272         "ntdll",
273         "ole32",
274         "version",
275         "winspool",
276         "userenv",
277         "uuid",
278     ]
280 if CONFIG["OS_ARCH"] == "Linux" and CONFIG["OS_TARGET"] != "Android":
281     OS_LIBS += [
282         "rt",
283     ]
285 if CONFIG["MOZ_ANDROID_GOOGLE_VR"]:
286     OS_LIBS += [
287         "-L%s" % CONFIG["MOZ_ANDROID_GOOGLE_VR_LIBS"],
288         "-lgvr",
289     ]
291 if CONFIG["MOZ_SYSTEM_JPEG"]:
292     OS_LIBS += CONFIG["MOZ_JPEG_LIBS"]
294 if CONFIG["MOZ_SYSTEM_PNG"]:
295     OS_LIBS += CONFIG["MOZ_PNG_LIBS"]
297 if CONFIG["MOZ_SYSTEM_WEBP"]:
298     OS_LIBS += CONFIG["MOZ_WEBP_LIBS"]
300 if CONFIG["MOZ_SYSTEM_LIBEVENT"]:
301     OS_LIBS += CONFIG["MOZ_LIBEVENT_LIBS"]
303 if CONFIG["MOZ_SYSTEM_LIBVPX"]:
304     OS_LIBS += CONFIG["MOZ_LIBVPX_LIBS"]
306 if not CONFIG["MOZ_TREE_PIXMAN"]:
307     OS_LIBS += CONFIG["MOZ_PIXMAN_LIBS"]
309 if CONFIG["HAVE_CLOCK_MONOTONIC"]:
310     OS_LIBS += CONFIG["REALTIME_LIBS"]
312 OS_LIBS += CONFIG["ICONV_LIBS"]
314 if CONFIG["OS_ARCH"] == "OpenBSD":
315     OS_LIBS += [
316         "sndio",
317     ]
319 if CONFIG["MOZ_ENABLE_DBUS"]:
320     OS_LIBS += CONFIG["MOZ_DBUS_LIBS"]
322 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk" and CONFIG["COMPILE_ENVIRONMENT"]:
323     OS_LIBS += [l for l in CONFIG["MOZ_GTK3_LIBS"] if l not in ("-lgtk-3", "-lgdk-3")]
324     OS_LIBS += CONFIG["MOZ_X11_LIBS"]
325     OS_LIBS += CONFIG["MOZ_PANGO_LIBS"]
327 if CONFIG["MOZ_ENABLE_LIBPROXY"]:
328     OS_LIBS += CONFIG["MOZ_LIBPROXY_LIBS"]
330 if CONFIG["OS_ARCH"] == "FreeBSD":
331     OS_LIBS += [
332         "util",
333     ]
335 if CONFIG["OS_ARCH"] == "Darwin":
336     OS_LIBS += [
337         # Link to Metal as required by the Metal gfx-hal backend
338         "-weak_framework Metal",
339         "-weak_framework MediaPlayer",
340     ]
343 if CONFIG["OS_ARCH"] == "WINNT":
344     OS_LIBS += [
345         "shell32",
346         "ole32",
347         "version",
348         "winspool",
349         "comdlg32",
350         "imm32",
351         "msimg32",
352         "netapi32",
353         "shlwapi",
354         "ws2_32",
355         "dnsapi",
356         "dwmapi",
357         "iphlpapi",
358         "uxtheme",
359         "setupapi",
360         "secur32",
361         "sensorsapi",
362         "portabledeviceguids",
363         "wininet",
364         "wintrust",
365         "wtsapi32",
366         "locationapi",
367         "sapi",
368         "dxguid",
369         "dhcpcsvc",
370         # gfx-rs supports D3D11 and D3D12, but we are not linking to them implicitly
371         # "d3d11", # should be explicitly linked by gfx-backend-d3d11
372         #'d3d12', # should be explicitly linked by d3d12-rs
373         "d3dcompiler",
374     ]
376     if CONFIG["CC_TYPE"] == "clang-cl":
377         OS_LIBS += [
378             "runtimeobject",
379         ]
381     if CONFIG["ACCESSIBILITY"]:
382         OS_LIBS += [
383             "oleacc",
384             "uiautomationcore",
385         ]
387     # Prevent winapi-rs from statically linking
388     LIBRARY_DEFINES["WINAPI_NO_BUNDLED_LIBRARIES"] = True
390 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
391     OS_LIBS += [
392         "usp10",
393         "oleaut32",
394     ]
396 # The buildid is refreshed on every (incremental) build. But we want to avoid
397 # rebuilding libxul every time, so instead of having a source file that
398 # #include's buildid.h, which would have a dependency on it, and that would
399 # thus trigger make to rebuild everything, we generate a source with the
400 # buildid hard coded in it. Then we make that source file depend on all the
401 # objects files that constitute libxul, so that if any of the files linked into
402 # libxul is rebuilt, we refresh the buildid and link it into libxul.
404 if CONFIG["COMPILE_ENVIRONMENT"]:
405     SOURCES += ["!buildid.cpp"]
406     if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("cocoa", "uikit"):
407         libxul_list = "XUL"
408     else:
409         libxul_list = "%sxul_%s" % (
410             CONFIG["DLL_PREFIX"],
411             CONFIG["DLL_SUFFIX"].lstrip(".").replace(".", "_"),
412         )
413     GeneratedFile(
414         "buildid.cpp", script="gen_buildid.py", inputs=["!build/%s.list" % libxul_list]
415     )