1.\" $OpenBSD: cargo-module.5,v 1.9 2024/01/06 08:03:31 semarie Exp $ 2.\" 3.\" Copyright (c) 2008 Marc Espie 4.\" Copyright (c) 2017 Daniel Jakots 5.\" 6.\" All rights reserved. 7.\" 8.\" Redistribution and use in source and binary forms, with or without 9.\" modification, are permitted provided that the following conditions 10.\" are met: 11.\" 1. Redistributions of source code must retain the above copyright 12.\" notice, this list of conditions and the following disclaimer. 13.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" notice, this list of conditions and the following disclaimer in the 15.\" documentation and/or other materials provided with the distribution. 16.\" 17.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR 18.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 21.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27.\" 28.Dd $Mdocdate: January 6 2024 $ 29.Dt CARGO-MODULE 5 30.Os 31.Sh NAME 32.Nm cargo-module 33.Nd devel/cargo port module 34.Sh DESCRIPTION 35This manual page documents the behavior of setting 36.Li MODULES=devel/cargo 37in the 38.Xr ports 7 39tree. 40.Pp 41Automates download and compilation of dependencies of a Rust project using 42.Xr cargo 1 . 43.Pp 44During 45.Cm fetch , 46static dependencies ("crates") listed in 47.Ev MODCARGO_CRATES 48are downloaded using 49.Ev MODCARGO_DIST_SUBDIR 50as 51.Ev DIST_SUBDIR . 52.Pp 53During 54.Cm post-extract , 55crates defined in 56.Ev MODCARGO_CRATES 57are moved to the 58.Ev MODCARGO_VENDOR_DIR 59directory. 60.Pp 61During 62.Cm post-patch , 63crate-metadata are generated using 64.Pa devel/cargo-generate-vendor . 65.Pp 66With 67.Ev CONFIGURE_STYLE 68set to 69.Sq cargo , 70cargo is configured to use 71.Ev MODCARGO_VENDOR_DIR 72instead of the standard crates-io network source. 73Finally, any crates listed in 74.Ev MODCARGO_CRATES_UPDATE 75are updated. 76.Pp 77.Ev MODCARGO_RUSTFLAGS 78can be used to pass custom flags to all 79.Xr rustc 1 80invocations. 81.Pp 82.Pa lang/rust 83is added to 84.Ev MODULES , 85and 86.Pa devel/cargo-generate-vendor 87is added to 88.Ev BUILD_DEPENDS . 89.Pp 90This module defines: 91.Bl -tag -width MODCARGO_INSTALL_TARGET_PATHS 92.It Ev MODCARGO_CARGOTOML 93Path to cargo manifest. 94Defaults to 95.Pa ${WRKSRC}/Cargo.toml . 96.It Ev MODCARGO_CRATES 97Crates that will be downloaded by the module. 98.It Ev MODCARGO_CRATES_UPDATE 99List of crates to update, overriding the version listed in Cargo.lock. 100.It Ev MODCARGO_FEATURES 101List of features to be used when building. 102.It Ev MODCARGO_INSTALL_TARGET_PATHS 103List of paths to pass to 104.Cm cargo install 105instead of 106.Pa \&. . 107Needs to be set for some virtual manifests. 108.It Ev MODCARGO_VENDOR_DIR 109Name of the local directory for vendoring crates. 110Defaults to 111.Pa ${WRKSRC}/modcargo-crates . 112.It Ev MODCARGO_WANTLIB 113Architecture-specific 114.Ev WANTLIB 115entries required by all Rust code. 116It is a copy of 117.Ev MODRUST_WANTLIB 118provided for simplicity. 119.El 120.Pp 121This module adds three 122.Xr make 1 123targets: 124.Bl -tag -width modcargo-gen-crates-licenses 125.It Cm modcargo-metadata 126Rerun the generation of crates' metadata. 127.It Cm modcargo-gen-crates 128Generate the 129.Ev MODCARGO_CRATES 130list from Cargo.lock (a preliminary crates list is not required). 131.It Cm modcargo-gen-crates-licenses 132Generate the 133.Ev MODCARGO_CRATES 134list with license information from crates present in the 135.Ev MODCARGO_VENDOR_DIR 136directory. 137.El 138.Sh SEE ALSO 139.Xr port-modules 5 140