From d84761457958316952dd9379c59ef2bb3f7bdbfb Mon Sep 17 00:00:00 2001 From: Trevor Arjeski Date: Wed, 10 Aug 2022 10:55:09 +0300 Subject: [PATCH 1/3] Do not include iana-time-zone for sgx In previous version chrono with default features built successfully on the sgx platform. Since `iana-time-zone` is not implemented for this platform, do not include it when `target_env = "sgx"`. --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 94adca3e72..b5b9820054 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,7 +45,7 @@ rkyv = {version = "0.7", optional = true} wasm-bindgen = { version = "0.2" } js-sys = { version = "0.3" } # contains FFI bindings for the JS Date API -[target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "solaris")))'.dependencies] +[target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "solaris", target_env = "sgx")))'.dependencies] iana-time-zone = { version = "0.1.41", optional = true } [target.'cfg(windows)'.dependencies] From 24715f024626194a8dddc8b518c0a875b0dc66a8 Mon Sep 17 00:00:00 2001 From: Trevor Arjeski Date: Wed, 10 Aug 2022 14:58:05 +0300 Subject: [PATCH 2/3] Add sgx build to CI --- .github/workflows/test.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c66f3a607..ed28d8a7c6 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -86,6 +86,28 @@ jobs: run: cargo build --target thumbv6m-none-eabi --color=always working-directory: ./ci/core-test + intel_sgx: + strategy: + matrix: + os: [ubuntu-latest] + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v2 + + - name: Install rust with fortanix sgx toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + target: x86_64-fortanix-unknown-sgx + override: true + - uses: Swatinem/rust-cache@v1 + + - name: Build sgx lib + run: cargo build --target x86_64-fortanix-unknown-sgx --color=always + working-directory: ./ci/core-test + wasm: strategy: matrix: From 6f9af6fc1a110ca508a9a6a11cbd687f3119078b Mon Sep 17 00:00:00 2001 From: Eric Sheppard Date: Wed, 10 Aug 2022 22:51:43 +1000 Subject: [PATCH 3/3] set fallback feature in iana-time-zone depedency --- Cargo.toml | 3 +-- src/offset/local/unix.rs | 6 ------ 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index b5b9820054..cc6d93c376 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,13 +40,12 @@ serde = { version = "1.0.99", default-features = false, optional = true } pure-rust-locales = { version = "0.5.2", optional = true } criterion = { version = "0.3", optional = true } rkyv = {version = "0.7", optional = true} +iana-time-zone = { version = "0.1.41", optional = true, features = ["fallback"] } [target.'cfg(all(target_arch = "wasm32", not(any(target_os = "emscripten", target_os = "wasi"))))'.dependencies] wasm-bindgen = { version = "0.2" } js-sys = { version = "0.3" } # contains FFI bindings for the JS Date API -[target.'cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "solaris", target_env = "sgx")))'.dependencies] -iana-time-zone = { version = "0.1.41", optional = true } [target.'cfg(windows)'.dependencies] winapi = { version = "0.3.0", features = ["std", "minwinbase", "minwindef", "timezoneapi"], optional = true } diff --git a/src/offset/local/unix.rs b/src/offset/local/unix.rs index ab91dfde38..46845b69d4 100644 --- a/src/offset/local/unix.rs +++ b/src/offset/local/unix.rs @@ -103,12 +103,6 @@ const TZDB_LOCATION: &str = " /system/usr/share/zoneinfo"; #[cfg(not(target_os = "android"))] const TZDB_LOCATION: &str = "/usr/share/zoneinfo"; -#[cfg(any(target_os = "emscripten", target_os = "wasi", target_os = "solaris"))] -fn fallback_timezone() -> Option { - Some(TimeZone::utc()) -} - -#[cfg(not(any(target_os = "emscripten", target_os = "wasi", target_os = "solaris")))] fn fallback_timezone() -> Option { let tz_name = iana_time_zone::get_timezone().ok()?; let bytes = fs::read(format!("{}/{}", TZDB_LOCATION, tz_name)).ok()?;