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"]
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"]
104 if CONFIG["MOZ_DEBUG_SYMBOLS"] and CONFIG["CC_TYPE"] == "clang-cl":
105 LDFLAGS += ["-NATVIS:%s/toolkit/library/gecko.natvis" % TOPSRCDIR]
106 if CONFIG["RUSTC_NATVIS_LDFLAGS"]:
107 LDFLAGS += CONFIG["RUSTC_NATVIS_LDFLAGS"]
109 if CONFIG["OS_ARCH"] == "Linux" and CONFIG["OS_TARGET"] != "Android":
112 script="/build/gen_symverscript.py",
113 inputs=["../symverscript.in"],
114 flags=["xul%s" % CONFIG["MOZILLA_SYMBOLVERSION"]],
116 SYMBOLS_FILE = "!symverscript"
119 # The real libxul definition is in ./build/moz.build, but we define a
120 # xul library here such that # FINAL_LIBRARY = 'xul' refers to here, which
121 # is then linked to both build/libxul and gtest/libxul.
124 STATIC_LIBRARY_NAME = "xul_s"
126 # Use a FINAL_LIBRARY for Libxul_defines to propagate from there. They wouldn't
127 # propagate from here.
128 FINAL_LIBRARY = "xul-real"
130 if CONFIG["OS_ARCH"] == "WINNT":
137 # need widget/windows for resource.h (included from widget.rc)
141 if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CC_TYPE"] not in ("clang", "gcc"):
151 if CONFIG["OS_ARCH"] == "WINNT":
154 # js needs to come after xul for now, because it is an archive and its content
155 # is discarded when it comes first.
169 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
170 # The mozgtk library is a workaround that makes Gtk+ use libwayland-client
171 # instead of mozwayland. The reason it works is that by being a dependency
172 # of libxul, mozgtk appears in dependentlibs.list, preceding mozwayland
173 # (which is important and guaranteed by the USE_LIBS order in this file).
174 # That, in turn, makes firefox dlopen() mozgtk before mozwayland, which
175 # will trigger the loading of the Gtk+ libraries (mozgtk depending on them).
176 # Those libraries, if they depend on libwayland-client, will use the symbols
177 # from libwayland-client because mozwayland is not loaded yet.
178 # When eventually libxul is loaded after both mozgtk and mozwayland, it will
179 # get symbols from libwayland-client too.
180 # In the case where Gtk+ doesn't have wayland support, libwayland-client is
181 # not loaded, and libxul ends up using the mozwayland symbols.
185 OS_LIBS += CONFIG["MOZ_GTK3_LIBS"]
187 if CONFIG["MOZ_WAYLAND"]:
192 if CONFIG["MOZ_JPROF"]:
197 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk" or CONFIG["MOZ_TREE_FREETYPE"]:
202 if CONFIG["MOZ_WEBRTC"]:
203 if CONFIG["OS_TARGET"] == "WINNT":
215 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
217 "-framework Foundation",
218 "-framework CoreFoundation",
219 "-framework CoreLocation",
220 "-framework QuartzCore",
222 "-framework CoreAudio",
223 "-framework CoreVideo",
224 "-framework AudioToolbox",
225 "-framework AudioUnit",
226 "-framework AddressBook",
228 "-framework Security",
229 "-framework ServiceManagement",
230 "-framework CoreServices",
231 "-framework ApplicationServices",
233 "-framework CoreMIDI",
234 "-framework SystemConfiguration",
235 "-framework AVFoundation",
236 "-framework CoreMedia",
238 "-F%s" % CONFIG["MACOS_PRIVATE_FRAMEWORKS_DIR"],
240 "-framework CoreSymbolication",
244 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "uikit":
246 "-framework Foundation",
247 "-framework CoreFoundation",
248 "-framework CoreGraphics",
249 "-framework CoreText",
250 "-framework AVFoundation",
251 "-framework AudioToolbox",
252 "-framework CoreMedia",
253 "-framework CoreVideo",
254 "-framework OpenGLES",
255 "-framework QuartzCore",
258 if CONFIG["MOZ_WMF"]:
265 if CONFIG["OS_ARCH"] == "FreeBSD":
270 if CONFIG["OS_ARCH"] == "WINNT":
283 if CONFIG["OS_ARCH"] == "Linux" and CONFIG["OS_TARGET"] != "Android":
288 if CONFIG["MOZ_ANDROID_GOOGLE_VR"]:
290 "-L%s" % CONFIG["MOZ_ANDROID_GOOGLE_VR_LIBS"],
294 if CONFIG["MOZ_SYSTEM_JPEG"]:
295 OS_LIBS += CONFIG["MOZ_JPEG_LIBS"]
297 if CONFIG["MOZ_SYSTEM_PNG"]:
298 OS_LIBS += CONFIG["MOZ_PNG_LIBS"]
300 if CONFIG["MOZ_SYSTEM_WEBP"]:
301 OS_LIBS += CONFIG["MOZ_WEBP_LIBS"]
303 if CONFIG["MOZ_SYSTEM_LIBEVENT"]:
304 OS_LIBS += CONFIG["MOZ_LIBEVENT_LIBS"]
306 if CONFIG["MOZ_SYSTEM_LIBVPX"]:
307 OS_LIBS += CONFIG["MOZ_LIBVPX_LIBS"]
309 if not CONFIG["MOZ_TREE_PIXMAN"]:
310 OS_LIBS += CONFIG["MOZ_PIXMAN_LIBS"]
312 if CONFIG["HAVE_CLOCK_MONOTONIC"]:
313 OS_LIBS += CONFIG["REALTIME_LIBS"]
315 OS_LIBS += CONFIG["ICONV_LIBS"]
317 if CONFIG["OS_ARCH"] == "OpenBSD":
322 if CONFIG["MOZ_ENABLE_DBUS"]:
323 OS_LIBS += CONFIG["MOZ_DBUS_GLIB_LIBS"]
325 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk" and CONFIG["COMPILE_ENVIRONMENT"]:
326 OS_LIBS += [l for l in CONFIG["MOZ_GTK3_LIBS"] if l not in ("-lgtk-3", "-lgdk-3")]
327 OS_LIBS += CONFIG["MOZ_X11_LIBS"]
328 OS_LIBS += CONFIG["MOZ_PANGO_LIBS"]
330 if CONFIG["MOZ_ENABLE_LIBPROXY"]:
331 OS_LIBS += CONFIG["MOZ_LIBPROXY_LIBS"]
333 if CONFIG["OS_ARCH"] == "FreeBSD":
338 if CONFIG["OS_ARCH"] == "Darwin":
340 # Link to Metal as required by the Metal gfx-hal backend
341 "-weak_framework Metal",
342 "-weak_framework MediaPlayer",
346 if CONFIG["OS_ARCH"] == "WINNT":
365 "portabledeviceguids",
373 # gfx-rs supports D3D11 and D3D12, but we are not linking to them implicitly
374 # "d3d11", # should be explicitly linked by gfx-backend-d3d11
375 #'d3d12', # should be explicitly linked by d3d12-rs
379 if CONFIG["CC_TYPE"] == "clang-cl":
384 if CONFIG["ACCESSIBILITY"]:
389 # Prevent winapi-rs from statically linking
390 LIBRARY_DEFINES["WINAPI_NO_BUNDLED_LIBRARIES"] = True
392 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
398 # The buildid is refreshed on every (incremental) build. But we want to avoid
399 # rebuilding libxul every time, so instead of having a source file that
400 # #include's buildid.h, which would have a dependency on it, and that would
401 # thus trigger make to rebuild everything, we generate a source with the
402 # buildid hard coded in it. Then we make that source file depend on all the
403 # objects files that constitute libxul, so that if any of the files linked into
404 # libxul is rebuilt, we refresh the buildid and link it into libxul.
406 if CONFIG["COMPILE_ENVIRONMENT"]:
407 SOURCES += ["!buildid.cpp"]
408 if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("cocoa", "uikit"):
411 libxul_list = "%sxul_%s" % (
412 CONFIG["DLL_PREFIX"],
413 CONFIG["DLL_SUFFIX"].lstrip(".").replace(".", "_"),
416 "buildid.cpp", script="gen_buildid.py", inputs=["!build/%s.list" % libxul_list]