.\" $OpenBSD: cargo-module.5,v 1.3 2021/02/26 01:46:52 danj Exp $ .\" .\" Copyright (c) 2008 Marc Espie .\" Copyright (c) 2017 Daniel Jakots .\" .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .Dd $Mdocdate: February 26 2021 $ .Dt CARGO-MODULE 5 .Os .Sh NAME .Nm cargo-module .Nd devel/cargo port module .Sh DESCRIPTION This manual page documents the behavior of setting .Li MODULE=devel/cargo in the .Xr ports 7 tree. .Pp Automates download and compilation of dependencies of a Rust project using .Xr cargo 1 . During .Cm fetch , static dependencies ("crates") listed in .Ev MODCARGO_CRATES are downloaded using .Ev MODCARGO_DIST_SUBDIR as .Ev DIST_SUBDIR . During .Cm post-extract , crates defined in .Ev MODCARGO_CRATES are moved to the .Ev MODCARGO_VENDOR_DIR directory. During .Cm post-patch , crate-metadata are generated using .Pa devel/cargo-generate-vendor . With .Ev CONFIGURE_STYLE set to .Sq cargo , cargo is configured to use .Ev MODCARGO_VENDOR_DIR instead of the standard crates-io network source. Finally, any crates listed in .Ev MODCARGO_CRATES_UPDATE are updated. .Ev MODCARGO_RUSTFLAGS can be used to pass custom flags to all .Xr rustc 1 invocations. .Pp .Pa lang/rust , .Pa devel/cargo and .Pa devel/cargo-generate-vendor are added to .Ev BUILD_DEPENDS . By default .Ev MASTER_SITES9 is used to download the crates. .Pp This module defines: .Bl -tag -width MODCARGO_CRATES_UPDATE .It MODCARGO_CARGOTOML Path to cargo manifest. Defaults to .Pa ${WRKSRC}/Cargo.toml . .It MODCARGO_CRATES Crates that will be downloaded by the module. .It MODCARGO_CRATES_UPDATE List of crates to update, overriding the version listed in Cargo.lock. .It MODCARGO_FEATURES List of features to be used when building. .It MODCARGO_VENDOR_DIR Name of the local directory for vendoring crates. Defaults to .Pa ${WRKSRC}/modcargo-crates . .El .Pp This module adds three .Xr make 1 targets: .Bl -tag -width modcargo-gen-crates-licenses .It Cm modcargo-metadata Rerun the generation of crates' metadata. .It Cm modcargo-gen-crates Generate the .Ev MODCARGO_CRATES list from Cargo.lock (a preliminary crates list is not required). .It Cm modcargo-gen-crates-licenses Generate the .Ev MODCARGO_CRATES list with license information from crates present in the .Ev MODCARGO_VENDOR_DIR directory. .El .Sh SEE ALSO .Xr port-modules 5