build: add support for Standard Go in Makefile and update .gitignore

This commit is contained in:
deluan
2026-02-23 20:55:34 -05:00
parent 8d07bc6120
commit 1552322429
2 changed files with 8 additions and 1 deletions

1
.gitignore vendored
View File

@@ -1,3 +1,4 @@
*.wasm *.wasm
*.ndp *.ndp
tmp tmp
discord-rich-presence

View File

@@ -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