diff options
author | Sebastian Hahn <sebastian@torproject.org> | 2017-05-02 04:21:42 +0200 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2017-05-19 08:47:11 -0400 |
commit | 70c067102b7d2576fa456d2872bb41abf559dff6 (patch) | |
tree | 6feae5f63d84b607fe1e5c196473239ce4919471 /configure.ac | |
parent | aeba64efad02e596dc3f15832d4bb96184c366a3 (diff) | |
download | tor-70c067102b7d2576fa456d2872bb41abf559dff6.tar.gz tor-70c067102b7d2576fa456d2872bb41abf559dff6.zip |
Allow Rust build using locally supplied crates or crates.io
This adds a couple of configure commands to control whether we're
requiring all dependencies to be available locally (default) or not
(--enable-cargo-online-mode). When building from a tarball, we require
the RUST_DEPENDENCIES variable to point to the local repository of
crates. This also adds src/ext/rust as a git submodule that contains
such a local repository for easy setup.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac index c5d3d44514..9f67fe5c94 100644 --- a/configure.ac +++ b/configure.ac @@ -254,6 +254,9 @@ if test "x$PYTHON" = "x"; then fi AM_CONDITIONAL(USEPYTHON, [test "x$PYTHON" != "x"]) +dnl List all external rust crates we depend on here. Include the version +rust_crates="libc-0.2.22" +AC_SUBST(rust_crates) if test "x$enable_rust" = "xyes"; then AC_ARG_VAR([RUSTC], [path to the rustc binary]) @@ -271,10 +274,35 @@ if test "x$enable_rust" = "xyes"; then AC_DEFINE([HAVE_RUST], 1, [have Rust]) if test "x$enable_cargo_online_mode" = "xyes"; then CARGO_ONLINE= + RUST_DL=# else CARGO_ONLINE=--frozen + RUST_DL= + + dnl When we're not allowed to touch the network, we need crate dependencies + dnl locally available. + AC_MSG_CHECKING([rust crate dependencies]) + AC_ARG_VAR([RUST_DEPENDENCIES], [path to directory with local crate mirror]) + if test "x$RUST_DEPENDENCIES" = "x"; then + RUST_DEPENDENCIES="$srcdir/src/ext/rust/" + NEED_MOD=1 + fi + if test ! -d "$RUST_DEPENDENCIES"; then + AC_MSG_ERROR([Rust dependency directory $RUST_DEPENDENCIES does not exist. Specify a dependency directory using the RUST_DEPENDENCIES variable or allow cargo to fetch crates using --enable-cargo-online-mode.]) + fi + for dep in $rust_crates; do + if test ! -d "$RUST_DEPENDENCIES"/"$dep"; then + AC_MSG_ERROR([Failure to find rust dependency $RUST_DEPENDENCIES/$dep. Specify a dependency directory using the RUST_DEPENDENCIES variable or allow cargo to fetch crates using --enable-cargo-online-mode.]) + fi + done + if test "x$NEED_MOD" = "x1"; then + dnl When looking for dependencies from cargo, pick right directory + RUST_DEPENDENCIES="../../src/ext/rust" + fi fi + AC_SUBST(CARGO_ONLINE) + AC_SUBST(RUST_DL) dnl Let's check the rustc version, too AC_MSG_CHECKING([rust version]) @@ -2065,6 +2093,7 @@ AC_CONFIG_FILES([ contrib/dist/tor.service src/config/torrc.sample src/config/torrc.minimal + src/rust/.cargo/config scripts/maint/checkOptionDocs.pl scripts/maint/updateVersions.pl ]) |