Commit 37ca748b authored by Alberto Lerda's avatar Alberto Lerda Committed by Jaromil
Browse files

feat: publish rust library

compilation done outside cargo package
parent aa19a829
[package]
name = "zenroom"
version = "0.3.0"
license = "AGPL-3.0-only"
description = "Zenroom bindings to execute Zencode inside Rust"
homepage = "https://zenroom.org"
repository = "https://github.com/dyne/zenroom"
documentation = "https://dev.zenroom.org"
authors = ["Denis Roio <J@dyne.org>"]
version = "0.3.2"
authors = ["Danilo Spinella <oss@danyspin97.org>", "Denis Roio <J@dyne.org>", "Alberto Lerda <alberto@dyne.org>"]
edition = "2018"
documentation = "https://dev.zenroom.org/#/pages/zencode-cookbook-intro"
license = "AGPL-3.0-only"
description = "zenroom is a small, portable and secure language interpreter of a domain specific language called zencode, able to execute cryptographic operations and smart contracts in a multiplatform environment."
include = ["src/", "zenroom.h", "clib/*.a", "build.rs", "zenroom.h", "wrapper.h"]
build = "build.rs"
[lib]
name = "zenroom"
path = "src/lib.rs"
crate-type = ["lib"]
[build-dependencies]
bindgen = "0.59.2"
......
......@@ -2,19 +2,8 @@ extern crate bindgen;
use std::env;
use std::path::PathBuf;
use std::process::Command;
fn main() {
// let mut cmd = Command::new("make");
// cmd.args(&["-C", "../..", "meson"]);
// let status = cmd.status().expect("failed to run meson");
// let status = cmd.status().exit_ok();
// TODO: use status.exit_ok() when it gets to stable
// assert!(status.success());
let build_path = PathBuf::from(env::current_dir().unwrap());
let build_path = build_path.join("..").join("..").join("meson");
let build_path = build_path.to_str().unwrap();
println!("cargo:rustc-link-lib=static=zenroom");
println!("cargo:rustc-link-lib=static=lua");
println!("cargo:rustc-link-lib=static=qpz");
......@@ -24,15 +13,13 @@ fn main() {
println!("cargo:rustc-link-lib=static=amcl_curve_SECP256K1");
println!("cargo:rustc-link-lib=static=amcl_pairing_BLS381");
println!("cargo:rustc-link-lib=static=zstd");
println!("cargo:rustc-link-search={}", build_path);
println!("cargo:rustc-link-search={}/milagro-crypto-c/lib",build_path);
println!("cargo:rustc-link-search=native=clib");
println!("cargo:rerun-if-changed=wrapper.h");
let bindings = bindgen::Builder::default()
.header("wrapper.h")
.clang_arg("-I../../src")
.clang_arg(format!("-I{}", build_path))
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.generate()
.expect("Unable to generate bindings");
......
......@@ -119,3 +119,15 @@ linux-go:
$(MAKE) meson
cp meson/libzenroom.so bindings/golang/zenroom/lib
cd bindings/golang/zenroom && $(MAKE) test
linux-rust: CMD ?= build
linux-rust:
$(MAKE) meson
#[ -d bindings/rust/clib ] || mkdir bindings/rust/clib
cp meson/libzenroom.a bindings/rust/clib
cp lib/milagro-crypto-c/build/lib/* bindings/rust/clib
cp meson/liblua.a bindings/rust/clib
cp meson/libqpz.a bindings/rust/clib
cp meson/libzstd.a bindings/rust/clib
cp src/zenroom.h bindings/rust
cd bindings/rust && cargo ${CMD}
......@@ -6,5 +6,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
zenroom = { path = "../../bindings/rust" }
zenroom = "0.3.2"
encoding = "0.2"
extern crate zenroom;
use zenroom;
use std::time::Instant;
use std::env;
use std::path::PathBuf;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment