()
| 86 | } |
| 87 | |
| 88 | func (m makefiles) configureOptions() ([]string, error) { |
| 89 | var options = slices.Clone(m.Options) |
| 90 | configureWithPerl := m.shouldConfigureWithPerl() |
| 91 | if configureWithPerl { |
| 92 | release := m.DevDep || (m.BuildType == "release" || m.BuildType == "relwithdebinfo" || m.BuildType == "minsizerel") |
| 93 | options = append(options, expr.If(release, "--release", "--debug")) |
| 94 | } |
| 95 | |
| 96 | // Remove common cross compile args for native build. |
| 97 | toolchain := m.Ctx.Platform().GetToolchain() |
| 98 | toolchainName := toolchain.GetName() |
| 99 | if m.PortConfig.HostDev || m.BuildConfig.DevDep || |
| 100 | toolchainName == "msvc" || toolchainName == "clang-cl" { |
| 101 | options = slices.DeleteFunc(options, func(element string) bool { |
| 102 | return strings.HasPrefix(element, "--host=") || |
| 103 | strings.HasPrefix(element, "--sysroot=") || |
| 104 | strings.HasPrefix(element, "--arch=") || |
| 105 | strings.HasPrefix(element, "--cross-prefix=") || |
| 106 | strings.HasPrefix(element, "--target-os") || |
| 107 | strings.HasPrefix(element, "--build=") || |
| 108 | strings.HasPrefix(element, "--with-build-python=") || |
| 109 | strings.HasPrefix(element, "--enable-cross-compile") |
| 110 | }) |
| 111 | } |
| 112 | |
| 113 | // Makefiles configure scripts use project-specific flags |
| 114 | // (--enable-shared, --with-shared, ...), so the extra option are |
| 115 | // supplied per-port via build_shared_option / build_static_option. |
| 116 | // In default, celer set "--enable-shared" for `build_shared_option`, |
| 117 | // and set "--enable-static" for `build_static_option`. |
| 118 | libraryType := m.BuildConfig.buildLibraryType() |
| 119 | if libraryType.shared { |
| 120 | sharedOption := m.BuildConfig.BuildSharedOption |
| 121 | if sharedOption == "" { |
| 122 | sharedOption = "--enable-shared" |
| 123 | } |
| 124 | options = append(options, sharedOption) |
| 125 | } |
| 126 | if libraryType.static { |
| 127 | staticOption := m.BuildConfig.BuildStaticOption |
| 128 | if staticOption == "" { |
| 129 | staticOption = "--enable-static" |
| 130 | } |
| 131 | options = append(options, staticOption) |
| 132 | } |
| 133 | |
| 134 | // Add ccache support for projects that need explicit --cc parameter, like ffmpeg. |
| 135 | if m.Ctx.CCacheEnabled() { |
| 136 | for index, option := range options { |
| 137 | if after, ok := strings.CutPrefix(option, "--cc="); ok { |
| 138 | options[index] = fmt.Sprintf("--cc='ccache %s'", after) |
| 139 | } |
| 140 | } |
| 141 | for index, option := range options { |
| 142 | if after, ok := strings.CutPrefix(option, "--cxx="); ok { |
| 143 | options[index] = fmt.Sprintf("--cxx='ccache %s'", after) |
| 144 | } |
| 145 | } |
nothing calls this directly
no test coverage detected