未验证 提交 7d343b6b 编写于 作者: K Koichi Shiraishi 提交者: GitHub

_scripts: support macOS Big Sur (#2437)

上级 4eb54b01
......@@ -213,7 +213,7 @@ func installedExecutablePath() string {
// i.e. cgo enabled and the legacy SDK headers:
// https://forums.developer.apple.com/thread/104296
func canMacnative() bool {
if runtime.GOOS != "darwin" {
if !(runtime.GOOS == "darwin" && runtime.GOARCH == "amd64") {
return false
}
if strings.TrimSpace(getoutput("go", "env", "CGO_ENABLED")) != "1" {
......@@ -221,13 +221,18 @@ func canMacnative() bool {
}
macOSVersion := strings.Split(strings.TrimSpace(getoutput("/usr/bin/sw_vers", "-productVersion")), ".")
major, err := strconv.ParseInt(macOSVersion[0], 10, 64)
if err != nil {
return false
}
minor, err := strconv.ParseInt(macOSVersion[1], 10, 64)
if err != nil {
return false
}
typesHeader := "/usr/include/sys/types.h"
if minor >= 15 {
if major >= 11 || (major == 10 && minor >= 15) {
typesHeader = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/types.h"
}
_, err = os.Stat(typesHeader)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册