(options []string)
| 77 | } |
| 78 | |
| 79 | func (b b2) Configure(options []string) error { |
| 80 | toolchain := b.Ctx.Platform().GetToolchain() |
| 81 | |
| 82 | // Clean build cache. |
| 83 | if err := b.Clean(); err != nil { |
| 84 | return err |
| 85 | } |
| 86 | |
| 87 | // Execute configure. |
| 88 | logPath := b.getLogPath("configure") |
| 89 | title := fmt.Sprintf("[configure %s]", b.PortConfig.nameVersion()) |
| 90 | configure := expr.If(runtime.GOOS == "windows", "bootstrap.bat", "./bootstrap.sh") |
| 91 | |
| 92 | // For cross-compilation, set --prefix to dependency directory. |
| 93 | rootfs := b.Ctx.RootFS() |
| 94 | if !b.DevDep && rootfs != nil { |
| 95 | depsDir := filepath.Join(dirs.TmpDepsDir, b.PortConfig.LibraryDir) |
| 96 | configure = fmt.Sprintf("%s --prefix=%s", configure, depsDir) |
| 97 | } |
| 98 | |
| 99 | executor := cmd.NewExecutor(title, configure) |
| 100 | executor.SetWorkDir(b.PortConfig.SrcDir) |
| 101 | executor.SetLogPath(logPath) |
| 102 | if err := executor.Execute(); err != nil { |
| 103 | return err |
| 104 | } |
| 105 | |
| 106 | // Modify project-config.jam to set cross-compiling tool for none-runtime library. |
| 107 | if !b.DevDep { |
| 108 | configPath := filepath.Join(b.PortConfig.SrcDir, "project-config.jam") |
| 109 | file, err := os.OpenFile(configPath, os.O_RDONLY, os.ModePerm) |
| 110 | if err != nil { |
| 111 | return err |
| 112 | } |
| 113 | defer file.Close() |
| 114 | |
| 115 | // Override project-config.jam. |
| 116 | cxx := filepath.Join(toolchain.GetAbsDir(), toolchain.GetCXX()) |
| 117 | |
| 118 | // For cross-compilation, use version identifier to distinguish toolchain. |
| 119 | var toolchainVersion string |
| 120 | rootfs := b.Ctx.RootFS() |
| 121 | if !b.DevDep && rootfs != nil { |
| 122 | toolchainVersion = toolchain.GetVersion() |
| 123 | } else { |
| 124 | toolchainVersion = "" |
| 125 | } |
| 126 | |
| 127 | // Determine whether the toolchain is Clang. |
| 128 | // In windows, "clang-cl" is not a real clang toolchain, it's a wrapper of MSVC. |
| 129 | isClang := strings.Contains(toolchain.GetName(), "clang") && toolchain.GetName() != "clang-cl" |
| 130 | isQNX := toolchain.GetName() == "qcc" |
| 131 | |
| 132 | var buffer bytes.Buffer |
| 133 | scanner := bufio.NewScanner(file) |
| 134 | for scanner.Scan() { |
| 135 | line := scanner.Text() |
| 136 | if strings.Contains(line, "using gcc ;") { |
nothing calls this directly
no test coverage detected