diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..f2a6a67 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://raw.githubusercontent.com/devcontainers/spec/main/schemas/devContainer.base.schema.json", + "name": "wasinodot", + "image": "mcr.microsoft.com/devcontainers/base:bookworm", + "remoteEnv": { + "PATH": "${containerEnv:PATH}:/usr/local/lib/wasi-sdk-22.0/bin", + "WASI_SDK_PATH": "/usr/local/lib/wasi-sdk-22.0" + }, + "features": { + "devwasm.azurecr.io/dev-wasm/dev-wasm-feature/wasmtime-wasi:0.0.15": { + "version": "22", + "wasmtime_version": "v22.0.0", + "wit_version": "0.26.0", + "wasm_tools_version": "1.0.60" + }, + "ghcr.io/devcontainers/features/rust:1": {}, + "devwasm.azurecr.io/dev-wasm/dev-wasm-feature/rust-wasi:0.0.2": {} + }, + "onCreateCommand": { + "install-cargo-wasi": [ + "cargo", + "install", + "cargo-wasi" + ] + } +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 490de54..b5288db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,3 +1,5 @@ +# TODO use Dev Container + name: Ci on: @@ -9,13 +11,13 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install dependencies run: | sudo apt update sudo apt install -y --no-install-recommends curl ca-certificates patch make - wasi_sdk_url='https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-14/wasi-sdk-14.0-linux.tar.gz' + wasi_sdk_url='https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-22/wasi-sdk-22.0-linux.tar.gz' sudo curl -L $wasi_sdk_url|tar zxf - -C /opt sudo mv /opt/wasi-sdk-14.0 /opt/wasi-sdk echo "/opt/wasi-sdk/bin" >> $GITHUB_PATH @@ -28,7 +30,7 @@ jobs: profile: minimal - name: Cargo cache - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -51,7 +53,7 @@ jobs: - name: Upload config.log if: failure() - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: config.log path: | @@ -61,7 +63,7 @@ jobs: ls target/wasm32-wasi/release/wasinodot.wasm - name: Upload builds - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v4 with: name: build path: | @@ -73,7 +75,7 @@ jobs: - build runs-on: ubuntu-latest steps: - - uses: actions/download-artifact@v2 + - uses: actions/download-artifact@v4 with: name: build diff --git a/.gitignore b/.gitignore index c31ea0b..6aab060 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /target Cargo.lock -graphviz-2.49.0/ +graphviz-*/ graphviz-build/ diff --git a/build.rs b/build.rs index 71f55b5..eb430a7 100644 --- a/build.rs +++ b/build.rs @@ -6,7 +6,7 @@ use std::process::{Command, Stdio}; fn get_graphviz_dir() -> PathBuf { let dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - let graphviz_dir = Path::new(&dir).join("graphviz-2.49.0"); + let graphviz_dir = Path::new(&dir).join("graphviz-11.0.0"); if fs::metadata(&graphviz_dir) .map(|m| m.is_dir()) .unwrap_or_default() @@ -14,7 +14,7 @@ fn get_graphviz_dir() -> PathBuf { return graphviz_dir; } - let graphviz_url = "https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/2.49.0/graphviz-2.49.0.tar.xz"; + let graphviz_url = "https://gitlab.com/api/v4/projects/4207231/packages/generic/graphviz-releases/11.0.0/graphviz-11.0.0.tar.xz"; let mut curl = Command::new("curl") .args(["-LsSf", graphviz_url]) @@ -35,10 +35,11 @@ fn get_graphviz_dir() -> PathBuf { panic!("failed to run tar."); } - let ok = Command::new("patch") - .arg("-u") + // missing for read...(???) + let ok = Command::new("sed") + .arg("-i") + .arg("s;^;#include \\n;") .arg(graphviz_dir.join("plugin/core/gvloadimage_core.c")) - .arg(Path::new(&dir).join("patch/gvloadimage_core.patch")) .status() .expect("unable to run patch."); if !ok.success() { @@ -77,16 +78,13 @@ fn configure(graphviz_dir: &Path) -> PathBuf { "--without-pangocairo", "--without-webp", ]) - .arg(format!( - "--with-extraincludedir={}", - Path::new(&dir).join("graphviz-stub").to_string_lossy() - )) .env("CC", format!("{}/bin/clang", wasi_sdk_path)) .env("LD", format!("{}/bin/wasm-ld", wasi_sdk_path)) .env("CXX", format!("{}/bin/clang++", wasi_sdk_path)) .env("NM", format!("{}/bin/llvm-nm", wasi_sdk_path)) .env("AR", format!("{}/bin/llvm-ar", wasi_sdk_path)) .env("RANLIB", format!("{}/bin/llvm-ranlib", wasi_sdk_path)) + .env("CFLAGS", "-mllvm -wasm-enable-sjlj") .env( "CPPFLAGS", "-D_WASI_EMULATED_SIGNAL -D_WASI_EMULATED_PROCESS_CLOCKS", diff --git a/graphviz-stub/pwd.h b/graphviz-stub/pwd.h deleted file mode 100644 index e69de29..0000000 diff --git a/graphviz-stub/setjmp.h b/graphviz-stub/setjmp.h deleted file mode 100644 index bbf7c1e..0000000 --- a/graphviz-stub/setjmp.h +++ /dev/null @@ -1,9 +0,0 @@ -#ifndef _SETJMP_H -#define _SETJMP_H 1 - -typedef struct __jmp_buf_tag { int dummy } jmp_buf; - -int setjmp (jmp_buf __env); -void longjmp (jmp_buf __env, int __val); - -#endif diff --git a/graphviz-stub/sys/wait.h b/graphviz-stub/sys/wait.h deleted file mode 100644 index e69de29..0000000 diff --git a/patch/gvloadimage_core.patch b/patch/gvloadimage_core.patch deleted file mode 100644 index 929719d..0000000 --- a/patch/gvloadimage_core.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- graphviz-2.49.0/plugin/core/gvloadimage_core.c.bak 2021-09-07 12:40:50.450694232 +0900 -+++ graphviz-2.49.0/plugin/core/gvloadimage_core.c 2021-09-07 12:41:01.027877866 +0900 -@@ -186,7 +186,7 @@ static void core_loadimage_ps(GVJ_t * jo - us->data = NULL; - #else - us->data = malloc(statbuf.st_size); -- read(fd, us->data, statbuf.st_size); -+ read(fd, us->data, (size_t) statbuf.st_size); - #endif - us->must_inline = TRUE; - break;