[scripts] Minor updates.

This commit is contained in:
Ciprian Dorin Craciun 2022-09-02 10:29:45 +03:00
parent ebb4f2a69f
commit d53b1b4189

View file

@ -3,12 +3,27 @@
<< go / build / all / release / quick ++<< go / build / all / debug
export -- __BUILD_QUICK=true printf -- '[ii] building archiver...\n' >&2
"${ZRUN[@]}" ':: go / build / archiver / release' "${@}" "${ZRUN[@]}" ':: go / build / archiver / debug' "${@}"
"${ZRUN[@]}" ':: go / build / server / release' "${@}" printf -- '[ii] building server...\n' >&2
"${ZRUN[@]}" ':: go / build / server-dummy / release' "${@}" "${ZRUN[@]}" ':: go / build / server / debug' "${@}"
"${ZRUN[@]}" ':: go / build / wrapper / release' "${@}" printf -- '[ii] building server-dummy...\n' >&2
"${ZRUN[@]}" ':: go / build / server-dummy / debug' "${@}"
printf -- '[ii] building wrapper...\n' >&2
"${ZRUN[@]}" ':: go / build / wrapper / debug' "${@}"
!!
++<< go / build / all / release / quick
printf -- '[ii] building archiver...\n' >&2
"${ZRUN[@]}" ':: go / build / archiver / release / quick' "${@}"
printf -- '[ii] building server...\n' >&2
"${ZRUN[@]}" ':: go / build / server / release / quick' "${@}"
printf -- '[ii] building server-dummy...\n' >&2
"${ZRUN[@]}" ':: go / build / server-dummy / release / quick' "${@}"
printf -- '[ii] building wrapper...\n' >&2
"${ZRUN[@]}" ':: go / build / wrapper / release / quick' "${@}"
!! !!
@ -36,6 +51,7 @@
exec -- "${ZRUN[@]}" ':: go / build / server / release' "${@}" exec -- "${ZRUN[@]}" ':: go / build / server / release' "${@}"
!! !!
<< go / build / server / release << go / build / server / release
test "${#}" -eq 0 test "${#}" -eq 0
_outputs="$( exec -- readlink -e -- ./.outputs )" _outputs="$( exec -- readlink -e -- ./.outputs )"
@ -43,13 +59,13 @@
rm -- "${_outputs}/binaries/release/kawipiko-server" rm -- "${_outputs}/binaries/release/kawipiko-server"
fi fi
_flags=( _flags=(
#? -buildmode exe
-tags netgo -tags netgo
) )
if test -z "${__BUILD_QUICK:-}" ; then if test "${__BUILD_QUICK:-false}" != true ; then
_flags+=( _flags+=(
-gcflags 'all=-l=4' -gcflags 'all=-l=4'
-ldflags 'all=-s' -ldflags 'all=-s'
-buildmode exe
-trimpath -trimpath
-a -a
) )
@ -90,6 +106,7 @@
exec -- "${ZRUN[@]}" ':: go / build / archiver / release' "${@}" exec -- "${ZRUN[@]}" ':: go / build / archiver / release' "${@}"
!! !!
<< go / build / archiver / release << go / build / archiver / release
test "${#}" -eq 0 test "${#}" -eq 0
_outputs="$( exec -- readlink -e -- ./.outputs )" _outputs="$( exec -- readlink -e -- ./.outputs )"
@ -97,13 +114,13 @@
rm -- "${_outputs}/binaries/release/kawipiko-archiver" rm -- "${_outputs}/binaries/release/kawipiko-archiver"
fi fi
_flags=( _flags=(
#? -buildmode exe
-tags netgo -tags netgo
) )
if test -z "${__BUILD_QUICK:-}" ; then if test "${__BUILD_QUICK:-false}" != true ; then
_flags+=( _flags+=(
-gcflags 'all=-l=4' -gcflags 'all=-l=4'
-ldflags 'all=-s' -ldflags 'all=-s'
-buildmode exe
-trimpath -trimpath
-a -a
) )
@ -139,23 +156,36 @@
!! !!
<< go / build / wrapper / release / quick
export -- __BUILD_QUICK=true
exec -- "${ZRUN[@]}" ':: go / build / wrapper / release' "${@}"
!!
<< go / build / wrapper / release << go / build / wrapper / release
test "${#}" -eq 0 test "${#}" -eq 0
_outputs="$( exec -- readlink -e -- ./.outputs )" _outputs="$( exec -- readlink -e -- ./.outputs )"
if test -e "${_outputs}/binaries/release/kawipiko-wrapper" ; then if test -e "${_outputs}/binaries/release/kawipiko-wrapper" ; then
rm -- "${_outputs}/binaries/release/kawipiko-wrapper" rm -- "${_outputs}/binaries/release/kawipiko-wrapper"
fi fi
_flags=(
#? -buildmode exe
-tags netgo
)
if test "${__BUILD_QUICK:-false}" != true ; then
_flags+=(
-gcflags 'all=-l=4'
-ldflags 'all=-s'
-trimpath
-a
)
fi
exec -- \ exec -- \
nodaemon \ nodaemon \
nice -n 19 -- \ nice -n 19 -- \
"${ZRUN[@]}" ':: go / tool' \ "${ZRUN[@]}" ':: go / tool' \
build \ build \
-tags netgo \ "${_flags[@]}" \
-a \
-gcflags 'all=-l=4' \
-ldflags 'all=-s' \
-buildmode exe \
-trimpath \
-o "${_outputs}/binaries/release/kawipiko-wrapper" \ -o "${_outputs}/binaries/release/kawipiko-wrapper" \
-- ./cmd/wrapper.go \ -- ./cmd/wrapper.go \
# #
@ -186,6 +216,7 @@
exec -- "${ZRUN[@]}" ':: go / build / server-dummy / release' "${@}" exec -- "${ZRUN[@]}" ':: go / build / server-dummy / release' "${@}"
!! !!
<< go / build / server-dummy / release << go / build / server-dummy / release
test "${#}" -eq 0 test "${#}" -eq 0
_outputs="$( exec -- readlink -e -- ./.outputs )" _outputs="$( exec -- readlink -e -- ./.outputs )"
@ -193,13 +224,13 @@
rm -- "${_outputs}/binaries/release/kawipiko-server-dummy" rm -- "${_outputs}/binaries/release/kawipiko-server-dummy"
fi fi
_flags=( _flags=(
#? -buildmode exe
-tags netgo -tags netgo
) )
if test -z "${__BUILD_QUICK:-}" ; then if test "${__BUILD_QUICK:-false}" != true ; then
_flags+=( _flags+=(
-gcflags 'all=-l=4' -gcflags 'all=-l=4'
-ldflags 'all=-s' -ldflags 'all=-s'
-buildmode exe
-trimpath -trimpath
-a -a
) )
@ -218,7 +249,7 @@
<< go / build / all / release ++<< go / build / all / release
if test "${#}" -ge 1 ; then if test "${#}" -ge 1 ; then
_platform_0="${1}" _platform_0="${1}"
shift -- 1 shift -- 1
@ -256,17 +287,22 @@
fi fi
test ! -e "${_outputs}/binaries/release/kawipiko-${_component}--${_platform}" test ! -e "${_outputs}/binaries/release/kawipiko-${_component}--${_platform}"
printf -- '[ii] building `%s` for `%s`...\n' "${_component}" "${_platform}" >&2 printf -- '[ii] building `%s` for `%s`...\n' "${_component}" "${_platform}" >&2
_flags=(
#? -buildmode exe
-tags netgo
)
_flags+=(
-gcflags 'all=-l=4'
-ldflags 'all=-s'
-trimpath
-a
)
env GOOS="${_platform}" \ env GOOS="${_platform}" \
nodaemon \ nodaemon \
nice -n 19 -- \ nice -n 19 -- \
"${ZRUN[@]}" ':: go / tool' \ "${ZRUN[@]}" ':: go / tool' \
build \ build \
-tags netgo \ "${_flags[@]}" \
-a \
-gcflags 'all=-l=4' \
-ldflags 'all=-s' \
-buildmode exe \
-trimpath \
-o "${_outputs}/binaries/release/kawipiko-${_component}--${_platform}" \ -o "${_outputs}/binaries/release/kawipiko-${_component}--${_platform}" \
-- "./cmd/${_component}.go" \ -- "./cmd/${_component}.go" \
# #
@ -315,6 +351,18 @@
<< go / dependencies / include
test "${#}" -ge 1
exec -- "${ZRUN[@]}" ':: go / tool' \
get \
-v \
-d \
-- \
"${@}" \
#
!!
<< go / dependencies / update << go / dependencies / update
test "${#}" -eq 0 test "${#}" -eq 0
exec -- "${ZRUN[@]}" ':: go / tool' \ exec -- "${ZRUN[@]}" ':: go / tool' \
@ -367,8 +415,19 @@
<< go / tool << go / tool
test "${#}" -ge 1 test "${#}" -ge 1
export -n -- \
ZRUN_LIBRARY_SOURCE= \
ZRUN_LIBRARY_URL= \
ZRUN_LIBRARY_IDENTIFIER= \
ZRUN_LIBRARY_FINGERPRINT= \
ZRUN_EXECUTABLE= \
ZRUN_WORKSPACE= \
ZRUN_CACHE= \
#
_outputs="$( exec -- readlink -e -- ./.outputs )" _outputs="$( exec -- readlink -e -- ./.outputs )"
_sources="$( exec -- readlink -e -- ./sources )" _sources="$( exec -- readlink -e -- ./sources )"
@ -376,10 +435,15 @@
export -- GOBIN="${_outputs}/go/bin" export -- GOBIN="${_outputs}/go/bin"
export -- GOTMPDIR="${_outputs}/go/tmp" export -- GOTMPDIR="${_outputs}/go/tmp"
export -- GOCACHE="${_outputs}/go/cache" export -- GOCACHE="${_outputs}/go/cache"
export -- GO111MODULE=on
if test -e "${_outputs}/go-tool" ; then
_go="$( exec -- readlink -e -- "${_outputs}/go-tool" )"
else
_go="$( type -P -- go )"
fi
cd -- "${_sources}" cd -- "${_sources}"
exec -- go "${@}" exec -- "${_go}" "${@}"
!! !!