aboutsummaryrefslogtreecommitdiff
path: root/extra/go/patches
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/patches
parent3e0371f0693ffebe31f7b93913f1e1456430baba (diff)
downloadrepository-291967935394b463e3ec9242cadaa2030456b303.tar.gz
go: remove bash dependency
Diffstat (limited to 'extra/go/patches')
-rw-r--r--extra/go/patches/no-bash.patch86
1 files changed, 86 insertions, 0 deletions
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.