This repository has been archived by the owner on Feb 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
make.sh
executable file
·74 lines (59 loc) · 1.74 KB
/
make.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
set -e
function checkExit {
if [ $1 -ne 0 ]; then
echo "Unexpected exit of child process. Got: ${1}" 1>&2
exit $1
fi
}
function buildForPlattform {
if [ -z "$2" ]; then
echo "Parameter missing" 1>&2
exit 1
fi
go-crosscompile-build "$1/$2"
checkExit $?
GOOS="$1" GOARCH="$2" "${GOROOT}/bin/go" get "github.com/kardianos/osext"
checkExit $?
GOOS="$1" GOARCH="$2" "${GOROOT}/bin/go" build -o "${BUILD_DIR}/oracle-java-launcher-${1}-${2}${3}" "${BASE}/main.go"
checkExit $?
}
GO_VERSION=1.5.2
PLAIN_BASE="`dirname \"${0}\"`"
BASE="`readlink -f \"${PLAIN_BASE}\"`"
export BUILD_DIR="${BASE}/target"
export GOROOT="${BUILD_DIR}/go"
export GOROOT_BOOTSTRAP="${BUILD_DIR}/go-bootstrap"
export GOPATH="${BUILD_DIR}/gohome"
## Clean build directory
rm -rf "${BUILD_DIR}"
checkExit $?
## Create build directory
mkdir -p "${BUILD_DIR}"
checkExit $?
## Download go bootstrap and extract
curl -sSL "https://storage.googleapis.com/golang/go${GO_VERSION}.linux-amd64.tar.gz" | tar -C "${BUILD_DIR}" -xz
checkExit $?
mv "${BUILD_DIR}/go" "${BUILD_DIR}/go-bootstrap"
checkExit $?
## Download go sources and extract
curl -sSL "https://golang.org/dl/go${GO_VERSION}.src.tar.gz" | tar -C "${BUILD_DIR}" -xz
checkExit $?
## Download go crosscompile tools
curl -sSL "https://raw.githubusercontent.com/davecheney/golang-crosscompile/master/crosscompile.bash" > "${BUILD_DIR}/crosscompile.bash"
checkExit $?
source "${BUILD_DIR}/crosscompile.bash"
## Build go
cd "${GOROOT}/src"
checkExit $?
./make.bash
checkExit $?
cd "${BASE}"
checkExit $?
## Start build of app
buildForPlattform linux amd64
buildForPlattform linux 386
buildForPlattform windows amd64 .exe
buildForPlattform windows 386 .exe
buildForPlattform darwin amd64
buildForPlattform darwin 386