diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6c6e0541..c351a839 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -63,7 +63,7 @@ jobs: command: make args: deploy env: - EMMAKEN_CFLAGS: "-s ERROR_ON_UNDEFINED_SYMBOLS=0" + EMCC_CLOSURE_ARGS: "target/duckdb.wasm" - uses: actions/upload-artifact@v2 with: name: deploy diff --git a/Cargo.lock b/Cargo.lock index e5089f90..868150dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -25,9 +25,6 @@ name = "cc" version = "1.0.67" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3c69b077ad434294d3ce9f1f6143a2a4b89a8a2d54ef813d85003a4fd1137fd" -dependencies = [ - "jobserver", -] [[package]] name = "cfg-if" @@ -95,15 +92,6 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" -[[package]] -name = "jobserver" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c71313ebb9439f74b00d9d2dcec36440beaf57a6aa0623068441dd7cd81a7f2" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.49" diff --git a/Cargo.toml b/Cargo.toml index f0d29588..ce85a6ca 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "bin" path = "src/bin.rs" [build-dependencies] -cc = {version= "*", features=['parallel']} +cc = {version= "*"} shellexpand = "*" which = "*" diff --git a/build.rs b/build.rs index 8ca6964e..10e7d5d2 100644 --- a/build.rs +++ b/build.rs @@ -1,62 +1,26 @@ #![feature(try_trait)] -use which::which; - -fn eat(command: &mut std::process::Command) { - let res = command.output().expect("Compile"); - - if !res.status.success() { - panic!("{}", String::from_utf8(res.stderr).expect("String")); - } -} - fn main() -> Result<(), Box> { - // TODO: reenable - // println!("cargo:rustc-link-lib=static-nobundle=stdc++"); - - let emar_path = - which("emar").expect("Couldn't find emar, is the emscripten environment activated?"); - - eat(cc::Build::new() - .get_compiler() - .to_command() - .arg("-fvisibility=default") - .arg("-fPIC") - .arg("-DDUCKDB_NO_THREADS=1") - .arg("-sWASM=1") - .arg("-DDUCKDB_BUILD_LIBRARY=1") - .arg("-sWARN_ON_UNDEFINED_SYMBOLS=1") - .arg("-sALLOW_MEMORY_GROWTH=1") - .arg("-sUSE_PTHREADS=0") - .arg("-sDISABLE_EXCEPTION_CATCHING=0") - .arg("-fexceptions") - .arg("-Wno-unused-parameter") - .arg("--no-entry") - .arg("-shared") - .arg("src/reexporter.cpp") - .arg("-Itarget") - .arg( - std::env::current_dir()? - .join("target/duckdb.wasm") - .to_str() - .expect("oops"), - ) - .arg("-o") - .arg("duckdb.o")); - - eat(std::process::Command::new(emar_path) - .arg("rcs") - .arg("target/libduckdb.a") - .arg("duckdb.o")); - - println!("cargo:rustc-link-lib=static-nobundle=duckdb"); - println!( - "cargo:rustc-link-search={}", - std::env::current_dir()? - .join("target") - .to_str() - .expect("aaaaa") - ); + cc::Build::new() + .flag("-fvisibility=default") + .flag("-fPIC") + .flag("-DDUCKDB_NO_THREADS=1") + .flag("-sWASM=1") + .flag("-DDUCKDB_BUILD_LIBRARY=1") + .flag("-sWARN_ON_UNDEFINED_SYMBOLS=1") + .flag("-sALLOW_MEMORY_GROWTH=1") + .flag("-sUSE_PTHREADS=0") + .flag("-sDISABLE_EXCEPTION_CATCHING=0") + .flag("-fexceptions") + .flag("-Wno-unused-parameter") + .flag("--no-entry") + .flag("-shared") + .file("src/reexporter.cpp") + .include("target") + // .flag("target/duckdb.wasm") + .cpp_link_stdlib("stdc++ target/duckdb.wasm") + .no_default_flags(true) + .compile("libduckdb.a"); Ok(()) }