diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9ec65ab1b..1f6d29260 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -62,8 +62,9 @@ jobs: - name: Prepare for publish run: | + sh install-offline.sh mkdir rust-bindings/cpp - cp -r src lib tests uint128_t python-bindings c-bindings CMakeLists.txt rust-bindings/cpp + cp -r src lib tests uint128_t python-bindings c-bindings CMakeLists.txt thirdparty rust-bindings/cpp - name: Publish to crates.io (dry run) # We use `--allow-dirty` because the `cpp` folder is copied into the working directory. diff --git a/rust-bindings/build.rs b/rust-bindings/build.rs index 2b7b11cd2..1a355968c 100644 --- a/rust-bindings/build.rs +++ b/rust-bindings/build.rs @@ -18,12 +18,18 @@ fn main() { .to_path_buf(); } + let build_offline = cpp_dir.join("thirdparty").try_exists().unwrap(); + let dst = Config::new(cpp_dir.as_path()) .build_target("chiapos_static") .define("BUILD_STATIC_CHIAPOS_LIBRARY", "ON") .define( "BUILD_OFFLINE", - env::var("BUILD_OFFLINE").unwrap_or_else(|_| "OFF".to_string()), + if build_offline { + "ON".to_string() + } else { + "OFF".to_string() + }, ) .build();