• David Michael's avatar
    Support cross-compiling with Rust · fd9541ad
    David Michael authored
    The primary change here is to add the --target=$(host) option to
    the cargo build command, so the Rust components are compiled for
    the target host system specified by the configure command.  The
    cargo target subdirectory also needed to be prefixed with the host
    triplet for cross-compiling.
    Some of the crates' build scripts require cross-pkg-config settings
    in the environment, so they are set for the cargo build command.
    It's worth noting that Rust targets are limited to built-in values
    by default, so the --host value given to configure may not be
    supported.  Built in targets can be found by listing the directory
    src/librustc_back/target in the rustc source.  When building with
    an unsupported target, the user will have to write a target JSON
    definition file and set the environment variable RUST_TARGET_PATH
    to its directory (as with building any Rust project).
    This also sneaks in prefixing the Rust library recipe line with a
    "+" character to pass the GNU Make jobserver environment and file
    descriptors, which cargo supports to act as a jobserver client.
configure.ac 11.4 KB