[tbb-commits] [tor-browser-build/master] Bug 32027: Bump Go to 1.13.10
sysrqb at torproject.org
sysrqb at torproject.org
Mon Apr 27 22:05:03 UTC 2020
commit 260a8442b8b34ace8920c93b3e92cbe3e06a0c7f
Author: Georg Koppen <gk at torproject.org>
Date: Sat Apr 18 08:04:50 2020 +0000
Bug 32027: Bump Go to 1.13.10
Patch based on dcf's GO111MODULE idea as outlined in #32027. Thanks!
---
.../go/0001-Use-fixed-go-build-tmp-directory.patch | 22 ++++-----
.../90a3ce02dc25adcf1598faf11a66b151ada3f637.patch | 57 ----------------------
projects/go/build | 2 -
projects/go/config | 12 +++--
projects/obfs4/build | 7 +--
projects/snowflake/build | 4 --
6 files changed, 23 insertions(+), 81 deletions(-)
diff --git a/projects/go/0001-Use-fixed-go-build-tmp-directory.patch b/projects/go/0001-Use-fixed-go-build-tmp-directory.patch
index a10e059..022aa23 100644
--- a/projects/go/0001-Use-fixed-go-build-tmp-directory.patch
+++ b/projects/go/0001-Use-fixed-go-build-tmp-directory.patch
@@ -1,33 +1,33 @@
-From 44e3391a5a3d9a2c4b57f78e43414465ab84681e Mon Sep 17 00:00:00 2001
-From: Nicolas Vigier <boklm at torproject.org>
-Date: Thu, 27 Jun 2019 19:21:05 +0200
+From 958f724b1b434702c3d44ceaca646791674d07b1 Mon Sep 17 00:00:00 2001
+From: Georg Koppen <gk at torproject.org>
+Date: Fri, 17 Apr 2020 10:24:23 +0000
Subject: [PATCH] Use fixed go-build tmp directory
Use fixed go-build tmp directory, when the directory does not exist, in
order to avoid some reproducibility issues where build directory gets
embedded in generated binaries.
----
- src/cmd/go/internal/work/action.go | 10 +++++++---
- 1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/cmd/go/internal/work/action.go b/src/cmd/go/internal/work/action.go
-index 1f91046eb1..ba74b26a38 100644
+index 33b7818fb2..5e369d0f53 100644
--- a/src/cmd/go/internal/work/action.go
+++ b/src/cmd/go/internal/work/action.go
-@@ -224,9 +224,13 @@ func (b *Builder) Init() {
+@@ -249,9 +249,13 @@ func (b *Builder) Init() {
if cfg.BuildN {
b.WorkDir = "$WORK"
} else {
-- tmp, err := ioutil.TempDir(os.Getenv("GOTMPDIR"), "go-build")
+- tmp, err := ioutil.TempDir(cfg.Getenv("GOTMPDIR"), "go-build")
- if err != nil {
- base.Fatalf("go: creating work dir: %v", err)
-+ tmp := filepath.Join(os.Getenv("GOTMPDIR"), "go-build-workdir")
++ tmp := filepath.Join(cfg.Getenv("GOTMPDIR"), "go-build-workdir")
+ _, err := os.Stat(tmp)
+ if !os.IsNotExist(err) {
-+ tmp, err = ioutil.TempDir(os.Getenv("GOTMPDIR"), "go-build")
++ tmp, err = ioutil.TempDir(cfg.Getenv("GOTMPDIR"), "go-build")
+ if err != nil {
+ base.Fatalf("go: creating work dir: %v", err)
+ }
}
if !filepath.IsAbs(tmp) {
abs, err := filepath.Abs(tmp)
+--
+2.26.1
+
diff --git a/projects/go/90a3ce02dc25adcf1598faf11a66b151ada3f637.patch b/projects/go/90a3ce02dc25adcf1598faf11a66b151ada3f637.patch
deleted file mode 100644
index dc66809..0000000
--- a/projects/go/90a3ce02dc25adcf1598faf11a66b151ada3f637.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-From 90a3ce02dc25adcf1598faf11a66b151ada3f637 Mon Sep 17 00:00:00 2001
-From: Elias Naur <mail at eliasnaur.com>
-Date: Wed, 27 Mar 2019 14:25:24 +0100
-Subject: [PATCH] cmd/link/internal/ld: skip TLS section on Android
-
-We don't use the TLS section on android, and dropping it avoids
-complaints about underalignment from the Android Q linker.
-
-Updates #29674
-
-Change-Id: I91dabf2a58e6eb1783872639a6a144858db09cef
-Reviewed-on: https://go-review.googlesource.com/c/go/+/169618
-Reviewed-by: Ian Lance Taylor <iant at golang.org>
----
- src/cmd/link/internal/ld/lib.go | 29 +++++++++++++++++------------
- 1 file changed, 17 insertions(+), 12 deletions(-)
-
-diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
-index 1d44c0eb18b..b331e39fe3e 100644
---- a/src/cmd/link/internal/ld/lib.go
-+++ b/src/cmd/link/internal/ld/lib.go
-@@ -453,18 +453,23 @@ func (ctxt *Link) loadlib() {
- }
- }
-
-- tlsg := ctxt.Syms.Lookup("runtime.tlsg", 0)
--
-- // runtime.tlsg is used for external linking on platforms that do not define
-- // a variable to hold g in assembly (currently only intel).
-- if tlsg.Type == 0 {
-- tlsg.Type = sym.STLSBSS
-- tlsg.Size = int64(ctxt.Arch.PtrSize)
-- } else if tlsg.Type != sym.SDYNIMPORT {
-- Errorf(nil, "runtime declared tlsg variable %v", tlsg.Type)
-- }
-- tlsg.Attr |= sym.AttrReachable
-- ctxt.Tlsg = tlsg
-+ // The Android Q linker started to complain about underalignment of the our TLS
-+ // section. We don't actually use the section on android, so dont't
-+ // generate it.
-+ if objabi.GOOS != "android" {
-+ tlsg := ctxt.Syms.Lookup("runtime.tlsg", 0)
-+
-+ // runtime.tlsg is used for external linking on platforms that do not define
-+ // a variable to hold g in assembly (currently only intel).
-+ if tlsg.Type == 0 {
-+ tlsg.Type = sym.STLSBSS
-+ tlsg.Size = int64(ctxt.Arch.PtrSize)
-+ } else if tlsg.Type != sym.SDYNIMPORT {
-+ Errorf(nil, "runtime declared tlsg variable %v", tlsg.Type)
-+ }
-+ tlsg.Attr |= sym.AttrReachable
-+ ctxt.Tlsg = tlsg
-+ }
-
- var moduledata *sym.Symbol
- if ctxt.BuildMode == BuildModePlugin {
diff --git a/projects/go/build b/projects/go/build
index 06af067..02fba2b 100644
--- a/projects/go/build
+++ b/projects/go/build
@@ -68,8 +68,6 @@ cd /var/tmp/dist/go/src
CGO_ENABLED=1 CC_FOR_TARGET="$CC_FOR_TARGET" CC= CFLAGS= LDFLAGS= ./make.bash
[% ELSIF c("var/android") -%]
patch -p2 < $rootdir/0001-Use-fixed-go-build-tmp-directory.patch
- # Obfs4 breaks on Android Q without this patch, see: #32303
- patch -p2 < $rootdir/90a3ce02dc25adcf1598faf11a66b151ada3f637.patch
CGO_ENABLED=1 CC_FOR_TARGET=[% c("var/CC") %] CGO_CFLAGS='-D__ANDROID_API__=[% c("var/android_min_api") %]' CC= CFLAGS= LDFLAGS= ./make.bash
[% END -%]
diff --git a/projects/go/config b/projects/go/config
index 371f8c2..509c6da 100644
--- a/projects/go/config
+++ b/projects/go/config
@@ -1,5 +1,5 @@
# vim: filetype=yaml sw=2
-version: 1.12.13
+version: 1.13.10
filename: '[% project %]-[% c("version") %]-[% c("var/build_id") %].tar.gz'
var:
@@ -17,6 +17,9 @@ var:
export GOOS=[% c("var/GOOS") %]
export GOARCH=[% c("var/GOARCH") %]
[% END -%]
+ # Run in GOPATH mode: https://golang.org/cmd/go/#hdr-Module_support. (see:
+ # #32027)
+ export GO111MODULE=off
export GOPATH=/var/tmp/dist/gopath
export PATH=/var/tmp/dist/go/bin:/var/tmp/dist/gopath/bin:"$PATH"
[% IF c("var/linux") -%]
@@ -50,6 +53,9 @@ var:
do
patch -p1 < $p
done
+ # Run in GOPATH mode: https://golang.org/cmd/go/#hdr-Module_support. (see:
+ # #32027)
+ export GO111MODULE=off
[% IF c("var/build_go_lib_pre"); GET c("var/build_go_lib_pre"); END; -%]
[% IF c("var/go_lib_install") -%]
[% FOREACH inst IN c("var/go_lib_install") %]
@@ -112,11 +118,9 @@ input_files:
enable: '[% ! c("var/linux") %]'
- URL: 'https://golang.org/dl/go[% c("version") %].src.tar.gz'
name: go
- sha256sum: 5383d3b8db4baa48284ffcb14606d9cad6f03e9db843fa6d835b94d63cccf5a7
+ sha256sum: eb9ccc8bf59ed068e7eff73e154e4f5ee7eec0a47a610fb864e3332a2fdc8b8c
- URL: 'https://golang.org/dl/go[% c("var/go14_version") %].src.tar.gz'
name: go14
sha256sum: 9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959
- filename: 0001-Use-fixed-go-build-tmp-directory.patch
enable: '[% c("var/android") %]'
- - filename: 90a3ce02dc25adcf1598faf11a66b151ada3f637.patch
- enable: '[% c("var/android") %]'
diff --git a/projects/obfs4/build b/projects/obfs4/build
index 53b83df..47c7228 100644
--- a/projects/obfs4/build
+++ b/projects/obfs4/build
@@ -7,6 +7,9 @@ mkdir -p $PTDIR
[% IF c("var/android") -%]
[% pc(c('var/compiler'), 'var/setup', { compiler_tarfile => c('input_files_by_name/' _ c('var/compiler')) }) %]
+ # We need to explicitly set CGO_ENABLED with Go 1.13.x as the Android build
+ # breaks otherwise.
+ export CGO_ENABLED=1
[% END -%]
tar -C /var/tmp/dist -xf [% c('input_files_by_name/goptlib') %]
@@ -22,11 +25,9 @@ mkdir -p /var/tmp/build
tar -C /var/tmp/build -xf [% project %]-[% c('version') %].tar.gz
cd /var/tmp/build/[% project %]-[% c('version') %]
-# Remove go.mod and go.sum files until we can build using Go module
-# versioning (see bug 28325).
-rm -f go.mod go.sum
mkdir -p "$GOPATH/src/gitlab.com/yawning"
ln -sf "$PWD" "$GOPATH/src/gitlab.com/yawning/obfs4.git"
+
cd obfs4proxy
go build -ldflags '-s'
cp -a obfs4proxy[% IF c("var/windows") %].exe[% END %] $PTDIR
diff --git a/projects/snowflake/build b/projects/snowflake/build
index fe74e84..1aede45 100644
--- a/projects/snowflake/build
+++ b/projects/snowflake/build
@@ -15,10 +15,6 @@ cd /var/tmp/build/[% project %]-[% c('version') %]
mkdir -p "$GOPATH/src/git.torproject.org/pluggable-transports"
ln -sf "$PWD" "$GOPATH/src/git.torproject.org/pluggable-transports/snowflake.git"
-
-# Remove go.mod and go.sum files until we can build using Go module versioning
-rm -f go.mod go.sum
-
# Fix gopath location of versioned dependencies
ln -sf "$GOPATH/src/github.com/pion/webrtc" "$GOPATH/src/github.com/pion/webrtc/v2"
ln -sf "$GOPATH/src/github.com/pion/sdp" "$GOPATH/src/github.com/pion/sdp/v2"
More information about the tbb-commits
mailing list