mirror of
https://github.com/remko/waforth
synced 2025-01-14 08:01:34 +01:00
github: Package standalone
This commit is contained in:
parent
77a4df1609
commit
7a1e7de085
4 changed files with 39 additions and 2 deletions
25
.github/workflows/publish-standalone.yml
vendored
Normal file
25
.github/workflows/publish-standalone.yml
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
name: Publish Standalone
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
uses: ./.github/workflows/build.yml
|
||||||
|
|
||||||
|
publish-standalone:
|
||||||
|
needs: build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [macos-latest, ubuntu-latest]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- uses: ./.github/actions/setup
|
||||||
|
- run: make -C src/standalone install-deps package
|
||||||
|
- uses: skx/github-action-publish-binaries@44887b225ceca96efd8a912d39c09ad70312af31
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
args: 'waforth-*.tgz'
|
1
src/standalone/.gitignore
vendored
1
src/standalone/.gitignore
vendored
|
@ -2,3 +2,4 @@
|
||||||
/waforth_core.h
|
/waforth_core.h
|
||||||
/wasm-micro-runtime
|
/wasm-micro-runtime
|
||||||
/wasmtime-*
|
/wasmtime-*
|
||||||
|
/*.tgz
|
|
@ -3,20 +3,24 @@ UNAME_P=$(shell uname -p)
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
WASMTIME_DIR=wasmtime-v0.37.0-x86_64-macos-c-api
|
WASMTIME_DIR=wasmtime-v0.37.0-x86_64-macos-c-api
|
||||||
WASMTIME_RELEASE_URL=https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-macos-c-api.tar.xz
|
WASMTIME_RELEASE_URL=https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-macos-c-api.tar.xz
|
||||||
|
PACKAGE_SUFFIX=x86_64-macos
|
||||||
else
|
else
|
||||||
WASMTIME_DIR=wasmtime-v0.37.0-x86_64-linux-c-api
|
WASMTIME_DIR=wasmtime-v0.37.0-x86_64-linux-c-api
|
||||||
WASMTIME_RELEASE_URL=https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-linux-c-api.tar.xz
|
WASMTIME_RELEASE_URL=https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-linux-c-api.tar.xz
|
||||||
LIBS=-lpthread -lm -ldl
|
LIBS=-lpthread -lm -ldl
|
||||||
|
PACKAGE_SUFFIX=x86_64-linux
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS=-I$(WASMTIME_DIR)/include
|
CFLAGS=-I$(WASMTIME_DIR)/include
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
LIBS:=$(WASMTIME_DIR)/lib/libwasmtime.a $(LIBS)
|
LIBS:=$(WASMTIME_DIR)/lib/libwasmtime.a $(LIBS)
|
||||||
|
|
||||||
|
VERSION?=$(shell cat ../../package.json | grep '"version"' | sed -e 's/.*:.*"\(.*\)".*/\1/')
|
||||||
BIN2H=../../scripts/bin2h
|
BIN2H=../../scripts/bin2h
|
||||||
WAT2WASM=wat2wasm
|
WAT2WASM=wat2wasm
|
||||||
WAT2WASM_FLAGS=--debug-names
|
WAT2WASM_FLAGS=--debug-names
|
||||||
|
|
||||||
|
CFLAGS:=-DVERSION='"$(VERSION)"' $(CFLAGS)
|
||||||
OBJECTS=main.o
|
OBJECTS=main.o
|
||||||
|
|
||||||
all: waforth
|
all: waforth
|
||||||
|
@ -37,7 +41,10 @@ install-deps:
|
||||||
-rm -rf wasmtime-*
|
-rm -rf wasmtime-*
|
||||||
curl -L -s $(WASMTIME_RELEASE_URL) | tar xJv
|
curl -L -s $(WASMTIME_RELEASE_URL) | tar xJv
|
||||||
|
|
||||||
|
.PHONY: package
|
||||||
|
package: waforth
|
||||||
|
tar czf waforth-v$(VERSION)-$(PACKAGE_SUFFIX).tgz waforth
|
||||||
|
|
||||||
.PHONY: clean
|
.PHONY: clean
|
||||||
clean:
|
clean:
|
||||||
-rm -f waforth_core.wasm waforth_core.h $(OBJECTS) waforth
|
-rm -f waforth_core.wasm waforth_core.h $(OBJECTS) waforth *.tgz
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
#include "waforth_core.h"
|
#include "waforth_core.h"
|
||||||
#include "wasm.h"
|
#include "wasm.h"
|
||||||
|
|
||||||
|
#ifndef VERSION
|
||||||
|
#define VERSION "dev"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CORE_TABLE_EXPORT_INDEX 0
|
#define CORE_TABLE_EXPORT_INDEX 0
|
||||||
#define CORE_MEMORY_EXPORT_INDEX 1
|
#define CORE_MEMORY_EXPORT_INDEX 1
|
||||||
#define CORE_INTERPRET_EXPORT_INDEX 6
|
#define CORE_INTERPRET_EXPORT_INDEX 6
|
||||||
|
@ -164,7 +168,7 @@ int main(int argc, char *argv_main[]) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("WAForth\n");
|
printf("WAForth (" VERSION ")\n");
|
||||||
wasm_val_t as[1] = {WASM_I32_VAL(0)};
|
wasm_val_t as[1] = {WASM_I32_VAL(0)};
|
||||||
wasm_val_vec_t args = WASM_ARRAY_VEC(as);
|
wasm_val_vec_t args = WASM_ARRAY_VEC(as);
|
||||||
wasm_val_t vs[] = {WASM_INIT_VAL};
|
wasm_val_t vs[] = {WASM_INIT_VAL};
|
||||||
|
|
Loading…
Reference in a new issue