Add a way to bake-in final TINYGOROOT.
This is similar to setting FINAL_GOROOT when building standard Go.
Этот коммит содержится в:
родитель
9d35c1197f
коммит
869d2c4524
1 изменённых файлов: 13 добавлений и 0 удалений
13
target.go
13
target.go
|
@ -15,6 +15,11 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TINYGOROOT is the path to the final location for checking tinygo files. If
|
||||||
|
// unset (by a -X ldflag), then sourceDir() will fallback to the original build
|
||||||
|
// directory.
|
||||||
|
var TINYGOROOT string
|
||||||
|
|
||||||
// Target specification for a given target. Used for bare metal targets.
|
// Target specification for a given target. Used for bare metal targets.
|
||||||
//
|
//
|
||||||
// The target specification is mostly inspired by Rust:
|
// The target specification is mostly inspired by Rust:
|
||||||
|
@ -270,6 +275,14 @@ func sourceDir() string {
|
||||||
return root
|
return root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if TINYGOROOT != "" {
|
||||||
|
if !isSourceDir(TINYGOROOT) {
|
||||||
|
fmt.Fprintln(os.Stderr, "error: TINYGOROOT was not set to the correct root")
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
return TINYGOROOT
|
||||||
|
}
|
||||||
|
|
||||||
// Find root from executable path.
|
// Find root from executable path.
|
||||||
path, err := os.Executable()
|
path, err := os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче