2021-12-16 09:28:22 +00:00
|
|
|
#!/dev/null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-02 07:29:45 +00:00
|
|
|
++<< go / build / all / debug
|
|
|
|
printf -- '[ii] building archiver...\n' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / archiver / debug' "${@}"
|
|
|
|
printf -- '[ii] building server...\n' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / server / debug' "${@}"
|
|
|
|
printf -- '[ii] building server-dummy...\n' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / server-dummy / debug' "${@}"
|
|
|
|
printf -- '[ii] building wrapper...\n' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / wrapper / debug' "${@}"
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
2022-09-02 08:38:22 +00:00
|
|
|
++<< go / build / all / release
|
2022-09-02 07:29:45 +00:00
|
|
|
printf -- '[ii] building archiver...\n' >&2
|
2022-09-02 08:38:22 +00:00
|
|
|
"${ZRUN[@]}" ':: go / build / archiver / release' "${@}"
|
2022-09-02 07:29:45 +00:00
|
|
|
printf -- '[ii] building server...\n' >&2
|
2022-09-02 08:38:22 +00:00
|
|
|
"${ZRUN[@]}" ':: go / build / server / release' "${@}"
|
2022-09-02 07:29:45 +00:00
|
|
|
printf -- '[ii] building server-dummy...\n' >&2
|
2022-09-02 08:38:22 +00:00
|
|
|
"${ZRUN[@]}" ':: go / build / server-dummy / release' "${@}"
|
2022-09-02 07:29:45 +00:00
|
|
|
printf -- '[ii] building wrapper...\n' >&2
|
2022-09-02 08:38:22 +00:00
|
|
|
"${ZRUN[@]}" ':: go / build / wrapper / release' "${@}"
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
++<< go / build / all / release / quick
|
|
|
|
export -- __BUILD_QUICK=true
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / all / release'
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
++<< go / build / all / publish / quick
|
|
|
|
export -- __BUILD_QUICK=true
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / all / publish'
|
2021-12-24 14:36:53 +00:00
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
<< go / build / server / debug
|
|
|
|
test "${#}" -eq 0
|
2022-09-02 11:43:15 +00:00
|
|
|
"${ZRUN[@]}" ':: sources / embedded / prepare'
|
2021-12-16 09:28:22 +00:00
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
|
|
|
if test -e "${_outputs}/binaries/debug/kawipiko-server" ; then
|
|
|
|
rm -- "${_outputs}/binaries/debug/kawipiko-server"
|
|
|
|
fi
|
|
|
|
exec -- \
|
|
|
|
nodaemon \
|
|
|
|
nice -n 19 \
|
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
|
|
|
-o "${_outputs}/binaries/debug/kawipiko-server" \
|
|
|
|
-- ./cmd/server.go \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
2021-12-17 09:56:52 +00:00
|
|
|
<< go / build / server / release / quick
|
2022-08-26 16:02:41 +00:00
|
|
|
export -- __BUILD_QUICK=true
|
2021-12-17 09:56:52 +00:00
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / server / release' "${@}"
|
|
|
|
!!
|
|
|
|
|
2022-09-02 07:29:45 +00:00
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
<< go / build / server / release
|
|
|
|
test "${#}" -eq 0
|
2022-09-02 12:19:49 +00:00
|
|
|
"${ZRUN[@]}" ':: sources / embedded / bundle'
|
2021-12-16 09:28:22 +00:00
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
|
|
|
if test -e "${_outputs}/binaries/release/kawipiko-server" ; then
|
|
|
|
rm -- "${_outputs}/binaries/release/kawipiko-server"
|
|
|
|
fi
|
2022-09-02 11:33:10 +00:00
|
|
|
_tags=(
|
|
|
|
netgo
|
|
|
|
)
|
2021-12-21 18:27:02 +00:00
|
|
|
_flags=(
|
2022-09-02 07:29:45 +00:00
|
|
|
#? -buildmode exe
|
2022-09-02 11:33:10 +00:00
|
|
|
)
|
|
|
|
_gcflags=()
|
2022-09-02 11:43:15 +00:00
|
|
|
_ldflags=()
|
2022-09-02 07:29:45 +00:00
|
|
|
if test "${__BUILD_QUICK:-false}" != true ; then
|
2022-09-02 11:33:10 +00:00
|
|
|
_flags+=( -trimpath -a )
|
|
|
|
_gcflags+=( 'all=-l=4' )
|
|
|
|
_ldflags+=( 'all=-s' )
|
2021-12-17 09:56:52 +00:00
|
|
|
fi
|
2022-09-02 11:43:15 +00:00
|
|
|
_ldflags+=(
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=release"
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
|
|
|
|
)
|
2022-09-11 10:40:58 +00:00
|
|
|
_seccomp="${__BUILD_SECCOMP:-false}"
|
|
|
|
if test "${_seccomp}" == true ; then
|
|
|
|
_tags+=(
|
|
|
|
seccomp
|
|
|
|
)
|
|
|
|
_ldflags+=(
|
|
|
|
-linkmode external
|
|
|
|
-extldflags -static
|
|
|
|
)
|
|
|
|
fi
|
2022-09-02 11:33:10 +00:00
|
|
|
_flags+=(
|
|
|
|
-tags "$( printf -- '%s,' "${_tags[@]}" )"
|
|
|
|
-gcflags "$( printf -- '%s ' "${_gcflags[@]}" )"
|
|
|
|
-ldflags "$( printf -- '%s ' "${_ldflags[@]}" )"
|
|
|
|
)
|
2021-12-16 09:28:22 +00:00
|
|
|
exec -- \
|
|
|
|
nodaemon \
|
|
|
|
nice -n 19 -- \
|
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
2021-12-17 09:56:52 +00:00
|
|
|
"${_flags[@]}" \
|
2021-12-16 09:28:22 +00:00
|
|
|
-o "${_outputs}/binaries/release/kawipiko-server" \
|
|
|
|
-- ./cmd/server.go \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<< go / build / archiver / debug
|
|
|
|
test "${#}" -eq 0
|
2022-09-02 11:43:15 +00:00
|
|
|
"${ZRUN[@]}" ':: sources / embedded / prepare'
|
2021-12-16 09:28:22 +00:00
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
|
|
|
if test -e "${_outputs}/binaries/debug/kawipiko-archiver" ; then
|
|
|
|
rm -- ${_outputs}/binaries/debug/kawipiko-archiver
|
|
|
|
fi
|
|
|
|
exec -- \
|
|
|
|
nodaemon \
|
|
|
|
nice -n 19 -- \
|
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
|
|
|
-o "${_outputs}/binaries/debug/kawipiko-archiver" \
|
|
|
|
-- ./cmd/archiver.go \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
2021-12-17 09:56:52 +00:00
|
|
|
|
|
|
|
<< go / build / archiver / release / quick
|
2022-08-26 16:02:41 +00:00
|
|
|
export -- __BUILD_QUICK=true
|
2021-12-17 09:56:52 +00:00
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / archiver / release' "${@}"
|
|
|
|
!!
|
|
|
|
|
2022-09-02 07:29:45 +00:00
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
<< go / build / archiver / release
|
|
|
|
test "${#}" -eq 0
|
2022-09-02 12:19:49 +00:00
|
|
|
"${ZRUN[@]}" ':: sources / embedded / bundle'
|
2021-12-16 09:28:22 +00:00
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
|
|
|
if test -e "${_outputs}/binaries/release/kawipiko-archiver" ; then
|
|
|
|
rm -- "${_outputs}/binaries/release/kawipiko-archiver"
|
|
|
|
fi
|
2022-09-02 11:33:10 +00:00
|
|
|
_tags=(
|
|
|
|
netgo
|
|
|
|
)
|
2021-12-21 18:27:02 +00:00
|
|
|
_flags=(
|
2022-09-02 07:29:45 +00:00
|
|
|
#? -buildmode exe
|
2022-09-02 11:33:10 +00:00
|
|
|
)
|
|
|
|
_gcflags=()
|
2022-09-02 11:43:15 +00:00
|
|
|
_ldflags=()
|
2022-09-02 07:29:45 +00:00
|
|
|
if test "${__BUILD_QUICK:-false}" != true ; then
|
2022-09-02 11:33:10 +00:00
|
|
|
_flags+=( -trimpath -a )
|
|
|
|
_gcflags+=( 'all=-l=4' )
|
|
|
|
_ldflags+=( 'all=-s' )
|
2021-12-17 09:56:52 +00:00
|
|
|
fi
|
2022-09-02 11:43:15 +00:00
|
|
|
_ldflags+=(
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=release"
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
|
|
|
|
)
|
2022-09-02 11:33:10 +00:00
|
|
|
_flags+=(
|
|
|
|
-tags "$( printf -- '%s,' "${_tags[@]}" )"
|
|
|
|
-gcflags "$( printf -- '%s ' "${_gcflags[@]}" )"
|
|
|
|
-ldflags "$( printf -- '%s ' "${_ldflags[@]}" )"
|
|
|
|
)
|
2021-12-16 09:28:22 +00:00
|
|
|
exec -- \
|
|
|
|
nodaemon \
|
|
|
|
nice -n 19 -- \
|
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
2021-12-17 09:56:52 +00:00
|
|
|
"${_flags[@]}" \
|
2021-12-16 09:28:22 +00:00
|
|
|
-o "${_outputs}/binaries/release/kawipiko-archiver" \
|
|
|
|
-- ./cmd/archiver.go \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<< go / build / wrapper / debug
|
|
|
|
test "${#}" -eq 0
|
2022-09-02 11:43:15 +00:00
|
|
|
"${ZRUN[@]}" ':: sources / embedded / prepare'
|
2021-12-16 09:28:22 +00:00
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
|
|
|
if test -e "${_outputs}/binaries/debug/kawipiko-wrapper" ; then
|
|
|
|
rm -- "${_outputs}/binaries/debug/kawipiko-wrapper"
|
|
|
|
fi
|
|
|
|
exec -- \
|
|
|
|
nodaemon \
|
|
|
|
nice -n 19 \
|
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
|
|
|
-o "${_outputs}/binaries/debug/kawipiko-wrapper" \
|
|
|
|
-- ./cmd/wrapper.go \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
2022-09-02 07:29:45 +00:00
|
|
|
<< go / build / wrapper / release / quick
|
|
|
|
export -- __BUILD_QUICK=true
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / wrapper / release' "${@}"
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
<< go / build / wrapper / release
|
|
|
|
test "${#}" -eq 0
|
2022-09-02 12:19:49 +00:00
|
|
|
"${ZRUN[@]}" ':: sources / embedded / bundle'
|
2021-12-16 09:28:22 +00:00
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
|
|
|
if test -e "${_outputs}/binaries/release/kawipiko-wrapper" ; then
|
|
|
|
rm -- "${_outputs}/binaries/release/kawipiko-wrapper"
|
|
|
|
fi
|
2022-09-02 11:33:10 +00:00
|
|
|
_tags=(
|
|
|
|
netgo
|
|
|
|
)
|
2022-09-02 07:29:45 +00:00
|
|
|
_flags=(
|
|
|
|
#? -buildmode exe
|
2022-09-02 11:33:10 +00:00
|
|
|
)
|
|
|
|
_gcflags=()
|
2022-09-02 11:43:15 +00:00
|
|
|
_ldflags=()
|
2022-09-02 07:29:45 +00:00
|
|
|
if test "${__BUILD_QUICK:-false}" != true ; then
|
2022-09-02 11:33:10 +00:00
|
|
|
_flags+=( -trimpath -a )
|
|
|
|
_gcflags+=( 'all=-l=4' )
|
|
|
|
_ldflags+=( 'all=-s' )
|
2022-09-02 07:29:45 +00:00
|
|
|
fi
|
2022-09-02 11:43:15 +00:00
|
|
|
_ldflags+=(
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=release"
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
|
|
|
|
)
|
2022-09-02 11:33:10 +00:00
|
|
|
_flags+=(
|
|
|
|
-tags "$( printf -- '%s,' "${_tags[@]}" )"
|
|
|
|
-gcflags "$( printf -- '%s ' "${_gcflags[@]}" )"
|
|
|
|
-ldflags "$( printf -- '%s ' "${_ldflags[@]}" )"
|
|
|
|
)
|
2021-12-16 09:28:22 +00:00
|
|
|
exec -- \
|
|
|
|
nodaemon \
|
|
|
|
nice -n 19 -- \
|
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
2022-09-02 07:29:45 +00:00
|
|
|
"${_flags[@]}" \
|
2021-12-16 09:28:22 +00:00
|
|
|
-o "${_outputs}/binaries/release/kawipiko-wrapper" \
|
|
|
|
-- ./cmd/wrapper.go \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-16 09:54:42 +00:00
|
|
|
<< go / build / server-dummy / debug
|
|
|
|
test "${#}" -eq 0
|
2022-09-02 11:43:15 +00:00
|
|
|
"${ZRUN[@]}" ':: sources / embedded / prepare'
|
2021-12-16 09:54:42 +00:00
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
|
|
|
if test -e "${_outputs}/binaries/debug/kawipiko-server-dummy" ; then
|
|
|
|
rm -- "${_outputs}/binaries/debug/kawipiko-server-dummy"
|
|
|
|
fi
|
|
|
|
exec -- \
|
|
|
|
nodaemon \
|
|
|
|
nice -n 19 \
|
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
|
|
|
-o "${_outputs}/binaries/debug/kawipiko-server-dummy" \
|
|
|
|
-- ./cmd/server-dummy.go \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
2021-12-17 09:56:52 +00:00
|
|
|
<< go / build / server-dummy / release / quick
|
2022-08-26 16:02:41 +00:00
|
|
|
export -- __BUILD_QUICK=true
|
2021-12-17 09:56:52 +00:00
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / server-dummy / release' "${@}"
|
|
|
|
!!
|
|
|
|
|
2022-09-02 07:29:45 +00:00
|
|
|
|
2021-12-16 09:54:42 +00:00
|
|
|
<< go / build / server-dummy / release
|
|
|
|
test "${#}" -eq 0
|
2022-09-02 12:19:49 +00:00
|
|
|
"${ZRUN[@]}" ':: sources / embedded / bundle'
|
2021-12-16 09:54:42 +00:00
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
|
|
|
if test -e "${_outputs}/binaries/release/kawipiko-server-dummy" ; then
|
|
|
|
rm -- "${_outputs}/binaries/release/kawipiko-server-dummy"
|
|
|
|
fi
|
2022-09-02 11:33:10 +00:00
|
|
|
_tags=(
|
|
|
|
netgo
|
|
|
|
)
|
2021-12-21 18:27:02 +00:00
|
|
|
_flags=(
|
2022-09-02 07:29:45 +00:00
|
|
|
#? -buildmode exe
|
2022-09-02 11:33:10 +00:00
|
|
|
)
|
|
|
|
_gcflags=()
|
2022-09-02 11:43:15 +00:00
|
|
|
_ldflags=()
|
2022-09-02 07:29:45 +00:00
|
|
|
if test "${__BUILD_QUICK:-false}" != true ; then
|
2022-09-02 11:33:10 +00:00
|
|
|
_flags+=( -trimpath -a )
|
|
|
|
_gcflags+=( 'all=-l=4' )
|
|
|
|
_ldflags+=( 'all=-s' )
|
2021-12-17 09:56:52 +00:00
|
|
|
fi
|
2022-09-02 11:43:15 +00:00
|
|
|
_ldflags+=(
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=release"
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
|
|
|
|
)
|
2022-09-02 11:33:10 +00:00
|
|
|
_flags+=(
|
|
|
|
-tags "$( printf -- '%s,' "${_tags[@]}" )"
|
|
|
|
-gcflags "$( printf -- '%s ' "${_gcflags[@]}" )"
|
|
|
|
-ldflags "$( printf -- '%s ' "${_ldflags[@]}" )"
|
|
|
|
)
|
2021-12-16 09:54:42 +00:00
|
|
|
exec -- \
|
|
|
|
nodaemon \
|
|
|
|
nice -n 19 -- \
|
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
2021-12-17 09:56:52 +00:00
|
|
|
"${_flags[@]}" \
|
2021-12-16 09:54:42 +00:00
|
|
|
-o "${_outputs}/binaries/release/kawipiko-server-dummy" \
|
|
|
|
-- ./cmd/server-dummy.go \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-02 08:38:22 +00:00
|
|
|
++<< go / build / all / publish
|
2022-02-14 09:26:18 +00:00
|
|
|
if test "${#}" -ge 1 ; then
|
|
|
|
_platform_0="${1}"
|
|
|
|
shift -- 1
|
|
|
|
else
|
|
|
|
_platform_0='all'
|
|
|
|
fi
|
|
|
|
if test "${#}" -ge 1 ; then
|
|
|
|
_component_0="${1}"
|
|
|
|
shift -- 1
|
|
|
|
else
|
|
|
|
_component_0=all
|
|
|
|
fi
|
2021-12-16 09:28:22 +00:00
|
|
|
test "${#}" -eq 0
|
2022-09-02 12:19:49 +00:00
|
|
|
"${ZRUN[@]}" ':: sources / embedded / bundle'
|
2021-12-16 09:28:22 +00:00
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
2022-09-11 18:37:50 +00:00
|
|
|
for _platform in linux--x86_64 linux--x86_64--seccomp darwin--x86_64 darwin--aarch64 openbsd--x86_64 freebsd--x86_64 android--aarch64 ; do
|
2022-02-14 09:26:18 +00:00
|
|
|
if test "${_platform_0}" != all -a "${_platform_0}" != "${_platform}" ; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
for _component in archiver server server-dummy wrapper ; do
|
|
|
|
if test "${_component_0}" != all -a "${_component_0}" != "${_component}" ; then
|
|
|
|
continue
|
|
|
|
fi
|
2022-09-11 18:37:50 +00:00
|
|
|
case "${_component}::${_platform}" in
|
|
|
|
( server::linux--x86_64--seccomp ) ;;
|
|
|
|
( *::linux--x86_64--seccomp ) continue ;;
|
|
|
|
esac
|
2022-09-02 08:38:22 +00:00
|
|
|
if test -e "${_outputs}/binaries/publish/kawipiko-${_component}--${_platform}" ; then
|
|
|
|
rm -f -- "${_outputs}/binaries/publish/kawipiko-${_component}--${_platform}"
|
2021-12-16 09:28:22 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
2022-09-11 18:37:50 +00:00
|
|
|
for _platform in linux--x86_64 linux--x86_64--seccomp darwin--x86_64 darwin--aarch64 openbsd--x86_64 freebsd--x86_64 android--aarch64 ; do
|
2022-02-14 09:26:18 +00:00
|
|
|
if test "${_platform_0}" != all -a "${_platform_0}" != "${_platform}" ; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
for _component in archiver server server-dummy wrapper ; do
|
|
|
|
if test "${_component_0}" != all -a "${_component_0}" != "${_component}" ; then
|
|
|
|
continue
|
|
|
|
fi
|
2022-09-11 18:37:50 +00:00
|
|
|
case "${_component}::${_platform}" in
|
|
|
|
( server::linux--x86_64--seccomp ) ;;
|
|
|
|
( *::linux--x86_64--seccomp ) continue ;;
|
|
|
|
esac
|
2022-09-02 08:38:22 +00:00
|
|
|
test ! -e "${_outputs}/binaries/publish/kawipiko-${_component}--${_platform}"
|
2021-12-16 09:28:22 +00:00
|
|
|
printf -- '[ii] building `%s` for `%s`...\n' "${_component}" "${_platform}" >&2
|
2022-09-02 08:38:22 +00:00
|
|
|
case "${_platform}" in
|
2022-09-11 18:37:50 +00:00
|
|
|
( linux--x86_64 | linux--x86_64--seccomp )
|
2022-09-02 08:38:22 +00:00
|
|
|
export -- GOOS=linux
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
;;
|
|
|
|
( darwin--x86_64 )
|
|
|
|
export -- GOOS=darwin
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
;;
|
|
|
|
( darwin--aarch64 )
|
|
|
|
export -- GOOS=darwin
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
;;
|
|
|
|
( freebsd--x86_64 )
|
|
|
|
export -- GOOS=freebsd
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
;;
|
|
|
|
( openbsd--x86_64 )
|
|
|
|
export -- GOOS=openbsd
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
;;
|
|
|
|
( android--aarch64 )
|
|
|
|
export -- GOOS=android
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
;;
|
|
|
|
( * )
|
|
|
|
exit -- 1
|
|
|
|
;;
|
|
|
|
esac
|
2022-09-11 18:37:50 +00:00
|
|
|
if test "${_platform}" == linux--x86_64--seccomp ; then
|
|
|
|
_seccomp=true
|
|
|
|
else
|
|
|
|
_seccomp=false
|
|
|
|
fi
|
|
|
|
_tags=(
|
|
|
|
netgo
|
|
|
|
)
|
|
|
|
_flags=(
|
|
|
|
#? -buildmode exe
|
|
|
|
)
|
|
|
|
_gcflags=()
|
|
|
|
_ldflags=()
|
|
|
|
if test "${__BUILD_QUICK:-false}" != true ; then
|
|
|
|
_flags+=( -trimpath -a )
|
|
|
|
_gcflags+=( 'all=-l=4' )
|
|
|
|
_ldflags+=( 'all=-s' )
|
|
|
|
fi
|
|
|
|
_ldflags+=(
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=release"
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
|
|
|
|
)
|
|
|
|
if test "${_seccomp}" == true ; then
|
|
|
|
_tags+=(
|
|
|
|
seccomp
|
|
|
|
)
|
|
|
|
_ldflags+=(
|
|
|
|
-linkmode external
|
|
|
|
-extldflags -static
|
|
|
|
)
|
|
|
|
fi
|
|
|
|
_flags+=(
|
|
|
|
-tags "$( printf -- '%s,' "${_tags[@]}" )"
|
|
|
|
-gcflags "$( printf -- '%s ' "${_gcflags[@]}" )"
|
|
|
|
-ldflags "$( printf -- '%s ' "${_ldflags[@]}" )"
|
|
|
|
)
|
2022-09-02 08:38:22 +00:00
|
|
|
nodaemon \
|
2021-12-16 09:28:22 +00:00
|
|
|
nice -n 19 -- \
|
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
2022-09-02 07:29:45 +00:00
|
|
|
"${_flags[@]}" \
|
2022-09-02 08:38:22 +00:00
|
|
|
-o "${_outputs}/binaries/publish/kawipiko-${_component}--${_platform}" \
|
2021-12-16 09:28:22 +00:00
|
|
|
-- "./cmd/${_component}.go" \
|
|
|
|
#
|
|
|
|
done
|
|
|
|
done
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<< go / build / server / analyze
|
|
|
|
test "${#}" -eq 0
|
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
2021-12-16 10:05:13 +00:00
|
|
|
-a \
|
2021-12-16 09:28:22 +00:00
|
|
|
-gcflags '-m' \
|
2021-12-17 09:56:52 +00:00
|
|
|
-o "${_outputs}/binaries/analyze/kawipiko-server" \
|
2021-12-16 10:05:13 +00:00
|
|
|
-- ./cmd/server/server.go \
|
2021-12-16 09:28:22 +00:00
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
<< 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 ':'
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-09-02 07:29:45 +00:00
|
|
|
<< go / dependencies / include
|
|
|
|
test "${#}" -ge 1
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / tool' \
|
|
|
|
get \
|
|
|
|
-v \
|
|
|
|
-d \
|
|
|
|
-- \
|
|
|
|
"${@}" \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
<< go / dependencies / update
|
|
|
|
test "${#}" -eq 0
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / tool' \
|
|
|
|
get \
|
|
|
|
-v \
|
|
|
|
-d \
|
|
|
|
-- \
|
|
|
|
all \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
2022-09-07 08:46:09 +00:00
|
|
|
<< go / dependencies / update / iterative
|
|
|
|
test "${#}" -eq 0
|
|
|
|
_skipped=(
|
|
|
|
github.com/volution/kawipiko
|
|
|
|
)
|
|
|
|
"${ZRUN[@]}" ':: go / tool' mod tidy
|
|
|
|
_dependencies_hash_old="$( exec -- md5sum -b -- ./sources/go.mod )"
|
|
|
|
readarray -t -- _dependencies \
|
|
|
|
< <( exec -- "${ZRUN[@]}" ':: go / tool' list -m -- all ) \
|
|
|
|
#
|
|
|
|
for _dependency in "${_dependencies[@]}" ; do
|
|
|
|
_dependency="${_dependency%% *}"
|
|
|
|
printf -- '[ii] updating `%s` @latest...\n' "${_dependency}" >&2
|
|
|
|
for _skipped_0 in "${_skipped[@]}" ; do
|
|
|
|
if test "${_dependency}" == "${_skipped_0}" ; then
|
|
|
|
printf -- '[ww] -> skipping!\n' >&2
|
|
|
|
continue 2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if "${ZRUN[@]}" ':: go / tool' \
|
|
|
|
get \
|
|
|
|
-v \
|
|
|
|
-- \
|
|
|
|
"${_dependency}@latest" \
|
|
|
|
; then
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
printf -- '[ee] -> failed @latest!\n' >&2
|
|
|
|
fi
|
|
|
|
printf -- '[ii] updating `%s` @minor...\n' "${_dependency}" >&2
|
|
|
|
if "${ZRUN[@]}" ':: go / tool' \
|
|
|
|
get \
|
|
|
|
-v \
|
|
|
|
-u \
|
|
|
|
-- \
|
|
|
|
"${_dependency}" \
|
|
|
|
; then
|
|
|
|
printf -- '[ee] -> succeeded @minor!\n' >&2
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
printf -- '[ee] -> failed @minor!\n' >&2
|
|
|
|
fi
|
|
|
|
printf -- '[ii] updating `%s` @patch...\n' "${_dependency}" >&2
|
|
|
|
if "${ZRUN[@]}" ':: go / tool' \
|
|
|
|
get \
|
|
|
|
-v \
|
|
|
|
-u=patch \
|
|
|
|
-- \
|
|
|
|
"${_dependency}" \
|
|
|
|
; then
|
|
|
|
printf -- '[ee] -> succeeded @patch!\n' >&2
|
|
|
|
continue
|
|
|
|
else
|
|
|
|
printf -- '[ee] -> failed @patch!\n' >&2
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
"${ZRUN[@]}" ':: go / tool' mod tidy
|
|
|
|
_dependencies_hash_new="$( exec -- md5sum -b -- ./sources/go.mod )"
|
|
|
|
if test "${_dependencies_hash_new}" != "${_dependencies_hash_old}" ; then
|
|
|
|
printf -- '\n\n\n[--]\n' >&2
|
|
|
|
printf -- '[ww] dependencies graph changed; restarting!\n' >&2
|
|
|
|
printf -- '[--]\n\n\n\n' >&2
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / dependencies / update / iterative'
|
|
|
|
else
|
|
|
|
printf -- '\n\n\n[--]\n' >&2
|
|
|
|
printf -- '[ww] dependencies graph stable; exiting!\n' >&2
|
|
|
|
fi
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
<< go / dependencies / list
|
|
|
|
test "${#}" -eq 0
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / tool' \
|
|
|
|
list \
|
|
|
|
-m \
|
|
|
|
-- \
|
|
|
|
all \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
<< go / dependencies / tidy
|
|
|
|
test "${#}" -eq 0
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / tool' \
|
|
|
|
mod tidy \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
<< go / dependencies / verify
|
|
|
|
test "${#}" -eq 0
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / tool' \
|
|
|
|
mod verify \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
<< go / dependencies / upgrade
|
|
|
|
test "${#}" -eq 0
|
|
|
|
"${ZRUN[@]}" ':: go / dependencies / update'
|
|
|
|
"${ZRUN[@]}" ':: go / dependencies / tidy'
|
|
|
|
"${ZRUN[@]}" ':: go / dependencies / verify'
|
|
|
|
"${ZRUN[@]}" ':: go / dependencies / list'
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<< go / tool
|
2022-09-02 07:29:45 +00:00
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
test "${#}" -ge 1
|
|
|
|
|
2022-09-02 07:29:45 +00:00
|
|
|
export -n -- \
|
|
|
|
ZRUN_LIBRARY_SOURCE= \
|
|
|
|
ZRUN_LIBRARY_URL= \
|
|
|
|
ZRUN_LIBRARY_IDENTIFIER= \
|
|
|
|
ZRUN_LIBRARY_FINGERPRINT= \
|
|
|
|
ZRUN_EXECUTABLE= \
|
|
|
|
ZRUN_WORKSPACE= \
|
|
|
|
ZRUN_CACHE= \
|
|
|
|
#
|
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
|
|
|
_sources="$( exec -- readlink -e -- ./sources )"
|
|
|
|
|
|
|
|
export -- GOPATH="${_outputs}/go"
|
|
|
|
export -- GOBIN="${_outputs}/go/bin"
|
|
|
|
export -- GOTMPDIR="${_outputs}/go/tmp"
|
|
|
|
export -- GOCACHE="${_outputs}/go/cache"
|
2022-09-02 07:29:45 +00:00
|
|
|
|
|
|
|
if test -e "${_outputs}/go-tool" ; then
|
|
|
|
_go="$( exec -- readlink -e -- "${_outputs}/go-tool" )"
|
|
|
|
else
|
|
|
|
_go="$( type -P -- go )"
|
|
|
|
fi
|
2021-12-16 09:28:22 +00:00
|
|
|
|
|
|
|
cd -- "${_sources}"
|
|
|
|
|
2022-09-02 07:29:45 +00:00
|
|
|
exec -- "${_go}" "${@}"
|
2021-12-16 09:28:22 +00:00
|
|
|
!!
|
|
|
|
|