diff --git a/Makefile.am b/Makefile.am index 27ee33e1e9b332a79dba0acbd12f18a030469ae5..137fb1edcb3d5004f2a035ee5f9f6041c1e9c12b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,8 +26,7 @@ TESTING_TOR_BINARY=$(top_builddir)/src/or/tor$(EXEEXT) endif if USE_RUST -rust_ldadd=$(top_builddir)/src/rust/target/release/@TOR_RUST_UTIL_STATIC_NAME@ -rust_ldadd+=$(top_builddir)/src/rust/target/release/@TOR_RUST_PROTOVER_STATIC_NAME@ +rust_ldadd=$(top_builddir)/src/rust/target/release/@TOR_RUST_STATIC_NAME@ else rust_ldadd= endif diff --git a/configure.ac b/configure.ac index e20a6b99043661b3836308afbb286eb077423b3c..c0d454ae459a8e18247348bbe36c1c93a68ae042 100644 --- a/configure.ac +++ b/configure.ac @@ -439,16 +439,12 @@ if test "x$enable_rust" = "xyes"; then dnl For now both MSVC and MinGW rust libraries will output static libs with dnl the MSVC naming convention. if test "$bwin32" = "true"; then - TOR_RUST_UTIL_STATIC_NAME=tor_util.lib - TOR_RUST_PROTOVER_STATIC_NAME=libprotover.lib + TOR_RUST_STATIC_NAME=tor_rust.lib else - TOR_RUST_UTIL_STATIC_NAME=libtor_util.a - TOR_RUST_PROTOVER_STATIC_NAME=libprotover.a + TOR_RUST_STATIC_NAME=libtor_rust.a fi - AC_SUBST(TOR_RUST_UTIL_STATIC_NAME) - AC_SUBST(TOR_RUST_PROTOVER_STATIC_NAME) - AC_SUBST(TOR_RUST_C_STRING_STATIC_NAME) + AC_SUBST(TOR_RUST_STATIC_NAME) AC_SUBST(CARGO_ONLINE) AC_SUBST(RUST_DL) diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock index 56cb9d76baa0c114ff9b63e3abbcb262c1d5f9f2..a5686979fa065cd011b6eef98a347ce31a338099 100644 --- a/src/rust/Cargo.lock +++ b/src/rust/Cargo.lock @@ -42,5 +42,13 @@ dependencies = [ "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tor_rust" +version = "0.1.0" +dependencies = [ + "protover 0.0.1", + "tor_util 0.0.1", +] + [metadata] "checksum libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)" = "babb8281da88cba992fa1f4ddec7d63ed96280a1a53ec9b919fd37b53d71e502" diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml index 5d4292bbd346a098a106bae83f61bf8b4d7fdc6b..953c9b96b7f5f526c5bd5a81b0b0275522f92ecb 100644 --- a/src/rust/Cargo.toml +++ b/src/rust/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["tor_util", "protover", "smartlist", "external", "tor_allocate"] +members = ["tor_util", "protover", "smartlist", "external", "tor_allocate", "tor_rust"] [profile.release] debug = true diff --git a/src/rust/include.am b/src/rust/include.am index 716d46f4cc1d9147e8e4af82c8f2d647a7748234..025d921b31f0291a72e4927885432351f3d8ba90 100644 --- a/src/rust/include.am +++ b/src/rust/include.am @@ -1,5 +1,4 @@ -include src/rust/tor_util/include.am -include src/rust/protover/include.am +include src/rust/tor_rust/include.am EXTRA_DIST +=\ src/rust/Cargo.toml \ diff --git a/src/rust/tor_rust/Cargo.toml b/src/rust/tor_rust/Cargo.toml new file mode 100644 index 0000000000000000000000000000000000000000..86fad3ee76ce816394e7a3c8c6f1f77877012a33 --- /dev/null +++ b/src/rust/tor_rust/Cargo.toml @@ -0,0 +1,16 @@ +[package] +authors = ["The Tor Project"] +name = "tor_rust" +version = "0.1.0" + +[lib] +name = "tor_rust" +path = "lib.rs" +crate_type = ["rlib", "staticlib"] + +[dependencies.tor_util] +path = "../tor_util" + +[dependencies.protover] +path = "../protover" + diff --git a/src/rust/tor_rust/include.am b/src/rust/tor_rust/include.am new file mode 100644 index 0000000000000000000000000000000000000000..7d30592b07e5ee561ac228fcaf875bf84713b0bc --- /dev/null +++ b/src/rust/tor_rust/include.am @@ -0,0 +1,12 @@ +EXTRA_DIST +=\ + src/rust/tor_rust/Cargo.toml \ + src/rust/tor_rust/lib.rs \ + src/rust/tor_rust/tor_rust.rs + +src/rust/target/release/@TOR_RUST_STATIC_NAME@: FORCE + ( cd "$(abs_top_srcdir)/src/rust/tor_rust" ; \ + CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \ + CARGO_HOME="$(abs_top_builddir)/src/rust" \ + $(CARGO) build --release --quiet $(CARGO_ONLINE) ) + +FORCE: diff --git a/src/rust/tor_rust/lib.rs b/src/rust/tor_rust/lib.rs new file mode 100644 index 0000000000000000000000000000000000000000..c1585c0480296f30435cb14207bee672f473d899 --- /dev/null +++ b/src/rust/tor_rust/lib.rs @@ -0,0 +1,5 @@ +extern crate tor_util; +extern crate protover; + +pub use tor_util::*; +pub use protover::*; diff --git a/src/rust/tor_util/include.am b/src/rust/tor_util/include.am deleted file mode 100644 index ec3898577baec590196c608227ba16b40926f63f..0000000000000000000000000000000000000000 --- a/src/rust/tor_util/include.am +++ /dev/null @@ -1,13 +0,0 @@ -EXTRA_DIST +=\ - src/rust/tor_util/Cargo.toml \ - src/rust/tor_util/lib.rs \ - src/rust/tor_util/ffi.rs \ - src/rust/tor_util/rust_string.rs - -src/rust/target/release/@TOR_RUST_UTIL_STATIC_NAME@: FORCE - ( cd "$(abs_top_srcdir)/src/rust/tor_util" ; \ - CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \ - CARGO_HOME="$(abs_top_builddir)/src/rust" \ - $(CARGO) build --release --quiet $(CARGO_ONLINE) ) - -FORCE: