Bug 1022425 - Force mozgtk stubs dependency on gtk libraries when -Wl,--as-needed is used. r=mshal

This commit is contained in:
Mike Hommey 2014-06-10 16:00:55 +09:00
parent 92ac24c220
commit 7587385bee
2 changed files with 24 additions and 4 deletions

View File

@ -2,8 +2,18 @@
# 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/.
EXTRA_DSO_LDOPTS += -lgtk-x11-2.0 -lgdk-x11-2.0
include $(topsrcdir)/config/rules.mk
LDFLAGS += -Wl,-soname=$(DLL_PREFIX)mozgtk$(DLL_SUFFIX)
# If LDFLAGS contains -Wl,--as-needed, 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.
ifeq (,$(filter -Wl,--as-needed),$(LDFLAGS))
no_as_needed = $1
else
no_as_needed = -Wl,--no-as-needed $1 -Wl,--as-needed
endif
EXTRA_DSO_LDOPTS += $(call no_as_needed,-lgtk-x11-2.0 -lgdk-x11-2.0)

View File

@ -2,6 +2,16 @@
# 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/.
EXTRA_DSO_LDOPTS += -lgtk-3 -lgdk-3
include $(topsrcdir)/config/rules.mk
# If LDFLAGS contains -Wl,--as-needed, 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.
ifeq (,$(filter -Wl,--as-needed),$(LDFLAGS))
no_as_needed = $1
else
no_as_needed = -Wl,--no-as-needed $1 -Wl,--as-needed
endif
EXTRA_DSO_LDOPTS += $(call no_as_needed,-lgtk-3 -lgdk-3)