From: Rafael Sadowski Subject: NEW: devel/corrosion and graphics/cxx-rust-cssparser (new approch without devel/cxxbridge-cmd) To: ports@openbsd.org Cc: yaydn@protonmail.com, semarie@kapouay.eu.org Date: Tue, 23 Jun 2026 16:28:04 +0200 XXX: If you tried the approach before, please remove devel/cxxbridge-cmd Please find a new approach to make rust and cmake work together with devel/corrosion. The new approach leaves devel/corrosion as it is and does all the work in the consumer port. For graphics/cxx-rust-cssparser it looks like this (I also tested it with another port): 1. We ship our own Cargo.lock for cxxbridge-cmd so the build resolves against the modcargo vendored crates instead of reaching out to crates.io. 1.1. We provide a crates.inc that lists all crates, both for MODCARGO_CARGOTOML and for the cxxbridge-cmd version. 2. We replace Cargo.lock, so we drop its entry from .cargo-checksum.json, because otherwise cargo's integrity check fails the --locked build. corrosion builds cxxbridge-cmd during the build step, but everything it needs is already present in MODCARGO_VENDOR_DIR. If this is OK for everyone, I would like to ask for OKs to import it. I tested this with the KDE Plasma 6.7 update at runtime. Here is the base idea: MODULES = devel/cmake \ devel/cargo MODCARGO_BUILD = No MODCARGO_INSTALL = No MODCARGO_CARGOTOML = ${WRKSRC}/rust/Cargo.toml BUILD_DEPENDS = devel/corrosion CONFIGURE_ENV += CARGO_HOME=${WRKDIR}/cargo-home MAKE_ENV += CARGO_HOME=${WRKDIR}/cargo-home WRKDIST = ${WRKDIR}/cxx-rust-cssparser-v${VERSION}-2c5cd92c14164e6da2b98beba1edeaecdc1445d1 CXXBRIDGE_V = 1.0.194 CXXBRIDGE_LOCKFILE = cxxbridge-cargo.lock pre-configure: # We ship our own Cargo.lock for cxxbridge-cmd so the build resolves # against the vendored crates instead of reaching out to crates.io cp ${FILESDIR}/${CXXBRIDGE_LOCKFILE} \ ${MODCARGO_VENDOR_DIR}/cxxbridge-cmd-${CXXBRIDGE_V}/Cargo.lock # We replaced Cargo.lock so we drop its entry from .cargo-checksum.json # because otherwise cargo's integrity check fails the --locked build. cd ${MODCARGO_VENDOR_DIR}/cxxbridge-cmd-${CXXBRIDGE_V} && \ sed -i 's,"Cargo.lock":"[0-9a-f]*"\,,,' .cargo-checksum.json mkdir -p ${WRKDIR}/cargo-home printf '%s\n' \ '[source.crates-io]' \ 'replace-with = "modcargo"' \ '[source.modcargo]' \ 'directory = "${MODCARGO_VENDOR_DIR}"' \ '[net]' \ 'offline = true' \ > ${WRKDIR}/cargo-home/config.toml # This file includes MODCARGO_CARGOTOML and CXXBRIDGE_LOCKFILE crates. .include "crates.inc"