MCPcopy Create free account
hub / github.com/celer-pkg/celer / expandVariables

Method expandVariables

buildsystems/buildconfig.go:885–902  ·  view source on GitHub ↗

expandVariables expands placeholder variables in the given string and returns the result. Placeholders like ${CC}, ${CXX}, ${SYSROOT}, etc. are replaced with actual values.

(content string)

Source from the content-addressed store, hash-verified

883// expandVariables expands placeholder variables in the given string and returns the result.
884// Placeholders like ${CC}, ${CXX}, ${SYSROOT}, etc. are replaced with actual values.
885func (b BuildConfig) expandVariables(content string) string {
886 toolchain := b.Ctx.Platform().GetToolchain()
887 rootfs := b.Ctx.Platform().GetRootFS()
888
889 // Replace ${CC}, ${CXX}, ${HOST_CC} for compiler paths.
890 // For Clang with sysroot, add --gcc-toolchain to find GCC runtime files.
891 ccValue := toolchain.GetCC()
892 cxxValue := toolchain.GetCXX()
893 if !b.DevDep && rootfs != nil && toolchain.GetName() == "clang" {
894 ccValue += " --gcc-toolchain=/usr"
895 cxxValue += " --gcc-toolchain=/usr"
896 }
897 content = strings.ReplaceAll(content, "${CC}", ccValue)
898 content = strings.ReplaceAll(content, "${CXX}", cxxValue)
899
900 content = b.ExprVars.Expand(content)
901 return content
902}
903
904// IsPythonPackage returns true if the build config references Python placeholders
905// in its custom commands, indicating it's a Python package that should be installed

Callers 15

setupEnvsMethod · 0.95
preConfigureMethod · 0.95
postConfigureMethod · 0.95
preBuildMethod · 0.95
postBuildMethod · 0.95
preInstallMethod · 0.95
postInstallMethod · 0.95
fixBuildMethod · 0.95
configureOptionsMethod · 0.80
generateCrossFileMethod · 0.80
ConfigureMethod · 0.80
BuildMethod · 0.80

Calls 7

ExpandMethod · 0.80
GetToolchainMethod · 0.65
PlatformMethod · 0.65
GetRootFSMethod · 0.65
GetCCMethod · 0.65
GetCXXMethod · 0.65
GetNameMethod · 0.65

Tested by

no test coverage detected