go: update from 1.7.4 to 1.8

Release notes of new release: https://golang.org/doc/go1.8
The patch adding support of PKG_CONFIG is not needed anymore:
it was merged to upstream: https://github.com/golang/go/commit/5dcb31b2d55
This commit is contained in:
Boris Nagaev 2017-02-18 02:30:37 +01:00
parent ed4948e9f5
commit 0c4807ff0e
2 changed files with 2 additions and 109 deletions

View File

@ -1,107 +0,0 @@
This file is part of MXE. See LICENSE.md for licensing information.
Contains ad hoc patches for cross building.
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Boris Nagaev <bnagaev@gmail.com>
Date: Sat, 25 Jun 2016 13:51:06 +0200
Subject: [PATCH] cgo: add environment variable override for pkg-config
Allow overriding default name of `pkg-config` utility via
environment variable PKG_CONFIG (same as used by autoconf
pkg.m4 macros). This facilitates easy cross-compilation of cgo
code.
Original patch against Go <= 1.4 was written by
xnox_canonical <dimitri.ledkov@canonical.com> in 2014.
Source: https://codereview.appspot.com/104960043/
Rebased against Go 1.6.2 by Boris Nagaev <bnagaev@gmail.com>.
diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go
index 1111111..2222222 100644
--- a/src/cmd/dist/build.go
+++ b/src/cmd/dist/build.go
@@ -41,6 +41,7 @@ var (
defaultldflags string
defaultcxxtarget string
defaultcctarget string
+ defaultpkgconfigtarget string
rebuildall bool
defaultclang bool
@@ -203,6 +204,12 @@ func xinit() {
}
defaultcxxtarget = b
+ b = os.Getenv("PKG_CONFIG")
+ if b == "" {
+ b = "pkg-config"
+ }
+ defaultpkgconfigtarget = b
+
// For tools being invoked but also for os.ExpandEnv.
os.Setenv("GO386", go386)
os.Setenv("GOARCH", goarch)
diff --git a/src/cmd/dist/buildgo.go b/src/cmd/dist/buildgo.go
index 1111111..2222222 100644
--- a/src/cmd/dist/buildgo.go
+++ b/src/cmd/dist/buildgo.go
@@ -15,6 +15,7 @@ import "fmt"
// package main
// const defaultCC = <defaultcc>
// const defaultCXX = <defaultcxx>
+// const defaultPkgConfig = <defaultpkgconfig>
//
// It is invoked to write cmd/go/zdefaultcc.go
// but we also write cmd/cgo/zdefaultcc.go
@@ -27,8 +28,9 @@ func mkzdefaultcc(dir, file string) {
"package main\n"+
"\n"+
"const defaultCC = `%s`\n"+
- "const defaultCXX = `%s`\n",
- defaultcctarget, defaultcxxtarget)
+ "const defaultCXX = `%s`\n"+
+ "const defaultPkgConfig = `%s`\n",
+ defaultcctarget, defaultcxxtarget, defaultpkgconfigtarget)
writefile(out, file, writeSkipSame)
diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go
index 1111111..2222222 100644
--- a/src/cmd/go/build.go
+++ b/src/cmd/go/build.go
@@ -1575,13 +1575,19 @@ func (b *builder) build(a *action) (err error) {
return nil
}
+// pkgconfigCmd returns a pkg-config binary name
+// defaultPkgConfig is defined in zdefaultcc.go, written by cmd/dist.
+func (b *builder) pkgconfigCmd() string {
+ return envList("PKG_CONFIG", defaultPkgConfig)[0]
+}
+
// Calls pkg-config if needed and returns the cflags/ldflags needed to build the package.
func (b *builder) getPkgConfigFlags(p *Package) (cflags, ldflags []string, err error) {
if pkgs := p.CgoPkgConfig; len(pkgs) > 0 {
var out []byte
- out, err = b.runOut(p.Dir, p.ImportPath, nil, "pkg-config", "--cflags", pkgs)
+ out, err = b.runOut(p.Dir, p.ImportPath, nil, b.pkgconfigCmd(), "--cflags", pkgs)
if err != nil {
- b.showOutput(p.Dir, "pkg-config --cflags "+strings.Join(pkgs, " "), string(out))
+ b.showOutput(p.Dir, b.pkgconfigCmd()+" --cflags "+strings.Join(pkgs, " "), string(out))
b.print(err.Error() + "\n")
err = errPrintedOutput
return
@@ -1589,9 +1595,9 @@ func (b *builder) getPkgConfigFlags(p *Package) (cflags, ldflags []string, err e
if len(out) > 0 {
cflags = strings.Fields(string(out))
}
- out, err = b.runOut(p.Dir, p.ImportPath, nil, "pkg-config", "--libs", pkgs)
+ out, err = b.runOut(p.Dir, p.ImportPath, nil, b.pkgconfigCmd(), "--libs", pkgs)
if err != nil {
- b.showOutput(p.Dir, "pkg-config --libs "+strings.Join(pkgs, " "), string(out))
+ b.showOutput(p.Dir, b.pkgconfigCmd()+" --libs "+strings.Join(pkgs, " "), string(out))
b.print(err.Error() + "\n")
err = errPrintedOutput
return

View File

@ -4,8 +4,8 @@ PKG := go
$(PKG)_WEBSITE := https://golang.org/
$(PKG)_OWNER := https://github.com/starius
$(PKG)_IGNORE :=
$(PKG)_VERSION := 1.7.4
$(PKG)_CHECKSUM := 4c189111e9ba651a2bb3ee868aa881fab36b2f2da3409e80885ca758a6b614cc
$(PKG)_VERSION := 1.8
$(PKG)_CHECKSUM := 406865f587b44be7092f206d73fc1de252600b79b3cacc587b74b5ef5c623596
$(PKG)_SUBDIR := go
$(PKG)_FILE := go$($(PKG)_VERSION).src.tar.gz
$(PKG)_URL := https://storage.googleapis.com/golang/$($(PKG)_FILE)