@@ -18,22 +18,27 @@ set -ue
18
18
# - OUTDIR
19
19
20
20
# Build for each os-architecture pair
21
- for os in ${TARGET_OS} ; do
22
- archs=" ` f_build_archs ${os} ` "
23
- exe_file_extension=" ` f_binary_file_ext ${os} ` "
24
- for arch in ${archs} ; do
25
- make clean
26
- GOOS=" ${os} " GOARCH=" ${arch} " GOROOT_FINAL=" $( go env GOROOT) " \
27
- make build \
28
- LDFLAGS=-buildid=${VERSION} \
29
- VERSION=${VERSION} \
30
- COMMIT=${COMMIT} \
31
- LEDGER_ENABLED=${LEDGER_ENABLED}
32
- mv ./build/${APP}${exe_file_extension} ${OUTDIR} /${APP} -${VERSION} -${os} -${arch}${exe_file_extension}
33
- done
34
- unset exe_file_extension
21
+ for platform in ${TARGET_PLATFORMS} ; do
22
+ # This function sets GOOS, GOARCH, and OS_FILE_EXT environment variables
23
+ # according to the build target platform. OS_FILE_EXT is empty in all
24
+ # cases except when the target platform is 'windows'.
25
+ setup_build_env_for_platform " ${platform} "
26
+
27
+ make clean
28
+ echo Building for $( go env GOOS) /$( go env GOARCH) >&2
29
+ GOROOT_FINAL=" $( go env GOROOT) " \
30
+ make build \
31
+ LDFLAGS=-buildid=${VERSION} \
32
+ VERSION=${VERSION} \
33
+ COMMIT=${COMMIT} \
34
+ LEDGER_ENABLED=${LEDGER_ENABLED}
35
+ mv ./build/${APP}${OS_FILE_EXT} ${OUTDIR} /${APP} -${VERSION} -$( go env GOOS) -$( go env GOARCH) ${OS_FILE_EXT}
36
+
37
+ # This function restore the build environment variables to their
38
+ # original state.
39
+ restore_build_env
35
40
done
36
41
37
- # Generate and display build report
38
- f_generate_build_report ${OUTDIR}
42
+ # Generate and display build report.
43
+ generate_build_report
39
44
cat ${OUTDIR} /build_report
0 commit comments