main: add the absolute path to clang-8 on macOS
This avoids the need to correctly set $PATH if LLVM 8 has been installed using Homebrew.
Этот коммит содержится в:
родитель
3a73e64557
коммит
5a7bab8808
1 изменённых файлов: 11 добавлений и 0 удалений
11
commands.go
11
commands.go
|
@ -4,6 +4,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -15,6 +16,16 @@ var commands = map[string][]string{
|
||||||
"wasm-ld": {"wasm-ld-8", "wasm-ld"},
|
"wasm-ld": {"wasm-ld-8", "wasm-ld"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
// Add the path to a Homebrew-installed LLVM 8 for ease of use (no need to
|
||||||
|
// manually set $PATH).
|
||||||
|
if runtime.GOOS == "darwin" {
|
||||||
|
commands["clang"] = append(commands["clang"], "/usr/local/opt/llvm/bin/clang-8")
|
||||||
|
commands["ld.lld"] = append(commands["ld.lld"], "/usr/local/opt/llvm/bin/ld.lld")
|
||||||
|
commands["wasm-ld"] = append(commands["wasm-ld"], "/usr/local/opt/llvm/bin/wasm-ld")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func execCommand(cmdNames []string, args ...string) error {
|
func execCommand(cmdNames []string, args ...string) error {
|
||||||
for _, cmdName := range cmdNames {
|
for _, cmdName := range cmdNames {
|
||||||
cmd := exec.Command(cmdName, args...)
|
cmd := exec.Command(cmdName, args...)
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче