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"
42 if CONFIG["ACCESSIBILITY"]:
43 DELAYLOAD_DLLS += ["oleacc.dll"]
45 if CONFIG["MOZ_WEBRTC"]:
46 DELAYLOAD_DLLS += ["msdmo.dll"]
48 if CONFIG["OS_ARCH"] == "WINNT":
50 "api-ms-win-core-winrt-l1-1-0.dll",
51 "api-ms-win-core-winrt-string-l1-1-0.dll",
54 if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["ACCESSIBILITY"]:
55 LOCAL_INCLUDES += ["!/accessible/interfaces/gecko/"]
57 if CONFIG["OS_ARCH"] == "WINNT":
62 RCINCLUDE = "/toolkit/library/xulrunner.rc"
64 # Show a breakdown of linker time. (Too verbose for local builds.)
65 if CONFIG["CC_TYPE"] == "clang-cl" and not CONFIG["DEVELOPER_OPTIONS"]:
70 if CONFIG["MOZ_NEEDS_LIBATOMIC"]:
73 # TouchBar-related classes are only available in the 10.12.2 SDK and later.
74 # We need to weak link these classes until we've upgraded our SDK to at
76 # We're also linking against libresolv to solve bug 1367932.
77 if CONFIG["OS_ARCH"] == "Darwin":
78 LDFLAGS += ["-Wl,-U,_OBJC_CLASS_$_NSTouchBar"]
79 LDFLAGS += ["-Wl,-U,_OBJC_CLASS_$_NSSharingServicePickerTouchBarItem"]
80 LDFLAGS += ["-Wl,-U,_OBJC_METACLASS_$_NSTouchBar"]
81 LDFLAGS += ["-Wl,-U,_OBJC_CLASS_$_NSCustomTouchBarItem"]
82 LDFLAGS += ["-Wl,-U,_OBJC_CLASS_$_NSPopoverTouchBarItem"]
83 LDFLAGS += ["-lresolv"]
85 if CONFIG["MOZ_DEBUG_SYMBOLS"] and CONFIG["CC_TYPE"] == "clang-cl":
86 LDFLAGS += ["-NATVIS:%s/toolkit/library/gecko.natvis" % TOPSRCDIR]
87 if CONFIG["RUSTC_NATVIS_LDFLAGS"]:
88 LDFLAGS += CONFIG["RUSTC_NATVIS_LDFLAGS"]
90 if CONFIG["OS_ARCH"] == "Linux" and CONFIG["OS_TARGET"] != "Android":
93 script="/build/gen_symverscript.py",
94 inputs=["../symverscript.in"],
95 flags=["xul%s" % CONFIG["MOZILLA_SYMBOLVERSION"]],
97 SYMBOLS_FILE = "!symverscript"
99 # Generate GDB pretty printer-autoload files only on Linux. OSX's GDB is
100 # too old to support Python pretty-printers; if this changes, we could
101 # make this 'ifdef __GNUC__'.
102 if CONFIG["OS_ARCH"] == "Linux":
103 # Create a GDB Python auto-load file alongside the libxul shared library
104 # in the build directory.
105 DEFINES["topsrcdir"] = TOPSRCDIR
106 OBJDIR_FILES.toolkit.library.build += ["../libxul.so-gdb.py"]
109 # The real libxul definition is in ./build/moz.build, but we define a
110 # xul library here such that # FINAL_LIBRARY = 'xul' refers to here, which
111 # is then linked to both build/libxul and gtest/libxul.
114 STATIC_LIBRARY_NAME = "xul_s"
116 # Use a FINAL_LIBRARY for Libxul_defines to propagate from there. They wouldn't
117 # propagate from here.
118 FINAL_LIBRARY = "xul-real"
120 if CONFIG["OS_ARCH"] == "WINNT":
127 # need widget/windows for resource.h (included from widget.rc)
131 if CONFIG["OS_ARCH"] == "WINNT" and CONFIG["CC_TYPE"] not in ("clang", "gcc"):
141 if CONFIG["OS_ARCH"] == "WINNT":
144 # js needs to come after xul for now, because it is an archive and its content
145 # is discarded when it comes first.
159 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
164 if CONFIG["MOZ_WAYLAND"]:
169 if CONFIG["MOZ_JPROF"]:
174 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk" or CONFIG["MOZ_TREE_FREETYPE"]:
179 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
180 CXXFLAGS += CONFIG["TK_CFLAGS"]
182 if CONFIG["MOZ_WEBRTC"]:
183 if CONFIG["OS_TARGET"] == "WINNT":
195 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "cocoa":
198 "-framework SystemConfiguration",
199 "-framework AVFoundation",
200 "-framework CoreMedia",
202 "-F%s" % CONFIG["MACOS_PRIVATE_FRAMEWORKS_DIR"],
204 "-framework CoreSymbolication",
208 if CONFIG["MOZ_WMF"]:
215 if CONFIG["OS_ARCH"] == "FreeBSD":
220 if CONFIG["OS_ARCH"] == "WINNT":
230 if CONFIG["OS_ARCH"] == "Linux" and CONFIG["OS_TARGET"] != "Android":
235 if CONFIG["MOZ_ANDROID_GOOGLE_VR"]:
237 "-L%s" % CONFIG["MOZ_ANDROID_GOOGLE_VR_LIBS"],
241 OS_LIBS += CONFIG["MOZ_CAIRO_OSLIBS"]
242 OS_LIBS += CONFIG["MOZ_WEBRTC_X11_LIBS"]
244 if CONFIG["MOZ_SYSTEM_JPEG"]:
245 OS_LIBS += CONFIG["MOZ_JPEG_LIBS"]
247 if CONFIG["MOZ_SYSTEM_PNG"]:
248 OS_LIBS += CONFIG["MOZ_PNG_LIBS"]
250 if CONFIG["MOZ_SYSTEM_WEBP"]:
251 OS_LIBS += CONFIG["MOZ_WEBP_LIBS"]
253 if CONFIG["MOZ_SYSTEM_LIBEVENT"]:
254 OS_LIBS += CONFIG["MOZ_LIBEVENT_LIBS"]
256 if CONFIG["MOZ_SYSTEM_LIBVPX"]:
257 OS_LIBS += CONFIG["MOZ_LIBVPX_LIBS"]
259 if not CONFIG["MOZ_TREE_PIXMAN"]:
260 OS_LIBS += CONFIG["MOZ_PIXMAN_LIBS"]
262 if CONFIG["HAVE_CLOCK_MONOTONIC"]:
263 OS_LIBS += CONFIG["REALTIME_LIBS"]
265 OS_LIBS += CONFIG["ICONV_LIBS"]
267 if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("cocoa", "uikit"):
268 OS_LIBS += CONFIG["TK_LIBS"]
270 if CONFIG["OS_ARCH"] == "OpenBSD":
275 if CONFIG["MOZ_ENABLE_DBUS"]:
276 OS_LIBS += CONFIG["MOZ_DBUS_GLIB_LIBS"]
278 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
279 OS_LIBS += [l for l in CONFIG["TK_LIBS"] if l not in ("-lgtk-3", "-lgdk-3")]
280 OS_LIBS += CONFIG["XLDFLAGS"]
281 OS_LIBS += CONFIG["XLIBS"]
282 OS_LIBS += CONFIG["XEXT_LIBS"]
283 OS_LIBS += CONFIG["MOZ_PANGO_LIBS"]
284 OS_LIBS += CONFIG["XT_LIBS"]
289 if CONFIG["MOZ_ENABLE_LIBPROXY"]:
290 OS_LIBS += CONFIG["MOZ_LIBPROXY_LIBS"]
292 if CONFIG["OS_ARCH"] == "FreeBSD":
297 if CONFIG["OS_ARCH"] == "Darwin":
299 # Link to Metal as required by the Metal gfx-hal backend
300 "-weak_framework Metal",
301 "-weak_framework MediaPlayer",
305 if CONFIG["OS_ARCH"] == "WINNT":
324 "portabledeviceguids",
333 # gfx-rs supports D3D11 and D3D12, but we are not linking to them implicitly
334 # "d3d11", # should be explicitly linked by gfx-backend-d3d11
335 #'d3d12', # should be explicitly linked by d3d12-rs
339 if CONFIG["CC_TYPE"] == "clang-cl":
344 if CONFIG["ACCESSIBILITY"]:
349 # Prevent winapi-rs from statically linking
350 LIBRARY_DEFINES["WINAPI_NO_BUNDLED_LIBRARIES"] = True
352 if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows":
358 # The buildid is refreshed on every (incremental) build. But we want to avoid
359 # rebuilding libxul every time, so instead of having a source file that
360 # #include's buildid.h, which would have a dependency on it, and that would
361 # thus trigger make to rebuild everything, we generate a source with the
362 # buildid hard coded in it. Then we make that source file depend on all the
363 # objects files that constitute libxul, so that if any of the files linked into
364 # libxul is rebuilt, we refresh the buildid and link it into libxul.
366 if CONFIG["COMPILE_ENVIRONMENT"]:
367 SOURCES += ["!buildid.cpp"]
368 if CONFIG["MOZ_WIDGET_TOOLKIT"] in ("cocoa", "uikit"):
371 libxul_list = "%sxul_%s" % (
372 CONFIG["DLL_PREFIX"],
373 CONFIG["DLL_SUFFIX"].lstrip(".").replace(".", "_"),
376 "buildid.cpp", script="gen_buildid.py", inputs=["!build/%s.list" % libxul_list]