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/.
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
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
21 GeckoFramework(name, output_category=output_category, linkage=None)
22 SHARED_LIBRARY_NAME = "XUL"
24 GeckoSharedLibrary(name, output_category=output_category, linkage=None)
25 SHARED_LIBRARY_NAME = "xul"
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":
69 "api-ms-win-core-winrt-l1-1-0.dll",
70 "api-ms-win-core-winrt-string-l1-1-0.dll",
73 if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["ACCESSIBILITY"]:
74 LOCAL_INCLUDES += ["!/accessible/interfaces/gecko/"]
76 if CONFIG["OS_ARCH"] == "WINNT":
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"]:
89 if CONFIG["MOZ_NEEDS_LIBATOMIC"]:
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
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.
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":
132 # need widget/windows for resource.h (included from widget.rc)
136 if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CC_TYPE"] not in ("clang", "gcc"):
146 # js needs to come after xul for now, because it is an archive and its content
147 # is discarded when it comes first.
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.
178 OS_LIBS += CONFIG["MOZ_GTK3_LIBS"]
180 if CONFIG["MOZ_WAYLAND"]:
185 if CONFIG["MOZ_JPROF"]:
190 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk" or CONFIG["MOZ_TREE_FREETYPE"]:
195 if CONFIG["MOZ_WEBRTC"]:
196 if CONFIG["OS_TARGET"] == "WINNT":
208 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
210 "-framework Foundation",
211 "-framework CoreFoundation",
212 "-framework CoreLocation",
213 "-framework QuartzCore",
215 "-framework CoreAudio",
216 "-framework CoreVideo",
217 "-framework AudioToolbox",
218 "-framework AudioUnit",
219 "-framework AddressBook",
221 "-framework Security",
222 "-framework ServiceManagement",
223 "-framework CoreServices",
224 "-framework ApplicationServices",
226 "-framework CoreMIDI",
227 "-framework SystemConfiguration",
228 "-framework AVFoundation",
229 "-framework CoreMedia",
231 "-F%s" % CONFIG["MACOS_PRIVATE_FRAMEWORKS_DIR"],
233 "-framework CoreSymbolication",
240 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
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",
255 if CONFIG["MOZ_WMF"]:
262 if CONFIG["OS_ARCH"] == "FreeBSD":
267 if CONFIG["OS_ARCH"] == "WINNT":
280 if CONFIG["OS_ARCH"] == "Linux" and CONFIG["OS_TARGET"] != "Android":
285 if CONFIG["MOZ_ANDROID_GOOGLE_VR"]:
287 "-L%s" % CONFIG["MOZ_ANDROID_GOOGLE_VR_LIBS"],
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":
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":
335 if CONFIG["OS_ARCH"] == "Darwin":
337 # Link to Metal as required by the Metal gfx-hal backend
338 "-weak_framework Metal",
339 "-weak_framework MediaPlayer",
343 if CONFIG["OS_ARCH"] == "WINNT":
362 "portabledeviceguids",
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
376 if CONFIG["CC_TYPE"] == "clang-cl":
381 if CONFIG["ACCESSIBILITY"]:
387 # Prevent winapi-rs from statically linking
388 LIBRARY_DEFINES["WINAPI_NO_BUNDLED_LIBRARIES"] = True
390 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
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"):
409 libxul_list = "%sxul_%s" % (
410 CONFIG["DLL_PREFIX"],
411 CONFIG["DLL_SUFFIX"].lstrip(".").replace(".", "_"),
414 "buildid.cpp", script="gen_buildid.py", inputs=["!build/%s.list" % libxul_list]