[scripts] Add support for multiple architecture compiling and publishing.
This commit is contained in:
parent
b295bbafb8
commit
d9d950e182
1 changed files with 72 additions and 92 deletions
164
scripts/z-run
164
scripts/z-run
|
@ -46,7 +46,9 @@
|
|||
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
||||
mkdir -p -- "${_outputs}/binaries/release"
|
||||
rm -f -- "${_outputs}/binaries/release/kawipiko-server"
|
||||
exec -- "${ZRUN[@]}" ':: go / tool' \
|
||||
exec -- \
|
||||
nice -n 19 -- \
|
||||
"${ZRUN[@]}" ':: go / tool' \
|
||||
build \
|
||||
-mod readonly \
|
||||
-tags netgo \
|
||||
|
@ -60,43 +62,6 @@
|
|||
#
|
||||
!!
|
||||
|
||||
<< go / build / server / analyze
|
||||
test "${#}" -eq 0
|
||||
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
||||
mkdir -p -- "${_outputs}/binaries/debug"
|
||||
rm -f -- "${_outputs}/binaries/debug/kawipiko-server"
|
||||
exec -- "${ZRUN[@]}" ':: go / tool' \
|
||||
build \
|
||||
-mod readonly \
|
||||
-gcflags '-m' \
|
||||
-o "${_outputs}/binaries/debug/kawipiko-server" \
|
||||
-- ./cmd/server.go \
|
||||
#
|
||||
!!
|
||||
|
||||
<< go / build / server / analyze / escapes
|
||||
"${ZRUN[@]}" ':: go / build / server / analyze' "${@}" \
|
||||
2>&1 \
|
||||
| grep -F -e ' escapes ' \
|
||||
| LC_ALL=C sort -n -k 2,2 -t ':'
|
||||
!!
|
||||
|
||||
|
||||
<< go / build / server / publish
|
||||
test "${#}" -eq 0
|
||||
"${ZRUN[@]}" ':: go / build / server / release'
|
||||
if test ! -e ./.outputs/publish ; then
|
||||
mkdir -- ./.outputs/publish
|
||||
fi
|
||||
if test ! -e ./.outputs/publish/binaries ; then
|
||||
mkdir -- ./.outputs/publish/binaries
|
||||
fi
|
||||
cp -T -- \
|
||||
./.outputs/binaries/release/kawipiko-server \
|
||||
./.outputs/publish/binaries/kawipiko-server \
|
||||
#
|
||||
!!
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -129,7 +94,9 @@
|
|||
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
||||
mkdir -p -- "${_outputs}/binaries/release"
|
||||
rm -f -- "${_outputs}/binaries/release/kawipiko-archiver"
|
||||
exec -- "${ZRUN[@]}" ':: go / tool' \
|
||||
exec -- \
|
||||
nice -n 19 -- \
|
||||
"${ZRUN[@]}" ':: go / tool' \
|
||||
build \
|
||||
-mod readonly \
|
||||
-tags netgo \
|
||||
|
@ -144,32 +111,6 @@
|
|||
!!
|
||||
|
||||
|
||||
<< go / build / archiver / publish
|
||||
test "${#}" -eq 0
|
||||
"${ZRUN[@]}" ':: go / build / archiver / release'
|
||||
if test ! -e ./.outputs/publish ; then
|
||||
mkdir -- ./.outputs/publish
|
||||
fi
|
||||
if test ! -e ./.outputs/publish/binaries ; then
|
||||
mkdir -- ./.outputs/publish/binaries
|
||||
fi
|
||||
cp -T -- \
|
||||
./.outputs/binaries/release/kawipiko-archiver \
|
||||
./.outputs/publish/binaries/kawipiko-archiver \
|
||||
#
|
||||
!!
|
||||
|
||||
|
||||
|
||||
|
||||
<< go / build / all
|
||||
test "${#}" -eq 0
|
||||
"${ZRUN[@]}" ':: go / build / debug'
|
||||
"${ZRUN[@]}" ':: go / build / release'
|
||||
"${ZRUN[@]}" ':: go / build / publish'
|
||||
!!
|
||||
|
||||
|
||||
|
||||
|
||||
<< execute / wrapper / release
|
||||
|
@ -183,7 +124,9 @@
|
|||
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
||||
mkdir -p -- "${_outputs}/binaries/release"
|
||||
rm -f -- "${_outputs}/binaries/release/kawipiko"
|
||||
exec -- "${ZRUN[@]}" ':: go / tool' \
|
||||
exec -- \
|
||||
nice -n 19 -- \
|
||||
"${ZRUN[@]}" ':: go / tool' \
|
||||
build \
|
||||
-mod readonly \
|
||||
-tags netgo \
|
||||
|
@ -198,39 +141,52 @@
|
|||
!!
|
||||
|
||||
|
||||
<< go / build / wrapper / publish
|
||||
|
||||
|
||||
<< go / build / all / release
|
||||
test "${#}" -eq 0
|
||||
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
||||
mkdir -p -- "${_outputs}/binaries/release"
|
||||
for _platform in linux darwin openbsd freebsd ; do
|
||||
for _component in archiver server wrapper ; do
|
||||
printf -- '[ii] building `%s` for `%s`...\n' "${_component}" "${_platform}" >&2
|
||||
rm -f -- "${_outputs}/binaries/release/kawipiko-${_component}--${_platform}"
|
||||
nodaemon \
|
||||
env GOOS="${_platform}" \
|
||||
nice -n 19 -- \
|
||||
"${ZRUN[@]}" ':: go / tool' \
|
||||
build \
|
||||
-mod readonly \
|
||||
-tags netgo \
|
||||
-a \
|
||||
-gcflags 'all=-l=4' \
|
||||
-ldflags 'all=-s' \
|
||||
-buildmode exe \
|
||||
-trimpath \
|
||||
-o "${_outputs}/binaries/release/kawipiko-${_component}--${_platform}" \
|
||||
-- "./cmd/${_component}.go" \
|
||||
#
|
||||
done
|
||||
done
|
||||
!!
|
||||
|
||||
|
||||
<< go / build / all / publish
|
||||
test "${#}" -eq 0
|
||||
"${ZRUN[@]}" ':: go / build / wrapper / release'
|
||||
if test ! -e ./.outputs/publish ; then
|
||||
mkdir -- ./.outputs/publish
|
||||
fi
|
||||
if test ! -e ./.outputs/publish/binaries ; then
|
||||
mkdir -- ./.outputs/publish/binaries
|
||||
fi
|
||||
cp -T -- \
|
||||
./.outputs/binaries/release/kawipiko \
|
||||
./.outputs/publish/binaries/kawipiko \
|
||||
#
|
||||
!!
|
||||
|
||||
|
||||
|
||||
|
||||
<< go / build / debug
|
||||
"${ZRUN[@]}" ':: go / build / archiver / debug' "${@}"
|
||||
"${ZRUN[@]}" ':: go / build / server / debug' "${@}"
|
||||
!!
|
||||
|
||||
<< go / build / release
|
||||
"${ZRUN[@]}" ':: go / build / archiver / release' "${@}"
|
||||
"${ZRUN[@]}" ':: go / build / server / release' "${@}"
|
||||
"${ZRUN[@]}" ':: go / build / wrapper / release' "${@}"
|
||||
!!
|
||||
|
||||
++<< go / build / publish
|
||||
"${ZRUN[@]}" ':: go / build / archiver / publish' "${@}"
|
||||
"${ZRUN[@]}" ':: go / build / server / publish' "${@}"
|
||||
"${ZRUN[@]}" ':: go / build / wrapper / publish' "${@}"
|
||||
for _platform in linux darwin openbsd freebsd ; do
|
||||
for _component in archiver server wrapper ; do
|
||||
cp -T -- \
|
||||
"./.outputs/binaries/release/kawipiko-${_component}--${_platform}" \
|
||||
"./.outputs/publish/binaries/kawipiko-${_component}--${_platform}" \
|
||||
#
|
||||
done
|
||||
done
|
||||
!!
|
||||
|
||||
|
||||
|
@ -245,6 +201,30 @@
|
|||
|
||||
|
||||
|
||||
<< go / build / server / analyze
|
||||
test "${#}" -eq 0
|
||||
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
||||
mkdir -p -- "${_outputs}/binaries/debug"
|
||||
rm -f -- "${_outputs}/binaries/debug/kawipiko-server"
|
||||
exec -- "${ZRUN[@]}" ':: go / tool' \
|
||||
build \
|
||||
-mod readonly \
|
||||
-gcflags '-m' \
|
||||
-o "${_outputs}/binaries/debug/kawipiko-server" \
|
||||
-- ./cmd/server.go \
|
||||
#
|
||||
!!
|
||||
|
||||
<< go / build / server / analyze / escapes
|
||||
"${ZRUN[@]}" ':: go / build / server / analyze' "${@}" \
|
||||
2>&1 \
|
||||
| grep -F -e ' escapes ' \
|
||||
| LC_ALL=C sort -n -k 2,2 -t ':'
|
||||
!!
|
||||
|
||||
|
||||
|
||||
|
||||
<< go / dependencies / update
|
||||
test "${#}" -eq 0
|
||||
exec -- "${ZRUN[@]}" ':: go / tool' \
|
||||
|
|
Loading…
Reference in a new issue