diff --git a/Cargo.lock b/Cargo.lock index 51ed00a5..b5f1b7c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -167,7 +167,6 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ - "jobserver", "libc", ] @@ -416,7 +415,7 @@ dependencies = [ "url", "webpki-roots", "winres", - "zstd", + "xz2", ] [[package]] @@ -730,15 +729,6 @@ version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.66" @@ -772,6 +762,17 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "lzma-sys" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + [[package]] name = "memchr" version = "2.7.1" @@ -1918,29 +1919,10 @@ dependencies = [ ] [[package]] -name = "zstd" -version = "0.13.0" +name = "xz2" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" +checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2" dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" -dependencies = [ - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.9+zstd.1.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" -dependencies = [ - "cc", - "pkg-config", + "lzma-sys", ] diff --git a/Cargo.toml b/Cargo.toml index f0790cc8..8f6dfe6d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,6 +49,7 @@ webpki-roots = "0.25" thousands = "0.2" tar = { version = "0.4", default-features = false } ruzstd = "0.5" +xz2 = { version = "0.1", features = ["static"] } [target.'cfg(target_arch = "x86_64")'.dependencies] raw-cpuid = "11" @@ -56,7 +57,7 @@ raw-cpuid = "11" [build-dependencies] glob = "0.3" tar = { version = "0.4", default-features = false } -zstd = { version = "0.13", default-features = false } +xz2 = "0.1" [target.'cfg(windows)'.build-dependencies] winres = "0.1" diff --git a/build.rs b/build.rs index 9f657d75..377ae5ea 100644 --- a/build.rs +++ b/build.rs @@ -3,19 +3,17 @@ use std::{env, fs, fs::File, io::Write, path::Path, process::Command}; use glob::glob; +use xz2::write::XzEncoder; const EVAL_FILE: &str = "nn-5af11540bbfe.nnue"; fn main() { hooks(); - let mut archive = tar::Builder::new( - zstd::Encoder::new( - File::create(Path::new(&env::var("OUT_DIR").unwrap()).join("assets.tar.zst")).unwrap(), - 19, - ) - .unwrap(), - ); + let mut archive = tar::Builder::new(XzEncoder::new( + File::create(Path::new(&env::var("OUT_DIR").unwrap()).join("assets.tar.xz")).unwrap(), + 6, + )); archive.mode(tar::HeaderMode::Deterministic); stockfish_build(&mut archive); stockfish_eval_file(EVAL_FILE, &mut archive); diff --git a/src/assets.rs b/src/assets.rs index 5c781ec8..7572e2c1 100644 --- a/src/assets.rs +++ b/src/assets.rs @@ -3,8 +3,9 @@ use std::{fmt, io, path::PathBuf}; use bitflags::bitflags; use serde::Serialize; use tempfile::TempDir; +use xz2::read::XzDecoder; -static ASSETS_TAR_ZST: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/assets.tar.zst")); +static ASSETS_TAR_XZ: &[u8] = include_bytes!(concat!(env!("OUT_DIR"), "/assets.tar.xz")); bitflags! { #[derive(Debug, Copy, Clone, Eq, PartialEq)] @@ -181,8 +182,7 @@ impl Assets { let mut stockfish = ByEngineFlavor::>::default(); let dir = tempfile::Builder::new().prefix("fishnet-").tempdir()?; - let mut archive = - tar::Archive::new(ruzstd::StreamingDecoder::new(ASSETS_TAR_ZST).expect("zst")); + let mut archive = tar::Archive::new(XzDecoder::new(ASSETS_TAR_XZ)); for entry in archive.entries()? { let mut entry = entry?; let path = entry.path()?;