Skip to content

Commit 8bbba4c

Browse files
committed
build without wasmtime-platform.h
Signed-off-by: Jorge Prendes <jorge.prendes@gmail.com>
1 parent 5acda75 commit 8bbba4c

3 files changed

Lines changed: 4 additions & 31 deletions

File tree

src/wasm_runtime/.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
src/include/wasmtime-platform.h
1+
guest-toolchain
2+
target

src/wasm_runtime/build.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,10 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
use std::fs::File;
18-
use std::io::copy;
1917
use std::path::Path;
2018
use std::{env, fs, path};
2119

2220
use cargo_metadata::{MetadataCommand, Package};
23-
use reqwest::blocking::get;
2421

2522
fn main() {
2623
println!("cargo:rerun-if-changed=.");
@@ -45,32 +42,6 @@ fn main() {
4542
None => panic!("wasmtime dependency not found"),
4643
};
4744

48-
// download the wasmtime wasm_platform.h header file from GitHub releases and write it to the src/include directory
49-
50-
// ensure the include directory exists
51-
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
52-
let include_file = path::Path::new(&crate_dir)
53-
.join("src")
54-
.join("include")
55-
.join("wasmtime-platform.h");
56-
std::fs::create_dir_all(include_file.parent().unwrap()).unwrap();
57-
58-
// get the wasm_platform.h header file from github release with matching version e.g. https://github.com/bytecodealliance/wasmtime/releases/download/v29.0.1/wasmtime-platform.h
59-
let path = format!(
60-
"https://github.com/bytecodealliance/wasmtime/releases/download/v{}/wasmtime-platform.h",
61-
version_number
62-
);
63-
let response = get(&path).expect("Failed to download header file");
64-
65-
// write the include file to the src/include directory
66-
let out_file = include_file.to_str().unwrap();
67-
let mut dest = File::create(out_file).expect("Failed to create header file");
68-
copy(
69-
&mut response.bytes().expect("Failed to read response").as_ref(),
70-
&mut dest,
71-
)
72-
.expect("Failed to copy content");
73-
7445
// Write the version number to the metadata.rs file so that it is included in the binary
7546

7647
let out_dir = env::var_os("OUT_DIR").unwrap();

src/wasm_runtime/src/platform.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ limitations under the License.
1515
*/
1616

1717
#include <setjmp.h>
18-
#include "wasmtime-platform.h"
18+
#include <stdbool.h>
19+
#include <stdint.h>
1920

2021
typedef void (*wasmtime_setjmp_cb_t)(void *, void *);
2122

0 commit comments

Comments
 (0)