From 1ffd6897ddf15624e70585ab08e8af713114c938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Fri, 29 Apr 2022 15:50:22 +0200 Subject: [PATCH] try to use also proper debug LDFLAGS for externals libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is basically ea68de2968c0dbcd8e7549435e829db06795c16d 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 --- external/cairo/ExternalProject_cairo.mk | 4 +++- external/curl/ExternalProject_curl.mk | 3 ++- external/firebird/ExternalProject_firebird.mk | 1 + external/fontconfig/ExternalProject_fontconfig.mk | 1 + external/freetype/ExternalProject_freetype.mk | 1 + external/harfbuzz/ExternalProject_harfbuzz.mk | 1 + external/hunspell/ExternalProject_hunspell.mk | 2 +- external/hyphen/ExternalProject_hyphen.mk | 1 + external/icu/ExternalProject_icu.mk | 1 + external/libabw/ExternalProject_libabw.mk | 1 + .../libatomic_ops/ExternalProject_libatomic_ops.mk | 7 ++++++- external/libcdr/ExternalProject_libcdr.mk | 1 + external/libebook/ExternalProject_libebook.mk | 1 + external/libepubgen/ExternalProject_libepubgen.mk | 1 + .../libexttextcat/ExternalProject_libexttextcat.mk | 1 + external/libfreehand/ExternalProject_libfreehand.mk | 1 + external/libmspub/ExternalProject_libmspub.mk | 1 + .../libnumbertext/ExternalProject_libnumbertext.mk | 1 + external/liborcus/ExternalProject_liborcus.mk | 10 ++-------- external/libpagemaker/ExternalProject_libpagemaker.mk | 1 + external/libqxp/ExternalProject_libqxp.mk | 1 + external/libvisio/ExternalProject_libvisio.mk | 1 + external/libwebp/ExternalProject_libwebp.mk | 1 + external/libwps/ExternalProject_libwps.mk | 10 +--------- external/libxml2/ExternalProject_libxml2.mk | 2 +- external/libzmf/ExternalProject_libzmf.mk | 1 + external/mythes/ExternalProject_mythes.mk | 1 + external/openldap/ExternalProject_openldap.mk | 2 +- external/xmlsec/ExternalProject_xmlsec.mk | 2 +- solenv/gbuild/ExternalProject.mk | 4 ++++ 30 files changed, 42 insertions(+), 24 deletions(-) diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk index 7ad9b0c4ca0c..53a51b5e45ea 100644 --- a/external/cairo/ExternalProject_cairo.mk +++ b/external/cairo/ExternalProject_cairo.mk @@ -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") \ diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk index 3e63b402253d..6b524f4d5a1a 100644 --- a/external/curl/ExternalProject_curl.mk +++ b/external/curl/ExternalProject_curl.mk @@ -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) \ diff --git a/external/firebird/ExternalProject_firebird.mk b/external/firebird/ExternalProject_firebird.mk index 76427f34a455..35511951528c 100644 --- a/external/firebird/ExternalProject_firebird.mk +++ b/external/firebird/ExternalProject_firebird.mk @@ -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 \ ) \ diff --git a/external/fontconfig/ExternalProject_fontconfig.mk b/external/fontconfig/ExternalProject_fontconfig.mk index 3d0369d73ede..9f85faa393e4 100644 --- a/external/fontconfig/ExternalProject_fontconfig.mk +++ b/external/fontconfig/ExternalProject_fontconfig.mk @@ -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 \ diff --git a/external/freetype/ExternalProject_freetype.mk b/external/freetype/ExternalProject_freetype.mk index 0e28ab031f6a..2a61ac7d7be4 100644 --- a/external/freetype/ExternalProject_freetype.mk +++ b/external/freetype/ExternalProject_freetype.mk @@ -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) diff --git a/external/harfbuzz/ExternalProject_harfbuzz.mk b/external/harfbuzz/ExternalProject_harfbuzz.mk index 43d2e2e18ab4..f7767f7a7782 100644 --- a/external/harfbuzz/ExternalProject_harfbuzz.mk +++ b/external/harfbuzz/ExternalProject_harfbuzz.mk @@ -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) \ ) diff --git a/external/hunspell/ExternalProject_hunspell.mk b/external/hunspell/ExternalProject_hunspell.mk index a125c819c96e..c63498af73fc 100644 --- a/external/hunspell/ExternalProject_hunspell.mk +++ b/external/hunspell/ExternalProject_hunspell.mk @@ -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) diff --git a/external/hyphen/ExternalProject_hyphen.mk b/external/hyphen/ExternalProject_hyphen.mk index dac823184085..0d1a3e05271b 100644 --- a/external/hyphen/ExternalProject_hyphen.mk +++ b/external/hyphen/ExternalProject_hyphen.mk @@ -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) diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk index aa1ef439b315..d677016f9677 100644 --- a/external/icu/ExternalProject_icu.mk +++ b/external/icu/ExternalProject_icu.mk @@ -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) \ diff --git a/external/libabw/ExternalProject_libabw.mk b/external/libabw/ExternalProject_libabw.mk index 02473c2f818c..48edebf6a282 100644 --- a/external/libabw/ExternalProject_libabw.mk +++ b/external/libabw/ExternalProject_libabw.mk @@ -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) \ ) diff --git a/external/libatomic_ops/ExternalProject_libatomic_ops.mk b/external/libatomic_ops/ExternalProject_libatomic_ops.mk index 68fd752850cb..143eed2c075a 100644 --- a/external/libatomic_ops/ExternalProject_libatomic_ops.mk +++ b/external/libatomic_ops/ExternalProject_libatomic_ops.mk @@ -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) \ diff --git a/external/libcdr/ExternalProject_libcdr.mk b/external/libcdr/ExternalProject_libcdr.mk index e950db8d6551..c9f5401ac43f 100644 --- a/external/libcdr/ExternalProject_libcdr.mk +++ b/external/libcdr/ExternalProject_libcdr.mk @@ -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) \ ) diff --git a/external/libebook/ExternalProject_libebook.mk b/external/libebook/ExternalProject_libebook.mk index 7f5da19d6fce..3a3df8c71b00 100644 --- a/external/libebook/ExternalProject_libebook.mk +++ b/external/libebook/ExternalProject_libebook.mk @@ -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)" \ diff --git a/external/libepubgen/ExternalProject_libepubgen.mk b/external/libepubgen/ExternalProject_libepubgen.mk index 3cd170ed1bb6..f0dbf70a2eb2 100644 --- a/external/libepubgen/ExternalProject_libepubgen.mk +++ b/external/libepubgen/ExternalProject_libepubgen.mk @@ -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) \ ) diff --git a/external/libexttextcat/ExternalProject_libexttextcat.mk b/external/libexttextcat/ExternalProject_libexttextcat.mk index 8ed8554a99d2..8adaaee75324 100644 --- a/external/libexttextcat/ExternalProject_libexttextcat.mk +++ b/external/libexttextcat/ExternalProject_libexttextcat.mk @@ -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) diff --git a/external/libfreehand/ExternalProject_libfreehand.mk b/external/libfreehand/ExternalProject_libfreehand.mk index ada9732cecb3..554017cafd5f 100644 --- a/external/libfreehand/ExternalProject_libfreehand.mk +++ b/external/libfreehand/ExternalProject_libfreehand.mk @@ -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) \ ) diff --git a/external/libmspub/ExternalProject_libmspub.mk b/external/libmspub/ExternalProject_libmspub.mk index 7951b5b15a5e..f84e5c9b2214 100644 --- a/external/libmspub/ExternalProject_libmspub.mk +++ b/external/libmspub/ExternalProject_libmspub.mk @@ -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) \ ) diff --git a/external/libnumbertext/ExternalProject_libnumbertext.mk b/external/libnumbertext/ExternalProject_libnumbertext.mk index 36a9becf0846..bd96b162d888 100644 --- a/external/libnumbertext/ExternalProject_libnumbertext.mk +++ b/external/libnumbertext/ExternalProject_libnumbertext.mk @@ -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) diff --git a/external/liborcus/ExternalProject_liborcus.mk b/external/liborcus/ExternalProject_liborcus.mk index d067b741146a..e7f929a28b4c 100644 --- a/external/liborcus/ExternalProject_liborcus.mk +++ b/external/liborcus/ExternalProject_liborcus.mk @@ -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,\ diff --git a/external/libpagemaker/ExternalProject_libpagemaker.mk b/external/libpagemaker/ExternalProject_libpagemaker.mk index 87e407e9eea7..d663ffaf9ea9 100644 --- a/external/libpagemaker/ExternalProject_libpagemaker.mk +++ b/external/libpagemaker/ExternalProject_libpagemaker.mk @@ -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) \ ) diff --git a/external/libqxp/ExternalProject_libqxp.mk b/external/libqxp/ExternalProject_libqxp.mk index 89bc262ac128..fea48ffc4b11 100644 --- a/external/libqxp/ExternalProject_libqxp.mk +++ b/external/libqxp/ExternalProject_libqxp.mk @@ -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) \ ) diff --git a/external/libvisio/ExternalProject_libvisio.mk b/external/libvisio/ExternalProject_libvisio.mk index f0e632fade83..01fe27290f45 100644 --- a/external/libvisio/ExternalProject_libvisio.mk +++ b/external/libvisio/ExternalProject_libvisio.mk @@ -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) \ ) diff --git a/external/libwebp/ExternalProject_libwebp.mk b/external/libwebp/ExternalProject_libwebp.mk index 7b94845cd057..3f38572ccefc 100644 --- a/external/libwebp/ExternalProject_libwebp.mk +++ b/external/libwebp/ExternalProject_libwebp.mk @@ -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) \ ) diff --git a/external/libwps/ExternalProject_libwps.mk b/external/libwps/ExternalProject_libwps.mk index 2fb91ee59b1a..5ff5997f6021 100644 --- a/external/libwps/ExternalProject_libwps.mk +++ b/external/libwps/ExternalProject_libwps.mk @@ -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,\ diff --git a/external/libxml2/ExternalProject_libxml2.mk b/external/libxml2/ExternalProject_libxml2.mk index 41f5c37c6f5b..7bb2b58956b9 100644 --- a/external/libxml2/ExternalProject_libxml2.mk +++ b/external/libxml2/ExternalProject_libxml2.mk @@ -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)" \ diff --git a/external/libzmf/ExternalProject_libzmf.mk b/external/libzmf/ExternalProject_libzmf.mk index 8c61dd5f29de..1a338526c12b 100644 --- a/external/libzmf/ExternalProject_libzmf.mk +++ b/external/libzmf/ExternalProject_libzmf.mk @@ -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) \ ) diff --git a/external/mythes/ExternalProject_mythes.mk b/external/mythes/ExternalProject_mythes.mk index 7ebdfa839319..b0e0a6bbdb1d 100644 --- a/external/mythes/ExternalProject_mythes.mk +++ b/external/mythes/ExternalProject_mythes.mk @@ -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) \ diff --git a/external/openldap/ExternalProject_openldap.mk b/external/openldap/ExternalProject_openldap.mk index d5e1189cdef3..5f85fb323056 100644 --- a/external/openldap/ExternalProject_openldap.mk +++ b/external/openldap/ExternalProject_openldap.mk @@ -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) diff --git a/external/xmlsec/ExternalProject_xmlsec.mk b/external/xmlsec/ExternalProject_xmlsec.mk index b4e784099cf9..f41e9362fd0b 100644 --- a/external/xmlsec/ExternalProject_xmlsec.mk +++ b/external/xmlsec/ExternalProject_xmlsec.mk @@ -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) diff --git a/solenv/gbuild/ExternalProject.mk b/solenv/gbuild/ExternalProject.mk index 77a8c85dbf1f..68910712ff6d 100644 --- a/solenv/gbuild/ExternalProject.mk +++ b/solenv/gbuild/ExternalProject.mk @@ -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,