[sources] Add support for "all-in-one" executable
This commit is contained in:
parent
feac943d0f
commit
55c26a97ca
2 changed files with 81 additions and 0 deletions
|
@ -156,6 +156,47 @@
|
|||
|
||||
|
||||
|
||||
<< execute / wrapper / release
|
||||
"${ZRUN[@]}" ':: go / build / wrapper / release'
|
||||
exec -- env -i -- ./.outputs/binaries/release/kawipiko "${@}"
|
||||
!!
|
||||
|
||||
|
||||
<< go / build / wrapper / release
|
||||
test "${#}" -eq 0
|
||||
_outputs="$( exec -- readlink -e -- ./.outputs )"
|
||||
mkdir -p -- "${_outputs}/binaries/release"
|
||||
rm -f -- "${_outputs}/binaries/release/kawipiko-server"
|
||||
exec -- "${ZRUN[@]}" ':: go / tool' \
|
||||
build \
|
||||
-v \
|
||||
-tags 'netgo nobrotli' \
|
||||
-ldflags 'all=-s -extld=gcc -extldflags=-static' \
|
||||
-gcflags 'all=-l=4' \
|
||||
-o "${_outputs}/binaries/release/kawipiko" \
|
||||
-- ./cmd/wrapper.go \
|
||||
#
|
||||
!!
|
||||
|
||||
|
||||
<< go / build / wrapper / 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' "${@}"
|
||||
|
@ -164,11 +205,13 @@
|
|||
<< 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' "${@}"
|
||||
!!
|
||||
|
||||
|
||||
|
|
38
sources/cmd/wrapper.go
Normal file
38
sources/cmd/wrapper.go
Normal file
|
@ -0,0 +1,38 @@
|
|||
|
||||
package main
|
||||
|
||||
|
||||
import "fmt"
|
||||
import "os"
|
||||
|
||||
|
||||
import "github.com/volution/kawipiko/cmd/server"
|
||||
import "github.com/volution/kawipiko/cmd/archiver"
|
||||
|
||||
|
||||
|
||||
|
||||
func main () () {
|
||||
|
||||
if len (os.Args) >= 2 {
|
||||
|
||||
_command := os.Args[1]
|
||||
os.Args = os.Args[1:]
|
||||
|
||||
switch _command {
|
||||
|
||||
case "server" :
|
||||
server.Main ()
|
||||
|
||||
case "archiver" :
|
||||
archiver.Main ()
|
||||
|
||||
default :
|
||||
fmt.Fprintf (os.Stderr, "[!!] [44887671] unknown command: `%s`; aborting!\n", _command)
|
||||
}
|
||||
|
||||
} else {
|
||||
fmt.Fprintf (os.Stderr, "[!!] [3628f38a] expected command: `server` or `archiver`; aborting!\n")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue