This is an automated email from the ASF dual-hosted git repository.

sjanc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git

commit fef385af4170fe528b6ba087c8b9cd56ddf999b5
Author: Szymon Janc <[email protected]>
AuthorDate: Thu Oct 15 00:00:33 2026 +0200

    newt/toolchain: Allow syscfg conditionals in compiler.yml
    
    Conditional keys in compiler.yml were evaluated only against the build
    profile and host OS. Include syscfg values as well so that compiler
    flags can depend on target configuration, e.g.:
    
    compiler.flags.base.COMPILER_WERROR: [-Werror]
    
    When no target configuration is available, the default values from
    the compiler package syscfg.yml are used, as is already done for
    $(SETTING) substitution.
    
    Assisted-by: Claude:claude-opus-5-5
---
 newt/toolchain/compiler.go | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go
index 7194713b..cc5bf92b 100644
--- a/newt/toolchain/compiler.go
+++ b/newt/toolchain/compiler.go
@@ -401,10 +401,15 @@ func (c *Compiler) load(compilerDir string, buildProfile 
string, cfg *cfgv.Setti
                }
        }
 
-       settings := cfgv.NewSettingsFromMap(map[string]string{
-               buildProfile:                  "1",
-               strings.ToUpper(runtime.GOOS): "1",
-       })
+       // Settings in compiler.yml can be conditional on syscfg values, the
+       // build profile and the host OS.
+       settingsMap := map[string]string{}
+       if cfg != nil {
+               settingsMap = cfg.ToMap()
+       }
+       settingsMap[buildProfile] = "1"
+       settingsMap[strings.ToUpper(runtime.GOOS)] = "1"
+       settings := cfgv.NewSettingsFromMap(settingsMap)
 
        c.ccPath, err = yc.GetValString("compiler.path.cc", settings)
        util.OneTimeWarningError(err)

Reply via email to