expandOptions Replace placeholders with real paths and values.
()
| 855 | |
| 856 | // expandOptions Replace placeholders with real paths and values. |
| 857 | func (b *BuildConfig) expandOptions() { |
| 858 | // Remove cross compile args when build in dev mode. |
| 859 | if b.DevDep { |
| 860 | crossArgs := []string{ |
| 861 | "${HOST}", |
| 862 | "${SYSTEM_NAME}", |
| 863 | "${SYSTEM_PROCESSOR}", |
| 864 | "${SYSROOT}", |
| 865 | "${CROSSTOOL_PREFIX}", |
| 866 | } |
| 867 | b.Options = slices.DeleteFunc(b.Options, func(argument string) bool { |
| 868 | for _, item := range crossArgs { |
| 869 | if strings.Contains(argument, item) { |
| 870 | return true |
| 871 | } |
| 872 | } |
| 873 | return false |
| 874 | }) |
| 875 | } |
| 876 | |
| 877 | // Expand placeholders. |
| 878 | for index, argument := range b.Options { |
| 879 | b.Options[index] = b.ExprVars.Expand(argument) |
| 880 | } |
| 881 | } |
| 882 | |
| 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. |