Debian Codegraph @

scripts/build-binary

raw symbols SCIP
1 #!/usr/bin/envscip-shell filesystem . . `/usr/bin/env`. bash
2
3 set -euo pipefail
4
5 source ./scripts/test_lib.shscip-shell source . . `./scripts/test_lib.sh`.
6
7 VER=${1:-}
8 REPOSITORY="${REPOSITORY:[email protected]:etcd-io/etcd.git}"
9
10 if [scip-shell system . . `[`. -z "${VER}" ]; then
11 echoscip-shell system . . echo. "Usage: ${0} VERSION" >> /dev/stderrscip-shell filesystem . . `/dev/stderr`.
12 exit 255
13 fi
14
15
16 function setup_envscip-shell shell etcd 3.5.30-2 setup_env(). {
17 local ver=${1}
18 local proj=${2}
19
20 if [scip-shell system . . `[`. ! -d "${proj}" ]; then
21 run git clone "${REPOSITORY}"
22 fi
23
24 pushd "${proj}" >/dev/nullscip-shell filesystem . . `/dev/null`.
25 run git fetch --all
26 run git checkout "${ver}"
27 popd >/dev/nullscip-shell filesystem . . `/dev/null`.
28 }
29
30
31 function packagescip-shell shell etcd 3.5.30-2 package(). {
32 local target=${1}
33 local srcdir="${2}/bin"
34
35 local ccdir="${srcdir}/${GOOS}_${GOARCH}"
36 if [scip-shell system . . `[`. -d "${ccdir}" ]; then
37 srcdir="${ccdir}"
38 fi
39 local ext=""
40 if [scip-shell system . . `[`. "${GOOS:-}" == "windows" ]; then
41 ext=".exe"
42 fi
43 for bin in etcd etcdctl etcdutl; do
44 cpscip-shell system . . cp. "${srcdir}/${bin}" "${target}/${bin}${ext}"
45 done
46
47 cpscip-shell system . . cp. etcd/README.md "${target}"/README.md
48 cpscip-shell system . . cp. etcd/etcdctl/README.md "${target}"/README-etcdctl.md
49 cpscip-shell system . . cp. etcd/etcdctl/READMEv2.md "${target}"/READMEv2-etcdctl.md
50 cpscip-shell system . . cp. etcd/etcdutl/README.md "${target}"/README-etcdutl.md
51
52 cpscip-shell system . . cp. -R etcd/Documentation "${target}"/Documentation
53 }
54
55 function mainscip-shell shell etcd 3.5.30-2 main(). {
56 local proj="etcd"
57
58 mkdirscip-shell system . . mkdir. -p release
59 cd release
60 setup_envscip-shell shell etcd 3.5.30-2 setup_env(). "${VER}" "${proj}"
61
62 local tarcmd=tar
63 if [[ $(go env GOOS) == "darwin" ]]; then
64 echoscip-shell system . . echo. "Please use linux machine for release builds."
65 exit 1
66 fi
67
68 for os in darwin windows linux; do
69 export GOOS=${os}
70 TARGET_ARCHS=("amd64")
71
72 if [scip-shell system . . `[`. ${GOOS} == "linux" ]; then
73 TARGET_ARCHS+=("arm64")
74 TARGET_ARCHS+=("ppc64le")
75 TARGET_ARCHS+=("s390x")
76 fi
77
78 if [scip-shell system . . `[`. ${GOOS} == "darwin" ]; then
79 TARGET_ARCHS+=("arm64")
80 fi
81
82 for TARGET_ARCH in "${TARGET_ARCHS[@]}"; do
83 export GOARCH=${TARGET_ARCH}
84
85 pushd etcd >/dev/nullscip-shell filesystem . . `/dev/null`.
86 GO_LDFLAGS="-s -w" ./build.sh
87 popd >/dev/nullscip-shell filesystem . . `/dev/null`.
88
89 TARGET="etcd-${VER}-${GOOS}-${GOARCH}"
90 mkdirscip-shell system . . mkdir. "${TARGET}"
91 packagescip-shell shell etcd 3.5.30-2 package(). "${TARGET}" "${proj}"
92
93 if [scip-shell system . . `[`. ${GOOS} == "linux" ]; then
94 ${tarcmd} cfz "${TARGET}.tar.gz" "${TARGET}"
95 echoscip-shell system . . echo. "Wrote release/${TARGET}.tar.gz"
96 else
97 zip -qr "${TARGET}.zip" "${TARGET}"
98 echoscip-shell system . . echo. "Wrote release/${TARGET}.zip"
99 fi
100 done
101 done
102 }
103
104 mainscip-shell shell etcd 3.5.30-2 main().