Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
25 changes: 21 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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");
Expand All @@ -117,12 +125,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)
Expand Down Expand Up @@ -209,7 +226,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);
Expand Down