mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 07:23:39 +00:00
all: use compiler-rt for builtins
This commit is contained in:
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"os/user"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
@@ -17,6 +18,7 @@ type TargetSpec struct {
|
||||
Triple string `json:"llvm-target"`
|
||||
BuildTags []string `json:"build-tags"`
|
||||
Linker string `json:"linker"`
|
||||
CompilerRT bool `json:"compiler-rt"`
|
||||
PreLinkArgs []string `json:"pre-link-args"`
|
||||
Objcopy string `json:"objcopy"`
|
||||
Flasher string `json:"flash"`
|
||||
@@ -72,16 +74,19 @@ func getGopath() string {
|
||||
}
|
||||
|
||||
// fallback
|
||||
var home string
|
||||
if runtime.GOOS == "windows" {
|
||||
home = os.Getenv("USERPROFILE")
|
||||
} else {
|
||||
home = os.Getenv("HOME")
|
||||
}
|
||||
if home == "" {
|
||||
// This is very unlikely, so panic here.
|
||||
// Not the nicest solution, however.
|
||||
panic("no $HOME or %USERPROFILE% found")
|
||||
}
|
||||
home := getHomeDir()
|
||||
return filepath.Join(home, "go")
|
||||
}
|
||||
|
||||
func getHomeDir() string {
|
||||
u, err := user.Current()
|
||||
if err != nil {
|
||||
panic("cannot get current user: " + err.Error())
|
||||
}
|
||||
if u.HomeDir == "" {
|
||||
// This is very unlikely, so panic here.
|
||||
// Not the nicest solution, however.
|
||||
panic("could not find home directory")
|
||||
}
|
||||
return u.HomeDir
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user