mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-25 19:33:54 -06:00
build, dockerfiles: add support for detecting rustdoc
rustdoc is effectively a custom version of rustc, and it is necessary to specify it in order to run doctests from Meson. Add the relevant configure option and environment variables. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
4f04a4eaf0
commit
53de966c3e
5 changed files with 16 additions and 0 deletions
8
configure
vendored
8
configure
vendored
|
@ -209,6 +209,8 @@ for opt do
|
|||
;;
|
||||
--rustc=*) RUSTC="$optarg"
|
||||
;;
|
||||
--rustdoc=*) RUSTDOC="$optarg"
|
||||
;;
|
||||
--cpu=*) cpu="$optarg"
|
||||
;;
|
||||
--extra-cflags=*)
|
||||
|
@ -323,6 +325,7 @@ pkg_config="${PKG_CONFIG-${cross_prefix}pkg-config}"
|
|||
sdl2_config="${SDL2_CONFIG-${cross_prefix}sdl2-config}"
|
||||
|
||||
rustc="${RUSTC-rustc}"
|
||||
rustdoc="${RUSTDOC-rustdoc}"
|
||||
|
||||
check_define() {
|
||||
cat > $TMPC <<EOF
|
||||
|
@ -660,6 +663,8 @@ for opt do
|
|||
;;
|
||||
--rustc=*)
|
||||
;;
|
||||
--rustdoc=*)
|
||||
;;
|
||||
--make=*)
|
||||
;;
|
||||
--install=*)
|
||||
|
@ -890,6 +895,7 @@ Advanced options (experts only):
|
|||
--cxx=CXX use C++ compiler CXX [$cxx]
|
||||
--objcc=OBJCC use Objective-C compiler OBJCC [$objcc]
|
||||
--rustc=RUSTC use Rust compiler RUSTC [$rustc]
|
||||
--rustdoc=RUSTDOC use rustdoc binary RUSTDOC [$rustdoc]
|
||||
--extra-cflags=CFLAGS append extra C compiler flags CFLAGS
|
||||
--extra-cxxflags=CXXFLAGS append extra C++ compiler flags CXXFLAGS
|
||||
--extra-objcflags=OBJCFLAGS append extra Objective C compiler flags OBJCFLAGS
|
||||
|
@ -1901,8 +1907,10 @@ if test "$skip_meson" = no; then
|
|||
if test "$rust" != disabled; then
|
||||
if test "$rust_host_triple" != "$rust_target_triple"; then
|
||||
echo "rust = [$(meson_quote $rustc --target "$rust_target_triple")]" >> $cross
|
||||
echo "rustdoc = [$(meson_quote $rustdoc --target "$rust_target_triple")]" >> $cross
|
||||
else
|
||||
echo "rust = [$(meson_quote $rustc)]" >> $cross
|
||||
echo "rustdoc = [$(meson_quote $rustdoc)]" >> $cross
|
||||
fi
|
||||
fi
|
||||
echo "ar = [$(meson_quote $ar)]" >> $cross
|
||||
|
|
|
@ -106,6 +106,7 @@ if have_rust
|
|||
endif
|
||||
|
||||
if have_rust
|
||||
rustdoc = find_program('rustdoc', required: get_option('rust'))
|
||||
bindgen = find_program('bindgen', required: get_option('rust'))
|
||||
if not bindgen.found() or bindgen.version().version_compare('<0.60.0')
|
||||
if get_option('rust').enabled()
|
||||
|
@ -4757,6 +4758,7 @@ if have_rust
|
|||
summary_info += {'Rust target': config_host['RUST_TARGET_TRIPLE']}
|
||||
summary_info += {'rustc': ' '.join(rustc.cmd_array())}
|
||||
summary_info += {'rustc version': rustc.version()}
|
||||
summary_info += {'rustdoc': rustdoc}
|
||||
summary_info += {'bindgen': bindgen.full_path()}
|
||||
summary_info += {'bindgen version': bindgen.version()}
|
||||
endif
|
||||
|
|
|
@ -156,6 +156,7 @@ ENV PYTHON "/usr/bin/python3"
|
|||
RUN dnf install -y wget
|
||||
ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo
|
||||
ENV RUSTC=/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc
|
||||
ENV RUSTDOC=/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustdoc
|
||||
ENV CARGO=/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo
|
||||
RUN set -eux && \
|
||||
rustArch='x86_64-unknown-linux-gnu' && \
|
||||
|
@ -170,6 +171,7 @@ RUN set -eux && \
|
|||
/usr/local/cargo/bin/rustup run nightly cargo --version && \
|
||||
/usr/local/cargo/bin/rustup run nightly rustc --version && \
|
||||
test "$CARGO" = "$(/usr/local/cargo/bin/rustup +nightly which cargo)" && \
|
||||
test "$RUSTDOC" = "$(/usr/local/cargo/bin/rustup +nightly which rustdoc)" && \
|
||||
test "$RUSTC" = "$(/usr/local/cargo/bin/rustup +nightly which rustc)"
|
||||
ENV PATH=$CARGO_HOME/bin:$PATH
|
||||
RUN /usr/local/cargo/bin/rustup run nightly cargo install bindgen-cli
|
||||
|
|
|
@ -151,6 +151,7 @@ ENV MAKE "/usr/bin/make"
|
|||
ENV NINJA "/usr/bin/ninja"
|
||||
ENV PYTHON "/usr/bin/python3"
|
||||
ENV RUSTC=/usr/bin/rustc-1.77
|
||||
ENV RUSTDOC=/usr/bin/rustdoc-1.77
|
||||
ENV CARGO_HOME=/usr/local/cargo
|
||||
ENV PATH=$CARGO_HOME/bin:$PATH
|
||||
RUN DEBIAN_FRONTEND=noninteractive eatmydata \
|
||||
|
|
|
@ -121,6 +121,7 @@ fedora_rustup_nightly_extras = [
|
|||
"RUN dnf install -y wget\n",
|
||||
"ENV RUSTUP_HOME=/usr/local/rustup CARGO_HOME=/usr/local/cargo\n",
|
||||
"ENV RUSTC=/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc\n",
|
||||
"ENV RUSTDOC=/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustdoc\n",
|
||||
"ENV CARGO=/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo\n",
|
||||
"RUN set -eux && \\\n",
|
||||
" rustArch='x86_64-unknown-linux-gnu' && \\\n",
|
||||
|
@ -135,6 +136,7 @@ fedora_rustup_nightly_extras = [
|
|||
" /usr/local/cargo/bin/rustup run nightly cargo --version && \\\n",
|
||||
" /usr/local/cargo/bin/rustup run nightly rustc --version && \\\n",
|
||||
' test "$CARGO" = "$(/usr/local/cargo/bin/rustup +nightly which cargo)" && \\\n',
|
||||
' test "$RUSTDOC" = "$(/usr/local/cargo/bin/rustup +nightly which rustdoc)" && \\\n',
|
||||
' test "$RUSTC" = "$(/usr/local/cargo/bin/rustup +nightly which rustc)"\n',
|
||||
'ENV PATH=$CARGO_HOME/bin:$PATH\n',
|
||||
'RUN /usr/local/cargo/bin/rustup run nightly cargo install bindgen-cli\n',
|
||||
|
@ -143,6 +145,7 @@ fedora_rustup_nightly_extras = [
|
|||
|
||||
ubuntu2204_rust_extras = [
|
||||
"ENV RUSTC=/usr/bin/rustc-1.77\n",
|
||||
"ENV RUSTDOC=/usr/bin/rustdoc-1.77\n",
|
||||
"ENV CARGO_HOME=/usr/local/cargo\n",
|
||||
'ENV PATH=$CARGO_HOME/bin:$PATH\n',
|
||||
"RUN DEBIAN_FRONTEND=noninteractive eatmydata \\\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue