xref: /openbsd-src/share/man/man5/cargo-module.5 (revision 4e1ee0786f11cc571bd0be17d38e46f635c719fc)
1.\"	$OpenBSD: cargo-module.5,v 1.4 2021/07/25 11:29:42 espie 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: July 25 2021 $
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 .
43During
44.Cm fetch ,
45static dependencies ("crates") listed in
46.Ev MODCARGO_CRATES
47are downloaded using
48.Ev MODCARGO_DIST_SUBDIR
49as
50.Ev DIST_SUBDIR .
51During
52.Cm post-extract ,
53crates defined in
54.Ev MODCARGO_CRATES
55are moved to the
56.Ev MODCARGO_VENDOR_DIR
57directory.
58During
59.Cm post-patch ,
60crate-metadata are generated using
61.Pa devel/cargo-generate-vendor .
62With
63.Ev CONFIGURE_STYLE
64set to
65.Sq cargo ,
66cargo is configured to use
67.Ev MODCARGO_VENDOR_DIR
68instead of the standard crates-io network source.
69Finally, any crates listed in
70.Ev MODCARGO_CRATES_UPDATE
71are updated.
72.Ev MODCARGO_RUSTFLAGS
73can be used to pass custom flags to all
74.Xr rustc 1
75invocations.
76.Pp
77.Pa lang/rust ,
78.Pa devel/cargo
79and
80.Pa devel/cargo-generate-vendor
81are added to
82.Ev BUILD_DEPENDS .
83By default
84.Ev MASTER_SITES9
85is used to download the crates.
86.Pp
87This module defines:
88.Bl -tag -width MODCARGO_CRATES_UPDATE
89.It MODCARGO_CARGOTOML
90Path to cargo manifest.
91Defaults to
92.Pa ${WRKSRC}/Cargo.toml .
93.It MODCARGO_CRATES
94Crates that will be downloaded by the module.
95.It MODCARGO_CRATES_UPDATE
96List of crates to update, overriding the version listed in Cargo.lock.
97.It MODCARGO_FEATURES
98List of features to be used when building.
99.It MODCARGO_VENDOR_DIR
100Name of the local directory for vendoring crates.
101Defaults to
102.Pa ${WRKSRC}/modcargo-crates .
103.El
104.Pp
105This module adds three
106.Xr make 1
107targets:
108.Bl -tag -width modcargo-gen-crates-licenses
109.It Cm modcargo-metadata
110Rerun the generation of crates' metadata.
111.It Cm modcargo-gen-crates
112Generate the
113.Ev MODCARGO_CRATES
114list from Cargo.lock (a preliminary crates list is not required).
115.It Cm modcargo-gen-crates-licenses
116Generate the
117.Ev MODCARGO_CRATES
118list with license information from crates present in the
119.Ev MODCARGO_VENDOR_DIR
120directory.
121.El
122.Sh SEE ALSO
123.Xr port-modules 5
124