Changeset View
Standalone View
Mk/Uses/cargo.mk
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | CARGO_ENV+= \ | ||||
RUSTC=${RUSTC} \ | RUSTC=${RUSTC} \ | ||||
RUSTDOC=${RUSTDOC} \ | RUSTDOC=${RUSTDOC} \ | ||||
RUSTFLAGS="${RUSTFLAGS} ${LDFLAGS:C/.+/-C link-arg=&/}" | RUSTFLAGS="${RUSTFLAGS} ${LDFLAGS:C/.+/-C link-arg=&/}" | ||||
. if ${ARCH} != powerpc | . if ${ARCH} != powerpc | ||||
CARGO_ENV+= RUST_BACKTRACE=1 | CARGO_ENV+= RUST_BACKTRACE=1 | ||||
. endif | . endif | ||||
. if !defined(LTO_UNSAFE) || (defined(LTO_DISABLE_CHECK) && ${ARCH} == powerpc64) || (defined(LTO_DISABLE_CHECK) && ${ARCH} == riscv64) | |||||
tobik: Why not just set WITH_LTO and let `lto.mk` handle the rest?
_CARGO_MSG doesn't seem that… | |||||
Done Inline ActionsIt's needed otherwise IGNORE gets set which will result in no ports being built at all. I think it might be a good idea to have some kind of visual indicator or what's going on but it if it's deemed unnecessary we can drop it. I did try to add output via lto.mk but I think we might be a bit too early in as I get "Invalid line type" trying to use echo/${ECHO_MSG} diizzy: It's needed otherwise IGNORE gets set which will result in no ports being built at all.
I… | |||||
Done Inline ActionsWe could exclude !defined(LTO_UNSAFE) though looking at it again as that gets evaluated in lto.mk diizzy: We could exclude !defined(LTO_UNSAFE) though looking at it again as that gets evaluated in lto. | |||||
Not Done Inline ActionsPhilosophically I guess I'm dumbfounded as to what the purpose of lto.mk is (or Mk/Features in general). I thought setting WITH_LTO is like saying "I want to use LTO if at all possible but am fine without it if it isn't". I thought it was a hint not a must. Now every port that sets WITH_LTO must wrap it in the same conditional to not get IGNOREd on powerpc64. lto.mk could maybe export a variable when LTO is really, really used by the build. Just so you don't have the same conditional everywhere. tobik: Philosophically I guess I'm dumbfounded as to what the purpose of `lto.mk` is (or Mk/Features… | |||||
Done Inline ActionsThat "if at all possible" part is a bit hard to find a nice way balance to. While you could silently ignore targets I do think that it introducing silent workarounds causes more harm than good especially when it comes to debugging. What it boils down to is whether we should play it safe and tell the user "this is a bad idea" and bail out or silently(?) ignore WITH_LTO. I personally would much prefer the first option rather than "why doesn't this work" and having to dig through code to figure out why. If we at least could output something like "this is disabled on XXX" I guess that would be a middle ground but I dont see how we can do that in a nice way. diizzy: That "if at all possible" part is a bit hard to find a nice way balance to. While you could… | |||||
Not Done Inline Actions
IIUYC, this can be done by appending something to WARNING or DEV_WARNING. tobik: > If we at least could output something like "this is disabled on XXX" I guess that would be a… | |||||
Not Done Inline ActionsI'd add some parentheses into this line. arrowd: I'd add some parentheses into this line. | |||||
Done Inline ActionsNot sure what you want me to change, example? diizzy: Not sure what you want me to change, example? | |||||
Not Done Inline ActionsI find . if !defined(LTO_UNSAFE) || (defined(LTO_DISABLE_CHECK) && ${ARCH} == powerpc64) || (defined(LTO_DISABLE_CHECK) && ${ARCH} == riscv64) more appealing, but that's just a nitpick. arrowd: I find
```
. if !defined(LTO_UNSAFE) || (defined(LTO_DISABLE_CHECK) && ${ARCH} == powerpc64)… | |||||
_CARGO_MSG= "===> Additional optimization to port applied" | |||||
WITH_LTO= yes | |||||
. endif | |||||
# 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:Mpowerpc*} | . elif ${ARCH:Mpowerpc*} | ||||
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=/} | ||||
. endif | . endif | ||||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | |||||
_USES_configure+= 250:cargo-configure | _USES_configure+= 250:cargo-configure | ||||
# configure hook. Place a config file for overriding crates-io index | # configure hook. Place a config file for overriding crates-io index | ||||
# by local source directory. | # by local source directory. | ||||
cargo-configure: | cargo-configure: | ||||
# Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64 | # Check that the running kernel has COMPAT_FREEBSD11 required by lang/rust post-ino64 | ||||
@${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \ | @${SETENV} CC="${CC}" OPSYS="${OPSYS}" OSVERSION="${OSVERSION}" WRKDIR="${WRKDIR}" \ | ||||
${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh | ${SH} ${SCRIPTSDIR}/rust-compat11-canary.sh | ||||
. if defined(_CARGO_MSG) | |||||
@${ECHO_MSG} ${_CARGO_MSG} | |||||
. endif | |||||
@${ECHO_MSG} "===> Cargo config:" | @${ECHO_MSG} "===> Cargo config:" | ||||
@${MKDIR} ${WRKDIR}/.cargo | @${MKDIR} ${WRKDIR}/.cargo | ||||
@: > ${WRKDIR}/.cargo/config.toml | @: > ${WRKDIR}/.cargo/config.toml | ||||
@${ECHO_CMD} "[source.cargo]" >> ${WRKDIR}/.cargo/config.toml | @${ECHO_CMD} "[source.cargo]" >> ${WRKDIR}/.cargo/config.toml | ||||
@${ECHO_CMD} "directory = '${CARGO_VENDOR_DIR}'" >> ${WRKDIR}/.cargo/config.toml | @${ECHO_CMD} "directory = '${CARGO_VENDOR_DIR}'" >> ${WRKDIR}/.cargo/config.toml | ||||
@${ECHO_CMD} "[source.crates-io]" >> ${WRKDIR}/.cargo/config.toml | @${ECHO_CMD} "[source.crates-io]" >> ${WRKDIR}/.cargo/config.toml | ||||
@${ECHO_CMD} "replace-with = 'cargo'" >> ${WRKDIR}/.cargo/config.toml | @${ECHO_CMD} "replace-with = 'cargo'" >> ${WRKDIR}/.cargo/config.toml | ||||
. if !empty(_CARGO_GIT_SOURCES) | . if !empty(_CARGO_GIT_SOURCES) | ||||
▲ Show 20 Lines • Show All 102 Lines • Show Last 20 Lines |
Why not just set WITH_LTO and let lto.mk handle the rest?
_CARGO_MSG doesn't seem that useful and is maybe something lto.mk can print in general.