Inital Commit
This commit is contained in:
43
AdvMakefile
Normal file
43
AdvMakefile
Normal file
@@ -0,0 +1,43 @@
|
||||
defaultName = "wasmconv"
|
||||
defaultTarget = "serve_dev"
|
||||
|
||||
def wasmconv_serve_dev():
|
||||
shell.Exec("go run . -dev")
|
||||
|
||||
def wasmconv_dist():
|
||||
distDir = "dist"
|
||||
|
||||
if file.Exists(distDir):
|
||||
log.Warn("Found existing dist dir, replacing")
|
||||
shell.Exec("rm -r " + distDir)
|
||||
|
||||
log.Info("Finding wasm_exec.js")
|
||||
GOROOT = shell.Exec("go env GOROOT", output='return')
|
||||
GOROOT = strings.TrimSpace(GOROOT)
|
||||
WasmExecPath = GOROOT + "/misc/wasm/wasm_exec.js"
|
||||
if not file.Exists(WasmExecPath):
|
||||
log.Fatal("File wasm_exec.js not found")
|
||||
log.Info("Found wasm_exec.js at " + WasmExecPath)
|
||||
shell.Exec("mkdir " + distDir)
|
||||
shell.Exec(fmt.Sprintf("cp -v %s %s/wasm_exec.js", WasmExecPath, distDir))
|
||||
|
||||
if shell.LookPath("vugugen") == -1:
|
||||
log.Info("Command `vugugen` not found, installing")
|
||||
shell.Exec("github.com/vugu/vugu/cmd/vugugen")
|
||||
|
||||
log.Info("Generating code and building wasm")
|
||||
shell.Exec(fmt.Sprintf("""
|
||||
go generate .
|
||||
env GOOS=js GOARCH=wasm go build -o %s/main.wasm
|
||||
""", distDir))
|
||||
|
||||
log.Info("Copying static assets")
|
||||
shell.Exec("cp -rv assets/* " + distDir)
|
||||
|
||||
log.Info("Building server executables")
|
||||
shell.Exec(fmt.Sprintf("""
|
||||
env GOOS=linux GOARCH=amd64 go build -o %s/server-linux-x86_64
|
||||
env GOOS=linux GOARCH=arm64 go build -o %s/server-linux-aarch64
|
||||
""", distDir, distDir))
|
||||
|
||||
log.Info("Dist complete")
|
||||
Reference in New Issue
Block a user