Bug 1706452 - Reintroduce a mozgtk library after bug 1377445. r=firefox-build-system-reviewers,rmader,mhentges

Differential Revision: https://phabricator.services.mozilla.com/D112883
This commit is contained in:
Mike Hommey 2021-04-22 13:56:57 +00:00
Родитель 365941c6ee
Коммит 51ef1125c8
4 изменённых файлов: 49 добавлений и 0 удалений

Просмотреть файл

@ -104,6 +104,7 @@
#endif
#endif
#ifdef MOZ_GTK
@BINPATH@/@DLL_PREFIX@mozgtk@DLL_SUFFIX@
#ifdef MOZ_WAYLAND
@BINPATH@/@DLL_PREFIX@mozwayland@DLL_SUFFIX@
#endif

Просмотреть файл

@ -157,6 +157,21 @@ USE_LIBS += [
]
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"]:

Просмотреть файл

@ -19,6 +19,9 @@ with Files("*IMContextWrapper*"):
with Files("*nsGtkKeyUtils*"):
BUG_COMPONENT = ("Core", "DOM: UI Events & Focus Handling")
if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk":
DIRS += ["mozgtk"]
if CONFIG["MOZ_WAYLAND"]:
DIRS += ["wayland", "mozwayland"]

Просмотреть файл

@ -0,0 +1,30 @@
# -*- 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/.
SharedLibrary("mozgtk")
# If LDFLAGS contains -Wl,--as-needed or if it's the default for the toolchain,
# we need to add -Wl,--no-as-needed before the gtk libraries, otherwise the
# linker will drop those dependencies because no symbols are used from them.
# But those dependencies need to be kept for things to work properly.
# Ideally, we'd only add -Wl,--no-as-needed if necessary, but it's just simpler
# to add it unconditionally. This library is also simple enough that forcing
# -Wl,--as-needed after the gtk libraries is not going to make a significant
# difference.
if CONFIG["GCC_USE_GNU_LD"]:
no_as_needed = ["-Wl,--no-as-needed"]
as_needed = ["-Wl,--as-needed"]
else:
no_as_needed = []
as_needed = []
OS_LIBS += [f for f in CONFIG["MOZ_GTK3_LIBS"] if f.startswith("-L")]
OS_LIBS += no_as_needed
OS_LIBS += [
"gtk-3",
"gdk-3",
]
OS_LIBS += as_needed