aboutsummaryrefslogtreecommitdiff
path: root/extra/go
diff options
context:
space:
mode:
authorCem Keylan <cem@ckyln.com>2021-01-02 00:38:29 +0300
committerCem Keylan <cem@ckyln.com>2021-01-02 00:38:29 +0300
commit291967935394b463e3ec9242cadaa2030456b303 (patch)
tree587033f0563e009aa4f9ad9961a8e986c94c7c98 /extra/go
parent3e0371f0693ffebe31f7b93913f1e1456430baba (diff)
downloadrepository-291967935394b463e3ec9242cadaa2030456b303.tar.gz
go: remove bash dependency
Diffstat (limited to 'extra/go')
-rwxr-xr-xextra/go/build7
-rw-r--r--extra/go/checksums1
-rw-r--r--extra/go/depends1
-rw-r--r--extra/go/patches/no-bash.patch86
-rw-r--r--extra/go/sources1
5 files changed, 93 insertions, 3 deletions
diff --git a/extra/go/build b/extra/go/build
index bb6ce565..c051bc2d 100755
--- a/extra/go/build
+++ b/extra/go/build
@@ -1,5 +1,8 @@
#!/bin/sh -e
+# Remove bash as a make dependency
+patch -p1 < no-bash.patch
+
# Disable stripping of binaries.
# This breaks Go.
:> nostrip
@@ -15,7 +18,7 @@ export GO_LDFLAGS="-w -s"
mkdir -p lib/go-bootstrap
cd "$GOROOT/src"
- bash ./make.bash
+ ./make.bash
cd ..
cp -a bin pkg src ../lib/go-bootstrap
cd ..
@@ -33,7 +36,7 @@ export GOROOT=$PWD/go-current
(
cd "$GOROOT/src"
- bash make.bash --no-clean -v
+ ./make.bash --no-clean -v
)
cd "$GOROOT"
diff --git a/extra/go/checksums b/extra/go/checksums
index 61b37873..d225b66f 100644
--- a/extra/go/checksums
+++ b/extra/go/checksums
@@ -1,2 +1,3 @@
890bba73c5e2b19ffb1180e385ea225059eb008eb91b694875dd86ea48675817 go1.15.6.src.tar.gz
f4ff5b5eb3a3cae1c993723f3eab519c5bae18866b5e5f96fe1102f0cb5c3e52 go1.4-bootstrap-20171003.tar.gz
+4166a929288658d8fb2978bab24c1b5a0a8b8996122058c97e207da79db75b92 no-bash.patch
diff --git a/extra/go/depends b/extra/go/depends
deleted file mode 100644
index 82a3ccad..00000000
--- a/extra/go/depends
+++ /dev/null
@@ -1 +0,0 @@
-bash make
diff --git a/extra/go/patches/no-bash.patch b/extra/go/patches/no-bash.patch
new file mode 100644
index 00000000..a1130c0b
--- /dev/null
+++ b/extra/go/patches/no-bash.patch
@@ -0,0 +1,86 @@
+diff -ur a/go-current/src/make.bash b/go-current/src/make.bash
+--- a/go-current/src/make.bash 2020-12-03 20:32:44.000000000 +0300
++++ b/go-current/src/make.bash 2021-01-02 00:36:42.692155781 +0300
+@@ -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.
+@@ -106,7 +106,7 @@
+ # 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
++ 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 "
+@@ -154,14 +154,14 @@
+
+ export GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4}
+ export GOROOT="$(cd .. && pwd)"
+-IFS=$'\n'; for go_exe in $(type -ap go); do
++for go_exe in $(command -v go); do
+ if [ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]; then
+ goroot=$(GOROOT='' GOOS='' GOARCH='' "$go_exe" env GOROOT)
+ if [ "$goroot" != "$GOROOT" ]; then
+ GOROOT_BOOTSTRAP=$goroot
+ fi
+ fi
+-done; unset IFS
++done
+ GOROOT_BOOTSTRAP_VERSION=$($GOROOT_BOOTSTRAP/bin/go version | sed 's/go version //')
+ echo "Building Go cmd/dist using $GOROOT_BOOTSTRAP. ($GOROOT_BOOTSTRAP_VERSION)"
+ if $verbose; then
+diff -ur a/go1.4-bootstrap/src/make.bash b/go1.4-bootstrap/src/make.bash
+--- a/go1.4-bootstrap/src/make.bash 2017-11-22 04:33:58.000000000 +0300
++++ b/go1.4-bootstrap/src/make.bash 2021-01-02 00:11:00.448427915 +0300
+@@ -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.
+@@ -82,7 +82,7 @@
+ # 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
++ 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 +102,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
+
+@@ -122,12 +122,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 +162,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.
diff --git a/extra/go/sources b/extra/go/sources
index ebcc0562..9de4bc5c 100644
--- a/extra/go/sources
+++ b/extra/go/sources
@@ -1,2 +1,3 @@
https://golang.org/dl/go1.15.6.src.tar.gz go-current
https://dl.google.com/go/go1.4-bootstrap-20171003.tar.gz go1.4-bootstrap
+patches/no-bash.patch