try to use also proper debug LDFLAGS for externals libraries

This is basically ea68de2968 but
for LDFLAGS. A number of external libs cannot use this because
their libtool mishandles -fuse-ld.

Change-Id: Idee379eb0a3afb475b536519ee3de064b4e218f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133639
Tested-by: Jenkins
Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
This commit is contained in:
Luboš Luňák 2022-04-29 15:50:22 +02:00
parent 339fbb7bc3
commit 1ffd6897dd
30 changed files with 42 additions and 24 deletions

View file

@ -50,7 +50,9 @@ $(call gb_ExternalProject_get_state_target,cairo,build) :
$(if $(filter ANDROID iOS,$(OS)),CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS) $(gb_VISIBILITY_FLAGS)") \
$(if $(filter EMSCRIPTEN,$(OS)),CFLAGS=" $(ZLIB_CFLAGS) -Wno-enum-conversion $(gb_EMSCRIPTEN_CPPFLAGS)" --enable-pthread=yes PTHREAD_LIBS="") \
$(if $(filter-out EMSCRIPTEN ANDROID iOS,$(OS)), \
CFLAGS="$(CFLAGS) $(call gb_ExternalProject_get_build_flags,cairo) $(ZLIB_CFLAGS)" ) \
CFLAGS="$(CFLAGS) $(call gb_ExternalProject_get_build_flags,cairo) $(ZLIB_CFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,cairo)" \
) \
$(if $(filter ANDROID iOS,$(OS)),PKG_CONFIG=./dummy_pkg_config) \
LIBS="$(ZLIB_LIBS)" \
$(if $(filter -fsanitize=%,$(LDFLAGS)),LDFLAGS="$(LDFLAGS) -fuse-ld=bfd") \

View file

@ -65,7 +65,8 @@ $(call gb_ExternalProject_get_state_target,curl,build):
$(if $(filter MACOSX,$(OS)),CFLAGS='$(CFLAGS) \
-mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET)') \
CPPFLAGS='$(curl_CPPFLAGS)' \
LDFLAGS='$(curl_LDFLAGS)' \
CFLAGS="$(gb_CFLAGS) $(call gb_ExternalProject_get_build_flags,curl)" \
LDFLAGS='$(call gb_ExternalProject_get_link_flags,curl) $(curl_LDFLAGS)' \
ZLIB_CFLAGS='$(ZLIB_CFLAGS)' ZLIB_LIBS='$(ZLIB_LIBS)' \
&& cd lib \
&& $(MAKE) \

View file

@ -62,6 +62,7 @@ $(call gb_ExternalProject_get_state_target,firebird,build):
$(if $(ENABLE_DEBUG),$(if $(filter MSC,$(COM)),-Od -Z7)) \
" \
&& export LDFLAGS=" \
$(call gb_ExternalProject_get_link_flags,firebird) \
$(if $(SYSTEM_LIBATOMIC_OPS),$(LIBATOMIC_OPS_LIBS), \
-L$(call gb_UnpackedTarball_get_dir,libatomic_ops)/src \
) \

View file

@ -26,6 +26,7 @@ $(call gb_ExternalProject_get_state_target,fontconfig,build) :
$(gb_VISIBILITY_FLAGS) \
$(if $(filter EMSCRIPTEN,$(OS)),-pthread)" \
$(if $(filter ANDROID,$(OS)),LIBS="-lm") \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,fontconfig)" \
$(gb_RUN_CONFIGURE) ./configure \
--disable-shared \
--disable-silent-rules \

View file

@ -30,6 +30,7 @@ $(call gb_ExternalProject_get_state_target,freetype,build) :
$(call gb_ExternalProject_get_build_flags,freetype) \
$(gb_VISIBILITY_FLAGS) \
$(gb_EMSCRIPTEN_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,freetype)" \
&& $(MAKE) install \
&& touch $@ )
$(call gb_Trace_EndRange,freetype,EXTERNAL)

View file

@ -49,6 +49,7 @@ $(call gb_ExternalProject_get_state_target,harfbuzz,build) :
$(CXXFLAGS) $(CXXFLAGS_CXX11) \
$(ICU_UCHAR_TYPE) \
$(if $(filter LINUX,$(OS)),-fvisibility=hidden)' \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,harfbuzz)" \
MAKE=$(MAKE) \
&& (cd $(EXTERNAL_WORKDIR)/src && $(MAKE) lib) \
)

View file

@ -21,7 +21,7 @@ hunspell_CXXFLAGS:=$(CXXFLAGS) $(gb_LTOFLAGS) \
$(gb_EMSCRIPTEN_CPPFLAGS) \
$(call gb_ExternalProject_get_build_flags,hunspell)
hunspell_LDFLAGS:=$(gb_LTOFLAGS)
hunspell_LDFLAGS:=$(gb_LTOFLAGS) $(call gb_ExternalProject_get_link_flags,hunspell)
$(call gb_ExternalProject_get_state_target,hunspell,build):
$(call gb_Trace_StartRange,hunspell,EXTERNAL)

View file

@ -25,6 +25,7 @@ $(call gb_ExternalProject_get_state_target,hyphen,build):
$(gb_CONFIGURE_PLATFORMS) \
$(if $(CROSS_COMPILING),gio_can_sniff=no) \
CFLAGS=" $(CFLAGS) $(call gb_ExternalProject_get_build_flags,libgpg-error)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,hyphen)" \
&& $(MAKE) \
)
$(call gb_Trace_EndRange,hyphen,EXTERNAL)

View file

@ -54,6 +54,7 @@ icu_CXXFLAGS:="$(CXXFLAGS) $(CXXFLAGS_CXX11) \
$(if $(filter ANDROID,$(OS)),-fvisibility=hidden -fno-omit-frame-pointer -I$(SRCDIR)/include)"
icu_LDFLAGS:=" \
$(if $(ENABLE_LTO),$(gb_LTOFLAGS)) \
$(call gb_ExternalProject_get_link_flags,icu) \
$(if $(filter TRUE,$(HAVE_LD_HASH_STYLE)),-Wl$(COMMA)--hash-style=$(WITH_LINKER_HASH_STYLE)) \
$(if $(SYSBASE),-L../lib -L../../lib -L../stubdata -L../../stubdata -L$(SYSBASE)/usr/lib) \
$(if $(filter TRUE,$(HAVE_LD_BSYMBOLIC_FUNCTIONS)), -Wl$(COMMA)-Bsymbolic-functions) \

View file

@ -38,6 +38,7 @@ $(call gb_ExternalProject_get_state_target,libabw,build) :
$(if $(gb_FULLDEPS),,--disable-dependency-tracking) \
CXXFLAGS="$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libabw)" \
CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libabw)" \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \
)

View file

@ -18,7 +18,12 @@ $(eval $(call gb_ExternalProject_register_targets,libatomic_ops,\
$(call gb_ExternalProject_get_state_target,libatomic_ops,build) :
$(call gb_Trace_StartRange,libatomic_ops,EXTERNAL)
$(call gb_ExternalProject_run,build,\
$(if $(filter TRUE,$(DISABLE_DYNLOADING)),CFLAGS="$(CFLAGS) $(gb_VISIBILITY_FLAGS) $(call gb_ExternalProject_get_build_flags,libatomic_ops)" CXXFLAGS="$(CXXFLAGS) $(gb_VISIBILITY_FLAGS) $(gb_VISIBILITY_FLAGS_CXX) $(call gb_ExternalProject_get_build_flags,libatomic_ops)") \
$(if $(filter TRUE, \
$(DISABLE_DYNLOADING)) \
, \
CFLAGS="$(CFLAGS) $(gb_VISIBILITY_FLAGS) $(call gb_ExternalProject_get_build_flags,libatomic_ops)" \
CXXFLAGS="$(CXXFLAGS) $(gb_VISIBILITY_FLAGS) $(gb_VISIBILITY_FLAGS_CXX) $(call gb_ExternalProject_get_build_flags,libatomic_ops)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libatomic_ops)") \
$(gb_RUN_CONFIGURE) ./configure \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \

View file

@ -40,6 +40,7 @@ $(call gb_ExternalProject_get_state_target,libcdr,build) :
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
CXXFLAGS="$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libcdr)" \
CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libcdr)" \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \
)

View file

@ -41,6 +41,7 @@ $(call gb_ExternalProject_get_state_target,libebook,build) :
--disable-weffc \
CXXFLAGS="$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libebook)" \
CPPFLAGS="$(CPPFLAGS) $(ICU_UCHAR_TYPE) $(BOOST_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libebook)" \
LANGTAG_CFLAGS="$(LIBLANGTAG_CFLAGS)" \
LANGTAG_LIBS="$(LIBLANGTAG_LIBS)" \
XML_CFLAGS="$(LIBXML_CFLAGS)" \

View file

@ -34,6 +34,7 @@ $(call gb_ExternalProject_get_state_target,libepubgen,build) :
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
CXXFLAGS="$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libepubgen)" \
CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libepubgen)" \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \
)

View file

@ -23,6 +23,7 @@ $(call gb_ExternalProject_get_state_target,libexttextcat,build):
CFLAGS="$(CFLAGS) $(gb_VISIBILITY_FLAGS) $(gb_DEBUGINFO_FLAGS) $(call gb_ExternalProject_get_build_flags,libexttextcat) \
$(if $(COM_IS_CLANG),-Qunused-arguments) \
$(if $(filter AIX,$(OS)),-D_LINUX_SOURCE_COMPAT)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libexttextcat)" \
&& $(MAKE) \
)
$(call gb_Trace_EndRange,libexttextcat,EXTERNAL)

View file

@ -40,6 +40,7 @@ $(call gb_ExternalProject_get_state_target,libfreehand,build) :
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
CXXFLAGS="$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libfreehand)" \
CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libfreehand)" \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \
)

View file

@ -38,6 +38,7 @@ $(call gb_ExternalProject_get_state_target,libmspub,build) :
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
CXXFLAGS="$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libmspub)" \
CPPFLAGS="$(CPPFLAGS) $(ICU_UCHAR_TYPE) $(BOOST_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libmspub)" \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \
)

View file

@ -33,6 +33,7 @@ $(call gb_ExternalProject_get_state_target,libnumbertext,build):
CXXFLAGS="$(libnumbertext_CXXFLAGS) \
$(call gb_ExternalProject_get_build_flags,libnumbertext) \
$(gb_VISIBILITY_FLAGS) $(gb_VISIBILITY_FLAGS_CXX)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libnumbertext)" \
&& cd src && $(MAKE) \
)
$(call gb_Trace_EndRange,libnumbertext,EXTERNAL)

View file

@ -62,6 +62,8 @@ liborcus_CPPFLAGS+=$(gb_COMPILERDEFS_STDLIB_DEBUG)
liborcus_CXXFLAGS=$(CXXFLAGS) $(gb_VISIBILITY_FLAGS) $(gb_VISIBILITY_FLAGS_CXX) $(CXXFLAGS_CXX11) -DBOOST_SYSTEM_NO_DEPRECATED
liborcus_LDFLAGS=$(LDFLAGS) $(gb_LTOFLAGS)
liborcus_CXXFLAGS+=$(call gb_ExternalProject_get_build_flags,liborcus)
liborcus_LDFLAGS+=$(call gb_ExternalProject_get_link_flags,liborcus)
ifeq ($(COM),MSC)
liborcus_CXXFLAGS+=$(BOOST_CXXFLAGS)
endif
@ -78,14 +80,6 @@ ifeq ($(OS),LINUX)
liborcus_LDFLAGS+=-Wl,-z,origin -Wl,-rpath,\$$$$ORIGIN
endif
ifeq ($(ENABLE_GDB_INDEX),TRUE)
liborcus_LDFLAGS+=-Wl,--gdb-index
liborcus_CXXFLAGS+=-ggnu-pubnames
ifneq ($(USE_LD),)
liborcus_LDFLAGS += $(USE_LD)
endif
endif
$(call gb_ExternalProject_get_state_target,liborcus,build) :
$(call gb_Trace_StartRange,liborcus,EXTERNAL)
$(call gb_ExternalProject_run,build,\

View file

@ -36,6 +36,7 @@ $(call gb_ExternalProject_get_state_target,libpagemaker,build) :
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
CXXFLAGS="$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libpagemaker)" \
CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libpagemaker)" \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \
)

View file

@ -39,6 +39,7 @@ $(call gb_ExternalProject_get_state_target,libqxp,build) :
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
CXXFLAGS="$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libqxp)" \
CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libqxp)" \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \
)

View file

@ -39,6 +39,7 @@ $(call gb_ExternalProject_get_state_target,libvisio,build) :
$(if $(gb_FULLDEPS),,--disable-dependency-tracking) \
CXXFLAGS="$(CXXFLAGS) $(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libvisio)" \
CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libvisio)" \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \
)

View file

@ -48,6 +48,7 @@ $(call gb_ExternalProject_get_state_target,libwebp,build) :
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
CFLAGS="$(CFLAGS) $(call gb_ExternalProject_get_build_flags,libwebp)" \
CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libwebp)" \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \
)

View file

@ -23,21 +23,13 @@ libwps_CPPFLAGS+=$(gb_COMPILERDEFS_STDLIB_DEBUG)
libwps_CXXFLAGS=$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libwps)
libwps_LDFLAGS=
libwps_LDFLAGS=$(call gb_ExternalProject_get_link_flags,libwps)
ifeq ($(OS),LINUX)
ifeq ($(SYSTEM_REVENGE),)
libwps_LDFLAGS+=-Wl,-z,origin -Wl,-rpath,\$$$$ORIGIN
endif
endif
ifeq ($(ENABLE_GDB_INDEX),TRUE)
libwps_LDFLAGS+=-Wl,--gdb-index
libwps_CXXFLAGS+=-ggnu-pubnames
ifneq ($(USE_LD),)
libwps_LDFLAGS += $(USE_LD)
endif
endif
$(call gb_ExternalProject_get_state_target,libwps,build) :
$(call gb_Trace_StartRange,libwps,EXTERNAL)
$(call gb_ExternalProject_run,build,\

View file

@ -40,7 +40,7 @@ $(call gb_ExternalProject_get_state_target,libxml2,build):
$(if $(debug),--with-run-debug) \
$(gb_CONFIGURE_PLATFORMS) \
$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________URELIB) \
LDFLAGS="$(if $(SYSBASE),-L$(SYSBASE)/usr/lib)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libxml2) $(if $(SYSBASE),-L$(SYSBASE)/usr/lib)" \
CFLAGS="$(CFLAGS) \
$(if $(SYSBASE),-I$(SYSBASE)/usr/include) \
$(call gb_ExternalProject_get_build_flags,libxml2)" \

View file

@ -40,6 +40,7 @@ $(call gb_ExternalProject_get_state_target,libzmf,build) :
$(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
CXXFLAGS="$(gb_CXXFLAGS) $(call gb_ExternalProject_get_build_flags,libzmf)" \
CPPFLAGS="$(CPPFLAGS) $(BOOST_CPPFLAGS)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,libzmf)" \
$(gb_CONFIGURE_PLATFORMS) \
&& $(MAKE) \
)

View file

@ -21,6 +21,7 @@ $(call gb_ExternalProject_get_state_target,mythes,build):
$(call gb_Trace_StartRange,mythes,EXTERNAL)
$(call gb_ExternalProject_run,build,\
CXXFLAGS=" $(CXXFLAGS) $(call gb_ExternalProject_get_build_flags,mythes)" \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,mythes)" \
LIBS="$(gb_STDLIBS) $(LIBS)" $(gb_RUN_CONFIGURE) ./configure --disable-shared --with-pic \
$(gb_CONFIGURE_PLATFORMS) \
$(if $(CROSS_COMPILING),gio_can_sniff=no) \

View file

@ -24,7 +24,7 @@ ifeq ($(OS),LINUX) # i.e., assuming glibc
openldap_CFLAGS = -D_XOPEN_SOURCE=500 -D_DEFAULT_SOURCE -D_BSD_SOURCE
endif
openldap_LDFLAGS =
openldap_LDFLAGS = $(call gb_ExternalProject_get_link_flags,openldap)
ifeq ($(SYSTEM_NSS),)
openldap_LDFLAGS += -L$(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib \
$(if $(filter AIX,$(OS)),-Wl$(COMMA)-brtl)

View file

@ -69,7 +69,7 @@ $(call gb_ExternalProject_get_state_target,xmlsec,build) :
) \
$(gb_CONFIGURE_PLATFORMS) \
$(if $(SYSBASE),CFLAGS="-I$(SYSBASE)/usr/include" \
LDFLAGS="-L$(SYSBASE)/usr/lib $(if $(filter-out LINUX FREEBSD,$(OS)),",-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN)) \
LDFLAGS="$(call gb_ExternalProject_get_link_flags,xmlsec) -L$(SYSBASE)/usr/lib $(if $(filter-out LINUX FREEBSD,$(OS)),",-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath$(COMMA)\\"\$$\$$ORIGIN)) \
&& $(MAKE) \
)
$(call gb_Trace_EndRange,xmlsec,EXTERNAL)

View file

@ -210,6 +210,10 @@ endef
# gb_ExternalProject_get_build_flags project
gb_ExternalProject_get_build_flags = $(call gb_LinkTarget__get_debugflags,ExternalProject_$(1))
# Returns flags to include in LDFLAGS to enable optimizations and/or debugging.
# gb_ExternalProject_get_link_flags project
gb_ExternalProject_get_link_flags = $(USE_LD) $(call gb_LinkTarget__get_debugldflags,ExternalProject_$(1))
# Run a target command
#
# This provides a wrapper that changes to the right directory,