2021-12-16 09:28:22 +00:00
|
|
|
#!/dev/null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
::// go / ...
|
2022-09-02 07:29:45 +00:00
|
|
|
|
|
|
|
|
2022-09-02 08:38:22 +00:00
|
|
|
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--:: watch / go / build / * / debug :: exec -- "${ZRUN[@]}" ':: sources / watch' ':: go / build / * / debug' "${@}"
|
|
|
|
--:: watch / go / execute / * / debug :: exec -- "${ZRUN[@]}" ':: sources / watch' ':: go / execute / * / debug' "${@}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--<< go / execute / * / debug
|
|
|
|
|
|
|
|
test "${#}" -ge 1
|
|
|
|
_main="${1}"
|
|
|
|
shift -- 1
|
|
|
|
|
|
|
|
export -- __BUILD_SUFFIX=native
|
|
|
|
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug' "${_main}"
|
|
|
|
|
|
|
|
export -n -- \
|
|
|
|
ZRUN_LIBRARY_SOURCE= \
|
|
|
|
ZRUN_LIBRARY_URL= \
|
|
|
|
ZRUN_LIBRARY_IDENTIFIER= \
|
|
|
|
ZRUN_LIBRARY_FINGERPRINT= \
|
|
|
|
ZRUN_EXECUTABLE= \
|
|
|
|
ZRUN_WORKSPACE= \
|
|
|
|
ZRUN_WORKSPACE_IDENTIFIER= \
|
|
|
|
ZRUN_CACHE= \
|
|
|
|
#
|
|
|
|
|
|
|
|
exec -- "./.outputs/binaries/${_main}--debug--native" "${@}"
|
2022-09-02 08:38:22 +00:00
|
|
|
!!
|
|
|
|
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / execute / * / release
|
|
|
|
|
|
|
|
test "${#}" -ge 1
|
|
|
|
_main="${1}"
|
|
|
|
shift -- 1
|
|
|
|
|
|
|
|
export -- __BUILD_SUFFIX=native
|
|
|
|
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release' "${_main}"
|
|
|
|
|
|
|
|
export -n -- \
|
|
|
|
ZRUN_LIBRARY_SOURCE= \
|
|
|
|
ZRUN_LIBRARY_URL= \
|
|
|
|
ZRUN_LIBRARY_IDENTIFIER= \
|
|
|
|
ZRUN_LIBRARY_FINGERPRINT= \
|
|
|
|
ZRUN_EXECUTABLE= \
|
|
|
|
ZRUN_WORKSPACE= \
|
|
|
|
ZRUN_WORKSPACE_IDENTIFIER= \
|
|
|
|
ZRUN_CACHE= \
|
|
|
|
#
|
|
|
|
|
|
|
|
exec -- "./.outputs/binaries/${_main}--release--native" "${@}"
|
2021-12-24 14:36:53 +00:00
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug
|
|
|
|
|
|
|
|
test "${#}" -ge 1
|
|
|
|
_main="${1}"
|
|
|
|
shift -- 1
|
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
test "${#}" -eq 0
|
2023-03-05 15:02:38 +00:00
|
|
|
|
2022-09-02 11:43:15 +00:00
|
|
|
"${ZRUN[@]}" ':: sources / embedded / prepare'
|
2023-03-05 15:02:38 +00:00
|
|
|
|
|
|
|
_binaries="$( exec -- readlink -e -- ./.outputs/binaries )"
|
|
|
|
|
|
|
|
_build_target=development
|
|
|
|
_build_git_hash="$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
|
|
|
|
|
|
|
|
_tags=(
|
|
|
|
netgo
|
|
|
|
)
|
|
|
|
_flags=()
|
|
|
|
_gcflags=(
|
|
|
|
-N
|
|
|
|
-l
|
|
|
|
)
|
|
|
|
_ldflags=(
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=${_build_target}"
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=${_build_git_hash}"
|
|
|
|
)
|
|
|
|
|
|
|
|
_seccomp="${__BUILD_SECCOMP:-false}"
|
|
|
|
if test "${_seccomp}" == true ; then
|
|
|
|
_tags+=(
|
|
|
|
seccomp
|
|
|
|
)
|
|
|
|
_ldflags+=(
|
|
|
|
-linkmode external
|
|
|
|
-extldflags -static
|
|
|
|
)
|
2021-12-16 09:28:22 +00:00
|
|
|
fi
|
2023-03-05 15:02:38 +00:00
|
|
|
|
|
|
|
_tags="$( printf -- '%s,' "${_tags[@]}" )"
|
|
|
|
_gcflags="$( printf -- '%s ' "${_gcflags[@]}" )"
|
|
|
|
_ldflags="$( printf -- '%s ' "${_ldflags[@]}" )"
|
|
|
|
|
|
|
|
_suffix="${__BUILD_SUFFIX:-native}"
|
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
exec -- \
|
2023-03-05 15:02:38 +00:00
|
|
|
nice -n 19 -- \
|
2021-12-16 09:28:22 +00:00
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
2023-03-05 15:02:38 +00:00
|
|
|
-o "${_binaries}/${_main}--debug--${_suffix}" \
|
|
|
|
-tags "${_tags}" \
|
|
|
|
-gcflags "${_gcflags}" \
|
|
|
|
-ldflags "${_ldflags}" \
|
|
|
|
"${_flags[@]}" \
|
|
|
|
-- \
|
|
|
|
"./cmd/${_main#kawipiko-}.go" \
|
2021-12-16 09:28:22 +00:00
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
2021-12-17 09:56:52 +00:00
|
|
|
|
2022-09-02 07:29:45 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release
|
|
|
|
|
|
|
|
test "${#}" -ge 1
|
|
|
|
_main="${1}"
|
|
|
|
shift -- 1
|
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
test "${#}" -eq 0
|
2023-03-05 15:02:38 +00:00
|
|
|
|
2022-09-02 12:19:49 +00:00
|
|
|
"${ZRUN[@]}" ':: sources / embedded / bundle'
|
2023-03-05 15:02:38 +00:00
|
|
|
|
|
|
|
_binaries="$( exec -- readlink -e -- ./.outputs/binaries )"
|
|
|
|
|
|
|
|
_build_target=release
|
|
|
|
_build_git_hash="$( exec -- cat -- ./.outputs/markers/build-git-hash.txt )"
|
|
|
|
|
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=()
|
2023-03-05 15:02:38 +00:00
|
|
|
|
2022-09-02 07:29:45 +00:00
|
|
|
if test "${__BUILD_QUICK:-false}" != true ; then
|
2023-03-05 15:02:38 +00:00
|
|
|
_flags+=( -a )
|
2022-09-02 11:33:10 +00:00
|
|
|
_gcflags+=( 'all=-l=4' )
|
|
|
|
_ldflags+=( 'all=-s' )
|
2021-12-17 09:56:52 +00:00
|
|
|
fi
|
2023-03-05 15:02:38 +00:00
|
|
|
|
2022-09-02 11:43:15 +00:00
|
|
|
_ldflags+=(
|
2023-03-05 15:02:38 +00:00
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_TARGET=${_build_target}"
|
|
|
|
-X "github.com/volution/kawipiko/embedded.BUILD_GIT_HASH=${_build_git_hash}"
|
2022-09-02 11:43:15 +00:00
|
|
|
)
|
2023-03-05 15:02:38 +00:00
|
|
|
|
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
|
2023-03-05 15:02:38 +00:00
|
|
|
|
|
|
|
_tags="$( printf -- '%s,' "${_tags[@]}" )"
|
|
|
|
_gcflags="$( printf -- '%s ' "${_gcflags[@]}" )"
|
|
|
|
_ldflags="$( printf -- '%s ' "${_ldflags[@]}" )"
|
|
|
|
|
|
|
|
_suffix="${__BUILD_SUFFIX:-native}"
|
|
|
|
|
|
|
|
if test -f "${_binaries}/${_main}--release--${_suffix}" ; then
|
|
|
|
mv -T -- "${_binaries}/${_main}--release--${_suffix}" "${_binaries}/${_main}--release--${_suffix}.old"
|
|
|
|
fi
|
|
|
|
|
|
|
|
nice -n 19 -- \
|
2021-12-16 09:28:22 +00:00
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
2023-03-05 15:02:38 +00:00
|
|
|
-o "${_binaries}/${_main}--release--${_suffix}.new" \
|
|
|
|
-tags "${_tags}" \
|
|
|
|
-gcflags "${_gcflags}" \
|
|
|
|
-ldflags "${_ldflags}" \
|
2021-12-17 09:56:52 +00:00
|
|
|
"${_flags[@]}" \
|
2023-03-05 15:02:38 +00:00
|
|
|
-trimpath \
|
|
|
|
-- \
|
|
|
|
"./cmd/${_main#kawipiko-}.go" \
|
2021-12-16 09:28:22 +00:00
|
|
|
#
|
2023-03-05 15:02:38 +00:00
|
|
|
|
|
|
|
if test ! -e "${_binaries}/${_main}--release--${_suffix}.old" ; then
|
|
|
|
mv -T -- "${_binaries}/${_main}--release--${_suffix}.new" "${_binaries}/${_main}--release--${_suffix}"
|
|
|
|
elif ! cmp -s -- "${_binaries}/${_main}--release--${_suffix}.new" "${_binaries}/${_main}--release--${_suffix}.old" ; then
|
|
|
|
mv -T -- "${_binaries}/${_main}--release--${_suffix}.new" "${_binaries}/${_main}--release--${_suffix}"
|
|
|
|
rm -- "${_binaries}/${_main}--release--${_suffix}.old"
|
|
|
|
else
|
|
|
|
mv -T -- "${_binaries}/${_main}--release--${_suffix}.old" "${_binaries}/${_main}--release--${_suffix}"
|
|
|
|
rm -- "${_binaries}/${_main}--release--${_suffix}.new"
|
|
|
|
fi
|
2021-12-16 09:28:22 +00:00
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
++<< go / build / all / debug
|
|
|
|
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
|
|
|
|
printf -- '[ii] building `%s`...\n' "${_main}" >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / all' "${_main}" "${@}"
|
|
|
|
done
|
2021-12-16 09:28:22 +00:00
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / all
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'native' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / native' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'linux / x86_64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / linux / x86_64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'linux / aarch64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / linux / aarch64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'linux / armv6' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / linux / armv6' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'linux / x86_64--seccomp' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / linux / x86_64--seccomp' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'darwin / x86_64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / darwin / x86_64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'darwin / aarch64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / darwin / aarch64' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'freebsd / x86_64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / freebsd / x86_64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'freebsd / aarch64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / freebsd / aarch64' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'openbsd / x86_64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / openbsd / x86_64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'openbsd / aarch64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / openbsd / aarch64' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'android / x86_64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / android / x86_64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'android / aarch64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / debug / android / aarch64' "${@}"
|
|
|
|
!!
|
2021-12-17 09:56:52 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / native
|
|
|
|
export -- __BUILD_SUFFIX=native
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
2021-12-17 09:56:52 +00:00
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / linux / x86_64--seccomp
|
|
|
|
export -- GOOS=linux
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=linux--x86_64--seccomp
|
|
|
|
export -- __BUILD_SECCOMP=true
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
|
|
|
!!
|
2022-09-02 07:29:45 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / linux / x86_64
|
|
|
|
export -- GOOS=linux
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=linux--x86_64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
2021-12-16 09:28:22 +00:00
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / linux / aarch64
|
|
|
|
export -- GOOS=linux
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
export -- __BUILD_SUFFIX=linux--aarch64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
|
|
|
!!
|
2021-12-16 09:28:22 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / linux / armv6
|
|
|
|
export -- GOOS=linux
|
|
|
|
export -- GOARCH=arm
|
|
|
|
export -- GOARM=6
|
|
|
|
export -- __BUILD_SUFFIX=linux--armv6
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
|
|
|
!!
|
2021-12-16 09:28:22 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / darwin / x86_64
|
|
|
|
export -- GOOS=darwin
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=darwin--x86_64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
|
|
|
!!
|
2021-12-16 09:28:22 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / darwin / aarch64
|
|
|
|
export -- GOOS=darwin
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
export -- __BUILD_SUFFIX=darwin--aarch64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
2021-12-16 09:28:22 +00:00
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / freebsd / x86_64
|
|
|
|
export -- GOOS=freebsd
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=freebsd--x86_64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
|
|
|
!!
|
2021-12-16 09:28:22 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / freebsd / aarch64
|
|
|
|
export -- GOOS=freebsd
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
export -- __BUILD_SUFFIX=freebsd--aarch64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
|
|
|
!!
|
|
|
|
|
|
|
|
--<< go / build / * / debug / openbsd / x86_64
|
|
|
|
export -- GOOS=openbsd
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=openbsd--x86_64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
2022-09-02 07:29:45 +00:00
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / openbsd / aarch64
|
|
|
|
export -- GOOS=openbsd
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
export -- __BUILD_SUFFIX=openbsd--aarch64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
|
|
|
!!
|
2022-09-02 07:29:45 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / android / x86_64
|
|
|
|
export -- GOOS=android
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=android--x86_64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
2021-12-16 09:28:22 +00:00
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / debug / android / aarch64
|
|
|
|
export -- GOOS=android
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
export -- __BUILD_SUFFIX=android--aarch64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / debug' "${@}"
|
|
|
|
!!
|
2021-12-16 09:28:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
|
|
|
|
++<< go / build / all / release / quick
|
|
|
|
export -- __BUILD_QUICK=true
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / all / release' "${@}"
|
2021-12-16 09:54:42 +00:00
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
++<< go / build / all / release
|
|
|
|
for _main in kawipiko-wrapper kawipiko-archiver kawipiko-server kawipiko-server-dummy ; do
|
|
|
|
printf -- '[ii] building `%s`...\n' "${_main}" >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / all' "${_main}" "${@}"
|
|
|
|
done
|
|
|
|
!!
|
2021-12-16 09:54:42 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / all
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'native' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / native' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'linux / x86_64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / linux / x86_64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'linux / aarch64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / linux / aarch64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'linux / armv6' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / linux / armv6' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'linux / x86_64--seccomp' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / linux / x86_64--seccomp' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'darwin / x86_64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / darwin / x86_64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'darwin / aarch64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / darwin / aarch64' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'freebsd / x86_64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / freebsd / x86_64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'freebsd / aarch64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / freebsd / aarch64' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'openbsd / x86_64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / openbsd / x86_64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'openbsd / aarch64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / openbsd / aarch64' "${@}"
|
|
|
|
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'android / x86_64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / android / x86_64' "${@}"
|
|
|
|
printf -- '[ii] building for `%s`...\n' 'android / aarch64' >&2
|
|
|
|
"${ZRUN[@]}" ':: go / build / * / release / android / aarch64' "${@}"
|
2021-12-17 09:56:52 +00:00
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / native
|
|
|
|
export -- __BUILD_SUFFIX=native
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
|
|
|
!!
|
2022-09-02 07:29:45 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / linux / x86_64--seccomp
|
|
|
|
export -- GOOS=linux
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=linux--x86_64--seccomp
|
|
|
|
export -- __BUILD_SECCOMP=true
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
|
|
|
!!
|
|
|
|
|
|
|
|
--<< go / build / * / release / linux / x86_64
|
|
|
|
export -- GOOS=linux
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=linux--x86_64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
2021-12-16 09:54:42 +00:00
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / linux / aarch64
|
|
|
|
export -- GOOS=linux
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
export -- __BUILD_SUFFIX=linux--aarch64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
|
|
|
!!
|
2021-12-16 09:54:42 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / linux / armv6
|
|
|
|
export -- GOOS=linux
|
|
|
|
export -- GOARCH=arm
|
|
|
|
export -- GOARM=6
|
|
|
|
export -- __BUILD_SUFFIX=linux--armv6
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
|
|
|
!!
|
2021-12-16 09:54:42 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / darwin / x86_64
|
|
|
|
export -- GOOS=darwin
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=darwin--x86_64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
|
|
|
!!
|
2021-12-16 09:54:42 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / darwin / aarch64
|
|
|
|
export -- GOOS=darwin
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
export -- __BUILD_SUFFIX=darwin--aarch64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
2021-12-16 09:28:22 +00:00
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / freebsd / x86_64
|
|
|
|
export -- GOOS=freebsd
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=freebsd--x86_64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
|
|
|
!!
|
2021-12-16 09:28:22 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / freebsd / aarch64
|
|
|
|
export -- GOOS=freebsd
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
export -- __BUILD_SUFFIX=freebsd--aarch64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
|
|
|
!!
|
2021-12-16 09:28:22 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / openbsd / x86_64
|
|
|
|
export -- GOOS=openbsd
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=openbsd--x86_64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
|
|
|
!!
|
2021-12-16 09:28:22 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / openbsd / aarch64
|
|
|
|
export -- GOOS=openbsd
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
export -- __BUILD_SUFFIX=openbsd--aarch64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
2021-12-16 09:28:22 +00:00
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / android / x86_64
|
|
|
|
export -- GOOS=android
|
|
|
|
export -- GOARCH=amd64
|
|
|
|
export -- __BUILD_SUFFIX=android--x86_64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
|
|
|
!!
|
2021-12-16 09:28:22 +00:00
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
--<< go / build / * / release / android / aarch64
|
|
|
|
export -- GOOS=android
|
|
|
|
export -- GOARCH=arm64
|
|
|
|
export -- __BUILD_SUFFIX=android--aarch64
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / build / * / release' "${@}"
|
2021-12-16 09:28:22 +00:00
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 \
|
2023-03-05 15:02:38 +00:00
|
|
|
-u \
|
2021-12-16 09:28:22 +00:00
|
|
|
-- \
|
|
|
|
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'
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
<< go / dependencies / vendor
|
|
|
|
test "${#}" -eq 0
|
|
|
|
|
|
|
|
if test -e ./vendors ; then
|
|
|
|
rm -- ./sources/vendor
|
|
|
|
mv -T -- ./vendors ./sources/vendor
|
|
|
|
fi
|
|
|
|
|
|
|
|
"${ZRUN[@]}" ':: go / tool' \
|
|
|
|
mod vendor \
|
|
|
|
#
|
|
|
|
|
|
|
|
mv -T -- ./sources/vendor ./vendors
|
|
|
|
ln -s -T -- ../vendors ./sources/vendor
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
<< go / dependencies / vendor / cleanup
|
|
|
|
test "${#}" -eq 0
|
|
|
|
|
|
|
|
find ./vendor/ \
|
|
|
|
-xdev \
|
|
|
|
-not -type d \
|
|
|
|
-not -path './sources/vendor/modules.txt' \
|
|
|
|
-not -name 'go.mod' \
|
|
|
|
-not -name 'go.sum' \
|
|
|
|
-not -name '*.go' \
|
|
|
|
-not -name '*.c' \
|
|
|
|
-not -name '*.h' \
|
|
|
|
-not -name '*.s' \
|
|
|
|
-delete \
|
|
|
|
#
|
|
|
|
|
|
|
|
find ./vendor/ \
|
|
|
|
-xdev \
|
|
|
|
-type d \
|
|
|
|
-empty \
|
|
|
|
-delete \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-12-16 09:28:22 +00:00
|
|
|
<< 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= \
|
2023-03-05 15:02:38 +00:00
|
|
|
ZRUN_WORKSPACE_IDENTIFIER= \
|
2022-09-02 07:29:45 +00:00
|
|
|
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
|
|
|
!!
|
|
|
|
|
2023-03-05 15:02:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<< go / build / kawipiko-server / analyze
|
|
|
|
test "${#}" -eq 0
|
|
|
|
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
|
|
|
exec -- "${ZRUN[@]}" ':: go / tool' \
|
|
|
|
build \
|
|
|
|
-o "${_outputs}/binaries/kawipiko-server--analyze" \
|
|
|
|
-gcflags '-m' \
|
|
|
|
-a \
|
|
|
|
-- \
|
|
|
|
./cmd/server/server.go \
|
|
|
|
#
|
|
|
|
!!
|
|
|
|
|
|
|
|
|
|
|
|
<< go / build / kawipiko-server / analyze / escapes
|
|
|
|
"${ZRUN[@]}" ':: go / build / kawipiko-server / analyze' "${@}" \
|
|
|
|
2>&1 \
|
|
|
|
| grep -F -e ' escapes ' \
|
|
|
|
| LC_ALL=C sort -n -k 2,2 -t ':'
|
|
|
|
!!
|
|
|
|
|
|
|
|
|