mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 05:03:43 +01:00
refactor build infrastructure for single rust binary
This commit is contained in:
parent
be583a34a3
commit
0c4d535972
@ -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
|
||||
|
10
configure.ac
10
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)
|
||||
|
||||
|
8
src/rust/Cargo.lock
generated
8
src/rust/Cargo.lock
generated
@ -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"
|
||||
|
@ -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
|
||||
|
@ -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 \
|
||||
|
16
src/rust/tor_rust/Cargo.toml
Normal file
16
src/rust/tor_rust/Cargo.toml
Normal file
@ -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"
|
||||
|
12
src/rust/tor_rust/include.am
Normal file
12
src/rust/tor_rust/include.am
Normal file
@ -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:
|
5
src/rust/tor_rust/lib.rs
Normal file
5
src/rust/tor_rust/lib.rs
Normal file
@ -0,0 +1,5 @@
|
||||
extern crate tor_util;
|
||||
extern crate protover;
|
||||
|
||||
pub use tor_util::*;
|
||||
pub use protover::*;
|
@ -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:
|
Loading…
Reference in New Issue
Block a user