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.
Этот коммит содержится в:
Ayke van Laethem 2019-05-21 15:12:33 +02:00 коммит произвёл Ron Evans
родитель 3a73e64557
коммит 5a7bab8808

Просмотреть файл

@ -4,6 +4,7 @@ import (
"errors"
"os"
"os/exec"
"runtime"
"strings"
)
@ -15,6 +16,16 @@ var commands = map[string][]string{
"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 {
for _, cmdName := range cmdNames {
cmd := exec.Command(cmdName, args...)