2
0
mirror of https://codeberg.org/kiss-community/repo synced 2024-11-16 03:30:23 -07:00
repo/extra/go/build

64 lines
1.4 KiB
Plaintext
Raw Normal View History

2019-08-17 03:29:55 -06:00
#!/bin/sh -e
export GOARCH=amd64
2019-09-01 08:39:27 -06:00
export GO_LDFLAGS="-w -s"
2019-08-17 03:29:55 -06:00
2019-09-01 08:39:27 -06:00
[ -f "$KISS_ROOT/var/db/kiss/installed/go/manifest" ] || {
export GOROOT=$PWD/go1.4-bootstrap
export GOROOT_FINAL=$PWD/lib/go-bootstrap
2019-08-17 03:29:55 -06:00
mkdir -p lib/go-bootstrap
cd "$GOROOT/src"
bash ./make.bash
cd ..
cp -a bin pkg src ../lib/go-bootstrap
cd ..
}
export GOROOT_FINAL=/usr/lib/go
2019-09-01 08:39:27 -06:00
if [ -f "$KISS_ROOT/var/db/kiss/go/manifest" ]; then
2019-08-17 03:29:55 -06:00
export GOROOT_BOOTSTRAP=/usr/lib/go
else
2019-09-01 08:39:27 -06:00
export GOROOT_BOOTSTRAP=$PWD/lib/go-bootstrap
2019-08-17 03:29:55 -06:00
fi
2019-09-01 08:39:27 -06:00
export GOROOT=$PWD/go-current
2019-08-17 03:29:55 -06:00
(
cd "$GOROOT/src"
bash make.bash --no-clean -v
)
cd "$GOROOT"
2019-09-01 08:39:27 -06:00
mkdir -p "$1/usr/bin" "$1/usr/lib/go/bin"
2019-08-17 03:29:55 -06:00
2019-09-01 08:39:27 -06:00
install -m755 "bin/go" "$1/usr/lib/go/bin/go"
install -m755 "bin/gofmt" "$1/usr/lib/go/bin/gofmt"
2019-08-17 03:29:55 -06:00
2019-09-01 08:39:27 -06:00
ln -s "/usr/lib/go/bin/go" "$1/usr/bin"
ln -s "/usr/lib/go/bin/gofmt" "$1/usr/bin"
2019-08-17 03:29:55 -06:00
2019-09-01 08:39:27 -06:00
cp -a misc pkg src lib "$1/usr/lib/go"
2019-08-17 03:29:55 -06:00
2019-09-01 08:39:27 -06:00
# Remove unneeded files.
2019-08-17 03:29:55 -06:00
rm -f "$1/usr/share/go/doc/articles/wiki/get.bin"
2019-09-01 08:39:27 -06:00
rm -f "$1/usr/lib/go/pkg/tool/"*/api
2019-08-17 03:29:55 -06:00
rm -rf "$1/usr/lib/go/pkg/bootstrap"
rm -rf "$1/usr/lib/go/pkg/obj"
2019-09-01 08:39:27 -06:00
cd "$1/usr/lib/go/src"
# Remove tests.
find . -type f -a -name \*_test.go -delete
find . -type f -a -name \*.bash -delete
find . -type f -a -name \*.bat -delete
find . -type f -a -name \*.rc -delete
find . -type d -a -name testdata |
while read -r dir; do
rm -rf "$dir"
done