Changeset View
Changeset View
Standalone View
Standalone View
Mk/Uses/cargo.mk
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
MASTER_SITES+= ${MASTER_SITE_CRATESIO:S,%SUBDIR%,${_name}/${_version},:S,$,:_cargo_${_index},} | MASTER_SITES+= ${MASTER_SITE_CRATESIO:S,%SUBDIR%,${_name}/${_version},:S,$,:_cargo_${_index},} | ||||
DISTFILES+= ${CARGO_DIST_SUBDIR}/${_crate}${CARGO_CRATE_EXT}:_cargo_${_index} | DISTFILES+= ${CARGO_DIST_SUBDIR}/${_crate}${CARGO_CRATE_EXT}:_cargo_${_index} | ||||
.endfor | .endfor | ||||
# Build dependencies. | # Build dependencies. | ||||
CARGO_BUILDDEP?= yes | CARGO_BUILDDEP?= yes | ||||
.if ${CARGO_BUILDDEP:tl} == "yes" | .if ${CARGO_BUILDDEP:tl} == "yes" | ||||
BUILD_DEPENDS+= ${RUST_DEFAULT}>=1.54.0:lang/${RUST_DEFAULT} | BUILD_DEPENDS+= ${RUST_DEFAULT}>=1.55.0:lang/${RUST_DEFAULT} | ||||
.endif | .endif | ||||
# Location of cargo binary (default to lang/rust's Cargo binary) | # Location of cargo binary (default to lang/rust's Cargo binary) | ||||
CARGO_CARGO_BIN?= ${LOCALBASE}/bin/cargo | CARGO_CARGO_BIN?= ${LOCALBASE}/bin/cargo | ||||
# Location of the cargo output directory. | # Location of the cargo output directory. | ||||
CARGO_TARGET_DIR?= ${WRKDIR}/target | CARGO_TARGET_DIR?= ${WRKDIR}/target | ||||
# Default target platform (affects some RUSTFLAGS if passed) | |||||
CARGO_BUILD_TARGET?= ${ARCH:S/amd64/x86_64/:S/i386/i686/}-unknown-${OPSYS:tl} | |||||
# 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 | # - 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_BUILD_TARGET=${CARGO_BUILD_TARGET} \ | |||||
CARGO_TARGET_DIR=${CARGO_TARGET_DIR} \ | CARGO_TARGET_DIR=${CARGO_TARGET_DIR} \ | ||||
CARGO_TARGET_${CARGO_BUILD_TARGET:S/-/_/g:tu}_LINKER="${CC}" \ | |||||
RUST_BACKTRACE=1 \ | 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} ${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=/} | ||||
.elif ${ARCH:Mpowerpc64*} | .elif ${ARCH:Mpowerpc64*} | ||||
RUSTFLAGS+= ${CFLAGS:M-mcpu=*:S/-mcpu=/-C target-cpu=/:S/power/pwr/} | RUSTFLAGS+= ${CFLAGS:M-mcpu=*:S/-mcpu=/-C target-cpu=/:S/power/pwr/} | ||||
.else | .else | ||||
RUSTFLAGS+= ${CFLAGS:M-mcpu=*:S/-mcpu=/-C target-cpu=/} | RUSTFLAGS+= ${CFLAGS:M-mcpu=*:S/-mcpu=/-C target-cpu=/} | ||||
▲ Show 20 Lines • Show All 268 Lines • Show Last 20 Lines |