build: add support for Standard Go in Makefile and update .gitignore
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
*.wasm
|
*.wasm
|
||||||
*.ndp
|
*.ndp
|
||||||
tmp
|
tmp
|
||||||
|
discord-rich-presence
|
||||||
6
Makefile
6
Makefile
@@ -3,12 +3,18 @@ SHELL := /usr/bin/env bash
|
|||||||
|
|
||||||
PLUGIN_NAME := discord-rich-presence
|
PLUGIN_NAME := discord-rich-presence
|
||||||
WASM_FILE := plugin.wasm
|
WASM_FILE := plugin.wasm
|
||||||
|
TINYGO := $(shell command -v tinygo 2> /dev/null)
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test -race ./...
|
go test -race ./...
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
ifdef TINYGO
|
||||||
tinygo build -opt=2 -scheduler=none -no-debug -o $(WASM_FILE) -target wasi -buildmode=c-shared .
|
tinygo build -opt=2 -scheduler=none -no-debug -o $(WASM_FILE) -target wasi -buildmode=c-shared .
|
||||||
|
else
|
||||||
|
GOOS=wasip1 GOARCH=wasm go build -buildmode=c-shared -o $(WASM_FILE) .
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
package: build
|
package: build
|
||||||
zip $(PLUGIN_NAME).ndp $(WASM_FILE) manifest.json
|
zip $(PLUGIN_NAME).ndp $(WASM_FILE) manifest.json
|
||||||
|
|||||||
Reference in New Issue
Block a user