mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
Merge pull request #2983 from rtfeldman/wasi-libc-sys
Build WASI libc using Zig, instead of using a checked-in binary
This commit is contained in:
commit
f3493850bb
12 changed files with 131 additions and 15 deletions
|
@ -31,6 +31,7 @@ libloading = "0.7.1"
|
|||
tempfile = "3.2.0"
|
||||
inkwell = { path = "../../vendor/inkwell", optional = true }
|
||||
target-lexicon = "0.12.3"
|
||||
wasi_libc_sys = { path = "../../wasi-libc-sys" }
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
serde_json = "1.0.69"
|
||||
|
|
|
@ -72,16 +72,12 @@ fn find_zig_str_path() -> PathBuf {
|
|||
}
|
||||
|
||||
fn find_wasi_libc_path() -> PathBuf {
|
||||
let wasi_libc_path = PathBuf::from("compiler/builtins/bitcode/wasi-libc.a");
|
||||
use wasi_libc_sys::WASI_LIBC_PATH;
|
||||
|
||||
if std::path::Path::exists(&wasi_libc_path) {
|
||||
return wasi_libc_path;
|
||||
}
|
||||
|
||||
// when running the tests, we start in the /cli directory
|
||||
let wasi_libc_path = PathBuf::from("../compiler/builtins/bitcode/wasi-libc.a");
|
||||
if std::path::Path::exists(&wasi_libc_path) {
|
||||
return wasi_libc_path;
|
||||
// Environment variable defined in wasi-libc-sys/build.rs
|
||||
let wasi_libc_pathbuf = PathBuf::from(WASI_LIBC_PATH);
|
||||
if std::path::Path::exists(&wasi_libc_pathbuf) {
|
||||
return wasi_libc_pathbuf;
|
||||
}
|
||||
|
||||
panic!("cannot find `wasi-libc.a`")
|
||||
|
|
Binary file not shown.
|
@ -36,12 +36,12 @@ fn promote_expr_to_module(src: &str) -> String {
|
|||
pub fn compile_and_load<'a, T: Wasm32Result>(
|
||||
arena: &'a bumpalo::Bump,
|
||||
src: &str,
|
||||
_test_wrapper_type_info: PhantomData<T>,
|
||||
test_wrapper_type_info: PhantomData<T>,
|
||||
) -> wasmer::Instance {
|
||||
let platform_bytes = load_platform_and_builtins();
|
||||
|
||||
let compiled_bytes =
|
||||
compile_roc_to_wasm_bytes(arena, &platform_bytes, src, _test_wrapper_type_info);
|
||||
compile_roc_to_wasm_bytes(arena, &platform_bytes, src, test_wrapper_type_info);
|
||||
|
||||
if DEBUG_LOG_SETTINGS.keep_test_binary {
|
||||
let build_dir_hash = src_hash(src);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue