commit 2e8918d
hovercats
·
2026-07-17 09:54:45 +0000 UTC
parent b3c837e
go: readd | bootstrap go using a binary, so we dont have to deal with the bootstrapping process
5 files changed,
+89,
-0
+51,
-0
1@@ -0,0 +1,51 @@
2+#!/bin/sh -e
3+
4+# Disable stripping of binaries.
5+# This breaks Go.
6+:> nostrip
7+
8+patch -p1 < 0001-src-make.bash-use-POSIX-sh-and-remove-some-bashism.patch
9+
10+export CC="${CC:-cc}"
11+export GOARCH=amd64
12+export GO_LDFLAGS="-w -s"
13+
14+export GOROOT_BOOTSTRAP="$PWD/go-bin"
15+export GOROOT="$PWD"
16+export GOROOT_FINAL="/usr/lib/go"
17+
18+(
19+ cd src
20+ ./make.bash -v
21+)
22+
23+cd "$GOROOT"
24+
25+mkdir -p "$1/usr/bin" "$1/usr/lib/go"
26+
27+ln -s ../lib/go/bin/go "$1/usr/bin"
28+ln -s ../lib/go/bin/gofmt "$1/usr/bin"
29+
30+cp -pPR misc bin pkg src lib go.env "$1/usr/lib/go"
31+
32+# Remove unneeded files.
33+rm -f "$1/usr/lib/go/pkg/tool/"*/api
34+rm -rf "$1/usr/lib/go/pkg/bootstrap"
35+rm -rf "$1/usr/lib/go/pkg/obj"
36+rm -rf "$1/usr/lib/go/test"
37+rm -rf "$1/usr/lib/go/api"
38+rm -rf "$1/usr/lib/go/doc"
39+
40+# Remove tests.
41+for path in "$1/usr/lib/go/src" "$1/usr/lib/go/misc/cgo"
42+do
43+ find "$path" -type f -a -name \*_test.go -depth -exec rm {} +
44+ find "$path" -type f -a -name \*.bash -depth -exec rm {} +
45+ find "$path" -type f -a -name \*.bat -depth -exec rm {} +
46+ find "$path" -type f -a -name \*.rc -depth -exec rm {} +
47+done
48+
49+find . -type d -a -name testdata |
50+ while read -r dir; do
51+ rm -rf "$dir"
52+ done
+3,
-0
1@@ -0,0 +1,3 @@
2+dfa5756ca69d07e7b54cbebf9c358567d941e61e4c5bfbbd58a0861754bf849d30
3+4647bddc3b15cc2adc587492d0346262c65007bf6cd00e486c53e7d4f7a4be8c12
4+f962ff680628c0791fce6f1df1cb1e43c09cdbeea741e668df6053215edd68d70a
1@@ -0,0 +1,31 @@
2+From 438f1fcaef381fe3950ee7b6bfddc1233d487f73 Mon Sep 17 00:00:00 2001
3+From: hovercats <hovercatswithlasereyes@protonmail.com>
4+Date: Thu, 29 Aug 2024 06:44:15 +0200
5+Subject: [PATCH] src/make.bash: use POSIX sh and remove some bashism
6+
7+---
8+ src/make.bash | 4 ++--
9+ 1 file changed, 2 insertions(+), 2 deletions(-)
10+
11+diff --git a/src/make.bash b/src/make.bash
12+index 814b7e8..b5344b1 100755
13+--- a/src/make.bash
14++++ b/src/make.bash
15+@@ -1,4 +1,4 @@
16+-#!/usr/bin/env bash
17++#!/bin/sh
18+ # Copyright 2009 The Go Authors. All rights reserved.
19+ # Use of this source code is governed by a BSD-style
20+ # license that can be found in the LICENSE file.
21+@@ -164,7 +164,7 @@ bootstrapenv() {
22+ }
23+
24+ export GOROOT="$(cd .. && pwd)"
25+-IFS=$'\n'; for go_exe in $(type -ap go); do
26++for go_exe in $(command -v go); do
27+ if [[ ! -x "$GOROOT_BOOTSTRAP/bin/go" ]]; then
28+ goroot_bootstrap=$GOROOT_BOOTSTRAP
29+ GOROOT_BOOTSTRAP=""
30+--
31+2.45.1
32+
+3,
-0
1@@ -0,0 +1,3 @@
2+https://go.dev/dl/go1.26.5.linux-amd64.tar.gz go-bin
3+https://golang.org/dl/go1.26.5.src.tar.gz
4+patches/0001-src-make.bash-use-POSIX-sh-and-remove-some-bashism.patch
+1,
-0
1@@ -0,0 +1 @@
2+1.26.5 1