From 2f3915240f662e2299bb3ecdfa2231995cf3d121 Mon Sep 17 00:00:00 2001 From: nikita Date: Thu, 26 Feb 2026 13:58:40 +0300 Subject: [PATCH 1/2] up sys version --- Cargo.toml | 2 +- README.md | 2 +- build.rs | 15 ++++++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fed293c..3d2cdd6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tonlib-sys" -version = "2025.12.0" +version = "2026.2.1" edition = "2021" description = "Rust bindings for tonlibjson library" license = "MIT" diff --git a/README.md b/README.md index 474c928..6e97319 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ To use this library in your Rust application, add the following to your Cargo.to ```toml [dependencies] -tonlib-sys = "2025.12" +tonlib-sys = "2026.2.1" ``` Then, in your Rust code, you can import the library with: diff --git a/build.rs b/build.rs index 4f2bf5e..10474c3 100644 --- a/build.rs +++ b/build.rs @@ -6,7 +6,7 @@ use std::thread::available_parallelism; use std::{env, fs}; const TON_MONOREPO_URL: &str = "https://github.com/ton-blockchain/ton"; -const TON_MONOREPO_REVISION: &str = "v2025.12"; +const TON_MONOREPO_REVISION: &str = "v2026.02-1"; const TON_MONOREPO_DIR: &str = "./ton"; #[cfg(feature = "with_debug_info")] @@ -117,12 +117,21 @@ fn run_build(target: &str) -> String { if cfg!(target_os = "linux") { cxx_flags = "-w -std=c++17 --include=algorithm"; } + let use_emscripten = env::var("CARGO_CFG_TARGET_ARCH") + .map(|arch| arch == "wasm32") + .unwrap_or(false); let mut cfg = Config::new(TON_MONOREPO_DIR); let dst = cfg .define("BUILD_SHARED_LIBS", "false") .define("CMAKE_POSITION_INDEPENDENT_CODE", "ON") - .define("USE_EMSCRIPTEN", "true") + .define( + "USE_EMSCRIPTEN", + if use_emscripten { "true" } else { "false" }, + ) + .define("TONLIBJSON_STATIC", "ON") + .define("EMULATOR_STATIC", "ON") + .define("TON_USE_ABSEIL", "OFF") // .define("PORTABLE", "true") // statically link system libraries such as libstdc++ .define("APPLE", APPLE) .define("CMAKE_BUILD_TYPE", CMAKE_BUILD_TYPE) @@ -209,7 +218,7 @@ fn checkout_repo() { // replace ' if (NOT USE_EMSCRIPTEN)' by ' if (TRUE)' in ton/crypto/CMakeLists.txt fn patch_cmake() { let cmake_path = Path::new(TON_MONOREPO_DIR).join("crypto/CMakeLists.txt"); - let target_line = 427; + let target_line = 453; let new_line = " if (TRUE)"; let file = File::open(&cmake_path).unwrap(); let reader = BufReader::new(file); From d3caa71a4286adfa67734f8227e9442574c51cf7 Mon Sep 17 00:00:00 2001 From: nikita Date: Thu, 26 Feb 2026 15:05:56 +0300 Subject: [PATCH 2/2] fix linux openssl --- build.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 10474c3..75e1b14 100644 --- a/build.rs +++ b/build.rs @@ -96,8 +96,16 @@ fn build_monorepo() { // third-party println!("cargo:rustc-link-search=native={build_dir}/build/third-party/blst"); println!("cargo:rustc-link-lib=static=blst"); + // openssl + if cfg!(target_os = "linux") { + // TON builds its own OpenSSL. Use that on Linux to avoid symbol/version mismatches + // with runner-provided system libcrypto. + println!("cargo:rustc-link-search=native={build_dir}/build/third-party/openssl/lib"); + println!("cargo:rustc-link-lib=static=crypto"); + } else { + println!("cargo:rustc-link-lib=crypto"); + } // dynamic libs - println!("cargo:rustc-link-lib=crypto"); // openssl println!("cargo:rustc-link-lib=dylib=z"); // zlib println!("cargo:rustc-link-lib=dylib=sodium"); println!("cargo:rustc-link-lib=dylib=secp256k1");