From bea5c7bd67d6ad32acbdce79767a5481c70675a2 Mon Sep 17 00:00:00 2001 From: Isuru Fernando Date: Fri, 2 Apr 2021 03:11:06 -0500 Subject: [PATCH] feat: use LDFLAGS_host for host toolset (#98) This makes the behaviour similar to that of CFLAGS_host --- pylib/gyp/generator/make.py | 2 +- pylib/gyp/generator/ninja.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pylib/gyp/generator/make.py b/pylib/gyp/generator/make.py index 857875a5..eb9102dd 100644 --- a/pylib/gyp/generator/make.py +++ b/pylib/gyp/generator/make.py @@ -319,7 +319,7 @@ def CalculateGeneratorInputInfo(params): CXX.host ?= %(CXX.host)s CXXFLAGS.host ?= $(CPPFLAGS_host) $(CXXFLAGS_host) LINK.host ?= %(LINK.host)s -LDFLAGS.host ?= +LDFLAGS.host ?= $(LDFLAGS_host) AR.host ?= %(AR.host)s # Define a dir function that can handle spaces. diff --git a/pylib/gyp/generator/ninja.py b/pylib/gyp/generator/ninja.py index c57bec6a..ca032aef 100644 --- a/pylib/gyp/generator/ninja.py +++ b/pylib/gyp/generator/ninja.py @@ -1417,7 +1417,11 @@ def WriteLinkForArch( is_executable = spec["type"] == "executable" # The ldflags config key is not used on mac or win. On those platforms # linker flags are set via xcode_settings and msvs_settings, respectively. - env_ldflags = os.environ.get("LDFLAGS", "").split() + if self.toolset == "target": + env_ldflags = os.environ.get("LDFLAGS", "").split() + elif self.toolset == "host": + env_ldflags = os.environ.get("LDFLAGS_host", "").split() + if self.flavor == "mac": ldflags = self.xcode_settings.GetLdflags( config_name,