Changeset View
Changeset View
Standalone View
Standalone View
Mk/Uses/cargo.mk
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
# Location of the cargo output directory. | # Location of the cargo output directory. | ||||
CARGO_TARGET_DIR?= ${WRKDIR}/target | CARGO_TARGET_DIR?= ${WRKDIR}/target | ||||
# Environment for cargo | # Environment for cargo | ||||
# - CARGO_HOME: local cache of the registry index | # - CARGO_HOME: local cache of the registry index | ||||
# - CARGO_BUILD_JOBS: configure number of jobs to run | # - CARGO_BUILD_JOBS: configure number of jobs to run | ||||
# - CARGO_TARGET_DIR: location of where to place all generated artifacts | # - CARGO_TARGET_DIR: location of where to place all generated artifacts | ||||
# - RUST_BACKTRACE: produce backtraces when something in the build panics | |||||
# - RUSTC: path of rustc binary (default to lang/rust) | # - RUSTC: path of rustc binary (default to lang/rust) | ||||
# - RUSTDOC: path of rustdoc binary (default to lang/rust) | # - RUSTDOC: path of rustdoc binary (default to lang/rust) | ||||
# - RUSTFLAGS: custom flags to pass to all compiler invocations that Cargo performs | # - RUSTFLAGS: custom flags to pass to all compiler invocations that Cargo performs | ||||
CARGO_ENV+= \ | CARGO_ENV+= \ | ||||
CARGO_HOME=${WRKDIR}/cargo-home \ | CARGO_HOME=${WRKDIR}/cargo-home \ | ||||
CARGO_BUILD_JOBS=${MAKE_JOBS_NUMBER} \ | CARGO_BUILD_JOBS=${MAKE_JOBS_NUMBER} \ | ||||
CARGO_TARGET_DIR=${CARGO_TARGET_DIR} \ | CARGO_TARGET_DIR=${CARGO_TARGET_DIR} \ | ||||
RUST_BACKTRACE=1 \ | |||||
RUSTC=${LOCALBASE}/bin/rustc \ | RUSTC=${LOCALBASE}/bin/rustc \ | ||||
RUSTDOC=${LOCALBASE}/bin/rustdoc \ | RUSTDOC=${LOCALBASE}/bin/rustdoc \ | ||||
RUSTFLAGS="${RUSTFLAGS} -C linker=${CC:Q} ${LDFLAGS:C/.+/-C link-arg=&/}" | RUSTFLAGS="${RUSTFLAGS} -C linker=${CC:Q} ${LDFLAGS:C/.+/-C link-arg=&/}" | ||||
# Adjust -C target-cpu if -march/-mcpu is set by bsd.cpu.mk | # Adjust -C target-cpu if -march/-mcpu is set by bsd.cpu.mk | ||||
.if ${ARCH} == amd64 || ${ARCH} == i386 | .if ${ARCH} == amd64 || ${ARCH} == i386 | ||||
RUSTFLAGS+= ${CFLAGS:M-march=*:S/-march=/-C target-cpu=/} | RUSTFLAGS+= ${CFLAGS:M-march=*:S/-march=/-C target-cpu=/} | ||||
.else | .else | ||||
▲ Show 20 Lines • Show All 200 Lines • ▼ Show 20 Lines | @${CARGO_CARGO_RUN} build \ | ||||
--verbose \ | --verbose \ | ||||
${CARGO_BUILD_ARGS} | ${CARGO_BUILD_ARGS} | ||||
.endif | .endif | ||||
.if !target(do-install) && ${CARGO_INSTALL:tl} == "yes" | .if !target(do-install) && ${CARGO_INSTALL:tl} == "yes" | ||||
do-install: | do-install: | ||||
. for path in ${CARGO_INSTALL_PATH} | . for path in ${CARGO_INSTALL_PATH} | ||||
@${CARGO_CARGO_RUN} install \ | @${CARGO_CARGO_RUN} install \ | ||||
--no-track \ | |||||
--path "${path}" \ | --path "${path}" \ | ||||
--root "${STAGEDIR}${PREFIX}" \ | --root "${STAGEDIR}${PREFIX}" \ | ||||
--verbose \ | --verbose \ | ||||
${CARGO_INSTALL_ARGS} | ${CARGO_INSTALL_ARGS} | ||||
# Replace with --no-track once it is part of lang/rust | |||||
@${RM} -- "${STAGEDIR}${PREFIX}/.crates.toml" | |||||
@${RM} -- "${STAGEDIR}${PREFIX}/.crates2.json" | |||||
. endfor | . endfor | ||||
.endif | .endif | ||||
.if !target(do-test) && ${CARGO_TEST:tl} == "yes" | .if !target(do-test) && ${CARGO_TEST:tl} == "yes" | ||||
do-test: | do-test: | ||||
@${CARGO_CARGO_RUN} test \ | @${CARGO_CARGO_RUN} test \ | ||||
--manifest-path ${CARGO_CARGOTOML} \ | --manifest-path ${CARGO_CARGOTOML} \ | ||||
--verbose \ | --verbose \ | ||||
Show All 29 Lines |