1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
|
diff -ur a/go-current/src/make.bash b/go-current/src/make.bash
--- a/go-current/src/make.bash Thu May 30 21:26:07 2024
+++ b/go-current/src/make.bash Fri Jun 7 01:22:26 2024
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
@@ -78,13 +78,13 @@
set -e
-if [[ ! -f run.bash ]]; then
+if [ ! -f run.bash ]; then
echo 'make.bash must be run from $GOROOT/src' 1>&2
exit 1
fi
-if [[ "$GOBUILDTIMELOGFILE" != "" ]]; then
- echo $(LC_TIME=C date) start make.bash >"$GOBUILDTIMELOGFILE"
+if [ "$GOBUILDTIMELOGFILE" != "" ]; then
+ echo "$(LC_TIME=C date) start make.bash" >"$GOBUILDTIMELOGFILE"
fi
# Test for Windows.
@@ -114,7 +114,7 @@
# so loop through the possible selinux mount points.
for se_mount in /selinux /sys/fs/selinux
do
- if [[ -d $se_mount && -f $se_mount/booleans/allow_execstack && -x /usr/sbin/selinuxenabled ]] && /usr/sbin/selinuxenabled; then
+ if [ -d $se_mount ] && [ -f $se_mount/booleans/allow_execstack ] && [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
if ! cat $se_mount/booleans/allow_execstack | grep -c '^1 1$' >> /dev/null ; then
echo "WARNING: the default SELinux policy on, at least, Fedora 12 breaks "
echo "Go. You can enable the features that Go needs via the following "
@@ -134,7 +134,7 @@
# Test for debian/kFreeBSD.
# cmd/dist will detect kFreeBSD as freebsd/$GOARCH, but we need to
# disable cgo manually.
-if [[ "$(uname -s)" == "GNU/kFreeBSD" ]]; then
+if [ "$(uname -s)" = "GNU/kFreeBSD" ]; then
export CGO_ENABLED=0
fi
@@ -145,17 +145,17 @@
verbose=false
vflag=""
-if [[ "$1" == "-v" ]]; then
+if [ "$1" = "-v" ]; then
verbose=true
vflag=-v
shift
fi
goroot_bootstrap_set=${GOROOT_BOOTSTRAP+"true"}
-if [[ -z "$GOROOT_BOOTSTRAP" ]]; then
+if [ -z "$GOROOT_BOOTSTRAP" ]; then
GOROOT_BOOTSTRAP="$HOME/go1.4"
for d in sdk/go$bootgo go$bootgo; do
- if [[ -d "$HOME/$d" ]]; then
+ if [ -d "$HOME/$d" ]; then
GOROOT_BOOTSTRAP="$HOME/$d"
fi
done
@@ -163,15 +163,16 @@
export GOROOT_BOOTSTRAP
nogoenv() {
- GO111MODULE=off GOENV=off GOOS= GOARCH= GOEXPERIMENT= GOFLAGS= "$@"
+ GO111MODULE=off GOENV=off GOOS='' GOARCH='' GOEXPERIMENT='' GOFLAGS='' "$@"
}
-export GOROOT="$(cd .. && pwd)"
-IFS=$'\n'; for go_exe in $(type -ap go); do
- if [[ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]]; then
- goroot=$(GOROOT= nogoenv "$go_exe" env GOROOT)
- if [[ "$goroot" != "$GOROOT" ]]; then
- if [[ "$goroot_bootstrap_set" == "true" ]]; then
+export GOROOT="${PWD%/*}"
+type_a() { IFS=:; for dir in $PATH; do [ -x "$dir/$1" ] && printf '%s\n' "$dir/$1"; done ;}
+IFS="$(printf '\n')"; for go_exe in $(type_a go); do
+ if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
+ goroot=$(GOROOT='' nogoenv "$go_exe" env GOROOT)
+ if [ "$goroot" != "$GOROOT" ]; then
+ if [ "$goroot_bootstrap_set" = "true" ]; then
printf 'WARNING: %s does not exist, found %s from env\n' "$GOROOT_BOOTSTRAP/bin/go" "$go_exe" >&2
printf 'WARNING: set %s as GOROOT_BOOTSTRAP\n' "$goroot" >&2
fi
@@ -179,7 +180,7 @@
fi
fi
done; unset IFS
-if [[ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]]; then
+if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
echo "ERROR: Cannot find $GOROOT_BOOTSTRAP/bin/go." >&2
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go $bootgo." >&2
exit 1
@@ -192,7 +193,7 @@
if $verbose; then
echo cmd/dist
fi
-if [[ "$GOROOT_BOOTSTRAP" == "$GOROOT" ]]; then
+if [ "$GOROOT_BOOTSTRAP" = "$GOROOT" ]; then
echo "ERROR: \$GOROOT_BOOTSTRAP must not be set to \$GOROOT" >&2
echo "Set \$GOROOT_BOOTSTRAP to a working Go tree >= Go $bootgo." >&2
exit 1
@@ -202,7 +203,7 @@
# -e doesn't propagate out of eval, so check success by hand.
eval $(./cmd/dist/dist env -p || echo FAIL=true)
-if [[ "$FAIL" == true ]]; then
+if [ "$FAIL" = true ]; then
exit 1
fi
@@ -210,10 +211,10 @@
echo
fi
-if [[ "$1" == "--dist-tool" ]]; then
+if [ "$1" = "--dist-tool" ]; then
# Stop after building dist tool.
mkdir -p "$GOTOOLDIR"
- if [[ "$2" != "" ]]; then
+ if [ "$2" != "" ]; then
cp cmd/dist/dist "$2"
fi
mv cmd/dist/dist "$GOTOOLDIR"/dist
diff -ur a/go1.4-bootstrap/src/make.bash b/go1.4-bootstrap/src/make.bash
--- a/go1.4-bootstrap/src/make.bash Wed Nov 22 02:33:58 2017
+++ b/go1.4-bootstrap/src/make.bash Fri Jun 7 01:22:30 2024
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/bin/sh
# Copyright 2009 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
@@ -80,9 +80,8 @@
# Test for bad SELinux.
# On Fedora 16 the selinux filesystem is mounted at /sys/fs/selinux,
# so loop through the possible selinux mount points.
-for se_mount in /selinux /sys/fs/selinux
-do
- if [ -d $se_mount -a -f $se_mount/booleans/allow_execstack -a -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
+for se_mount in /selinux /sys/fs/selinux; do
+ if [ -d $se_mount ] && [ -f $se_mount/booleans/allow_execstack ] && [ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled; then
if ! cat $se_mount/booleans/allow_execstack | grep -c '^1 1$' >> /dev/null ; then
echo "WARNING: the default SELinux policy on, at least, Fedora 12 breaks "
echo "Go. You can enable the features that Go needs via the following "
@@ -102,7 +101,7 @@
# Test for debian/kFreeBSD.
# cmd/dist will detect kFreeBSD as freebsd/$GOARCH, but we need to
# disable cgo manually.
-if [ "$(uname -s)" == "GNU/kFreeBSD" ]; then
+if [ "$(uname -s)" = "GNU/kFreeBSD" ]; then
export CGO_ENABLED=0
fi
@@ -113,7 +112,7 @@
echo '# Building C bootstrap tool.'
echo cmd/dist
-export GOROOT="$(cd .. && pwd)"
+export GOROOT="${PWD%/*}"
GOROOT_FINAL="${GOROOT_FINAL:-$GOROOT}"
DEFGOROOT='-DGOROOT_FINAL="'"$GOROOT_FINAL"'"'
@@ -122,12 +121,12 @@
386) mflag=-m32;;
amd64) mflag=-m64;;
esac
-if [ "$(uname)" == "Darwin" ]; then
+if [ "$(uname)" = "Darwin" ]; then
# golang.org/issue/5261
mflag="$mflag -mmacosx-version-min=10.6"
fi
# if gcc does not exist and $CC is not set, try clang if available.
-if [ -z "$CC" -a -z "$(type -t gcc)" -a -n "$(type -t clang)" ]; then
+if [ -z "$CC" ] && ! command -v gcc >/dev/null && command -v clang; then
export CC=clang CXX=clang++
fi
${CC:-gcc} $mflag -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c
@@ -162,7 +161,7 @@
"$GOTOOLDIR"/go_bootstrap clean -i std
echo
-if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
+if [ "$GOHOSTARCH" != "$GOARCH" ] || [ "$GOHOSTOS" != "$GOOS" ]; then
echo "# Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH."
# CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
# use the host compiler, CC, from `cmd/dist/dist env` instead.
|