Skip to content

Commit

Permalink
Update Graphviz v11, Use Dev Container.
Browse files Browse the repository at this point in the history
  • Loading branch information
yskszk63 committed Jun 23, 2024
1 parent 7cf3ada commit dd5273f
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 36 deletions.
26 changes: 26 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# TODO use Dev Container

name: Ci

on:
Expand All @@ -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
Expand All @@ -28,7 +30,7 @@ jobs:
profile: minimal

- name: Cargo cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
Expand All @@ -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: |
Expand All @@ -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: |
Expand All @@ -73,7 +75,7 @@ jobs:
- build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: build

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/target
Cargo.lock
graphviz-2.49.0/
graphviz-*/
graphviz-build/
16 changes: 7 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ 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()
{
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])
Expand All @@ -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 <unistd.h>\\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() {
Expand Down Expand Up @@ -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",
Expand Down
Empty file removed graphviz-stub/pwd.h
Empty file.
9 changes: 0 additions & 9 deletions graphviz-stub/setjmp.h

This file was deleted.

Empty file removed graphviz-stub/sys/wait.h
Empty file.
11 changes: 0 additions & 11 deletions patch/gvloadimage_core.patch

This file was deleted.

0 comments on commit dd5273f

Please sign in to comment.