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