Scripts for bootstrapping various programming languages
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

#!/bin/sh
set -eu
11 months ago
version_boot="$1"
version_dest="$2"
version_go="$3"
dir_download="$PWD/download"
mkdir -p build; cd build
11 months ago
dir_install="$PWD/install-go$version_dest"
# Prepare source
mkdir -p "go$version_go"
tar xf "$dir_download/go$version_go.src.tar.gz" -C "go$version_go" --strip-components 1
cd "go$version_go"
1 day ago
# Create dummy git repo
# This avoids problems if a parent git repo is found but owned by a different user
mkdir -p .git/objects .git/refs
echo 'ref: refs/heads/master' > .git/HEAD
# Build and install
1 day ago
(cd src; GOROOT_BOOTSTRAP="$PWD/../../install-go$version_boot" ./make.bash -v)
find src -type f \( ! -name '*.go' \
-a ! -name '*.c' \
-a ! -name '*.h' \
-a ! -name '*.s' \
-a ! -name '*.S' \
-a ! -name 'p256_asm_table.bin' \
\) -print -delete
find src -type f -name '*_test.go' -print -delete
1 year ago
find src -type d -name 'testdata' -print0 | xargs -0 rm -vrf
find src -type d -empty -print -delete
find pkg -type f -name '*.a' -print -delete
find pkg -type d -empty -print -delete
mkdir -p "$dir_install"
cp -at "$dir_install" bin pkg src