Browse Source

configure.ac: add --with-rust-std parameter

The parameter is forwarded to Cargo to handle re-compiling the standard
library. This is required when targetting tier 3 targets like
aarch64-apple-tvos, where the standard library is not shipped with the
compiler binaries.

Initial design used --with-cargo-build-std which only triggered rebuild
of the std in cargo, but this new design for the option allows more
specification about what needs to be built, can be extended to support
--extern crate later when the std makes it easy to do so, and I felt it
was clearer to read the option, though finding it is a bit less easy.

Example:

    --with-rust-std=build-std=std,panic_abort
pull/169/head
Alexandre Janniaux 2 years ago
committed by Felix Paul Kühne
parent
commit
12c9c09acf
  1. 10
      configure.ac
  2. 2
      modules/Makefile.am

10
configure.ac

@ -1886,6 +1886,16 @@ AM_CONDITIONAL([ENABLE_SOUT], [test "${enable_sout}" != "no"])
dnl
dnl Rust Modules
dnl
AC_ARG_WITH([rust-std],
AS_HELP_STRING([--with-rust-std[=ARGS]],
[Specify how to find Rust standard library. If ARGS is build-std=STDARGS, it forwards parameters to Cargo as -Z build-std=STDARGS. (default auto)]))
AS_CASE(["${with_rust_std}"],
[build-std=*], [cargo_build_std_args=-Z"${with_rust_std}"],
[auto], [cargo_build_std_args=""],
[""], [cargo_build_std_args=""],
[AC_MSG_ERROR([Unknown option ${with_rust_std} for --with-rust-std=])])
AC_SUBST([CARGO_BUILD_STD], [${cargo_build_std_args}])
AC_ARG_ENABLE([rust],
AS_HELP_STRING([--enable-rust],
[enable building Rust modules (default disabled)]))

2
modules/Makefile.am

@ -32,7 +32,7 @@ LIBTOOL_CARGO = \
RUSTFLAGS="${RUSTFLAGS}" \
CARGO_TARGET_DIR="target-rust" \
LIBTOOL="$(LIBTOOL)" \
$(LIBTOOL_CARGO_EXE) $(CARGO) rustc $(CARGO_BUILD_ARGS)
$(LIBTOOL_CARGO_EXE) $(CARGO) $(CARGO_BUILD_STD) rustc $(CARGO_BUILD_ARGS)
CARGO_PLUGINS_INV = ${LTLIBRARIES:%rs_plugin.la=%rs_plugin}
CARGO_PLUGINS_CUT = ${CARGO_PLUGINS_INV:%.la=}

Loading…
Cancel
Save