Skip to content

Commit 50600c3

Browse files
committed
Updated rustpkg man page to match 0.7
1 parent 6143419 commit 50600c3

File tree

1 file changed

+118
-96
lines changed

1 file changed

+118
-96
lines changed

man/rustpkg.1

Lines changed: 118 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -15,146 +15,168 @@ install and test Rust programs.
1515

1616
.TP
1717
\fBbuild\fR
18-
Build all targets described in the package script in the current
19-
directory.
18+
Searches for a package with the specified name and builds it in the workspace in
19+
which it is found.
2020
.TP
2121
\fBclean\fR
22-
Remove all build files in the work cache for the package in the current
23-
directory.
24-
.TP
25-
\fBdo\fR
26-
Runs a command in the package script.
27-
.TP
28-
\fBinfo\fR
29-
Probe the package script in the current directory for information.
22+
Remove all generated files from the \fIbuild\fR directory in the target's workspace.
3023
.TP
3124
\fBinstall\fR
32-
Install a package given a local archive or a remote URI or VCS.
33-
.TP
34-
\fBprefer\fR
35-
Specify which version of a binary to use.
25+
Builds the specified target, and all its dependencies, and then installs the
26+
build products into the \fIlib\fR and \fIbin\fR directories of their respective
27+
workspaces.
3628
.TP
3729
\fBtest\fR
38-
Build all targets described in the package script in the current directory
39-
with the test flag.
40-
.TP
41-
\fBuninstall\fR
42-
Remove a package by id or name and optionally version.
43-
.TP
44-
\fBunprefer\fR
45-
Remove links to the versioned binary.
46-
.TP
47-
\fBhelp\fR
48-
show detailed usage of a command
30+
Builds the module called \fItest.rs\fR in the specified workspace, and then runs
31+
the resulting executable in test mode.
4932

50-
.SH "BUILD COMMAND"
33+
.SS "BUILD COMMAND"
5134

52-
The \fBbuild\fR command builds all targets described in the package script in
53-
the current directory.
35+
rustpkg build \fI[pkgname]\fR
5436

55-
.TP
56-
-c, --cfg
57-
Pass a cfg flag to the package script
37+
The \fBbuild\fR command searches for a package with specified package name and
38+
builds it in any workspace(s) where it finds one. Any dependent packages are
39+
also built. The output files produced by the build phase are stored in the
40+
\fIbuild\fR subdirectories of each package. The executables and libraries are
41+
not copied to the 'bin' or 'lib' directories; that is the purpose of the
42+
\fBinstall\fR command.
5843

59-
.SH "DO COMMAND"
44+
.SS "CLEAN COMMAND"
6045

61-
The \fBdo\fR command runs a command in the package script. You can listen to a
62-
command by tagging a function with the attribute `#[pkg_do(cmd)]`.
46+
rustpkg clean \fI[pkgname]\fR
6347

64-
.SH "TEST COMMAND"
48+
deletes the contents of package's build directory.
6549

66-
The test command is an shortcut for the command line:
50+
.SS "INSTALL COMMAND"
6751

68-
$ rustc --test <filename> -o <filestem>test~ && ./<filestem>test~
52+
rustpkg install \fI[url]\fR
53+
54+
builds the libraries and/or executables that are targets for the specified
55+
package name or URL, and then installs them either into package's \fIlib\fR
56+
and \fIbin\fR directories, or into the \fIlib\fR and \fIbin\fR subdirectories
57+
of the first entry in RUST_PATH.
58+
59+
Examples:
60+
61+
$ rustpkg install git://github.com/mozilla/servo.git#1.2
62+
$ rustpkg install rust-glfw
6963

70-
Note the trailing tilde on the output filename, which should ensure the
71-
file does not clash with a user-generated files.
64+
.SS "TEST COMMAND"
7265

73-
.SH "INFO COMMAND"
66+
rustpkg test \fI[pkgname]\fR
7467

75-
Probe the package script in the current directory for information.
68+
The test command is a shortcut for the command line:
7669

77-
Options:
70+
$ rustc --test <filename> -o <filestem>test~ && ./<filestem>test~
71+
72+
Note the suffix on the output filename (the word "test" followed by a tilde),
73+
which should ensure the file does not clash with a user-generated files.
74+
75+
.SH "ENVIRONMENT"
7876

7977
.TP
80-
-j, --json
81-
Output the result as JSON
78+
RUST_PATH
79+
A colon-separated (semicolon-separated) list of paths denoting workspaces
80+
to search for Rust source files. See the section \fBPATHS\fR for full details.
8281

83-
.SH "INSTALL COMMAND"
82+
.SH "PATHS"
8483

85-
rustpkg [options..] install [url] [target]
84+
The \fBrustpkg\fR tool searches for packages in the folders specified by the
85+
\fBRUST_PATH\fR environment variable. Each folder constitutes a
86+
\fIworkspace\fR, which contains one or more modules available to import.
8687

87-
Install a package from a URL by Git or cURL (FTP, HTTP, etc.). If target is
88-
provided, Git will checkout the branch or tag before continuing. If the URL
89-
is a TAR file (with or without compression), extract it before
90-
installing. If a URL isn't provided, the package will be built and installed
91-
from the current directory (which is functionally the same as `rustpkg
92-
build` and installing the result).
88+
In addition to the RUST_PATH settings, the following implicit paths are
89+
\fIalways\fR searched, in the following order:
9390

94-
Examples:
91+
1. Any folders named ".rust" in the current directory, \fIand every parent\fR
92+
of the curent directory, up to the filesystem root;
9593

96-
rustpkg install
97-
rustpkg install git://github.com/mozilla/servo.git
98-
rustpkg install git://github.com/mozilla/servo.git v0.1.2
99-
rustpkg install http://rust-lang.org/servo-0.1.2.tar.gz
94+
2. The system path "/usr/local" on Unix-style systems, or the equivalent on
95+
Windows; and
10096

101-
Options:
97+
3. A folder named ".rust" in the user's home directory (ie. "~/.rust" on Unix-
98+
style systems or the equivalent on Windows).
10299

100+
.SH "PACKAGE STRUCTURE"
101+
102+
A valid workspace must contain each of the following subdirectories:
103+
104+
.TP
105+
\fBsrc/\fR
106+
Contains the Rust source code, with one subdirectory per package. Each
107+
subdirectory contains source files for a given package.
103108
.TP
104-
-c, --cfg
105-
Pass a cfg flag to the package script
109+
\fBlib/\fR
110+
"rustpkg install" installs libraries into a target-specific subdirectory of this directory.
111+
.TP
112+
\fBbin/\fR
113+
"rustpkg install" installs executable binaries into a target-specific subdirectory of this directory.
114+
.TP
115+
\fBbuild/\fR
116+
"rustpkg build" stores temporary build artifacts in a target-specific subdirectory of this directory.
106117

107-
.SH "PREFER COMMAND"
118+
For example, if "foo" is a workspace containing the package "bar", then
119+
"foo/src/bar/main.rs" would be the "main" entry point for building a "bar"
120+
executable.
108121

109-
By default all binaries are given a unique name so that multiple versions
110-
can coexist. The prefer command will symlink the uniquely named binary to
111-
the binary directory under its bare name. If version is not supplied, the
112-
latest version of the package will be preferred.
122+
.SH "PACKAGE IDENTIFIERS"
113123

114-
Example:
124+
A package identifier uniquely identifies a package. A package can be stored in
125+
a workspace on the local file system, or on a remote Web server, in which case
126+
the package ID resembles a URL.
115127

116-
export PATH=$PATH:/home/user/.rustpkg/bin
117-
rustpkg prefer [email protected]
118-
machine -v
119-
==> v1.2.4
120-
rustpkg prefer [email protected]
121-
machine -v
122-
==> v0.4.6
128+
For example, \fIgit.cakeli.workers.dev/mozilla/rust\fR is a package ID
129+
that would refer to the git repository browsable at \fIhttp://github.com/mozilla/rust\fR.
123130

124-
.SH "TEST COMMAND"
131+
A package ID can also specify a version, like:
132+
\fIgit.cakeli.workers.dev/mozilla/rust#0.3\fR. In this case, \fBrustpkg\fR will check that
133+
the repository \fIgit.cakeli.workers.dev/mozilla/rust\fR has a tag named \fI0.3\fR, and
134+
report an error otherwise.
125135

126-
Build all targets described in the package script in the current directory
127-
with the test flag. The test bootstraps will be run afterwards and the output
128-
and exit code will be redirected.
136+
.SH "SPECIAL MODULES"
129137

130-
Options:
138+
\fBrustpkg\fR searches for four different known filenames in the src directory
139+
in order to determine which crates to build:
131140

132141
.TP
133-
-c, --cfg
134-
Pass a cfg flag to the package script
135-
136-
.SH "UNINSTALL COMMAND"
142+
\fBmain.rs\fR
143+
Assumed to be a main entry point for building an executable (install destination is 'bin' directory).
144+
.TP
145+
\fBlib.rs\fR
146+
Assumed to be a library crate (install destination is 'lib' directory).
147+
.TP
148+
\fBtest.rs\fR
149+
Assumed to contain tests declared with the \fI#[test]\fR attribute.
150+
.TP
151+
\fBbench.rs\fR
152+
Assumed to contain benchmarks declared with the \fI#[bench]\fR attribute.
137153

138-
Remove a package by id or name and optionally version. If the package(s)
139-
is/are depended on by another package then they cannot be removed.
154+
.SH "CRATE VERSIONS"
140155

141-
.SH "UNPREFER COMMAND"
156+
\fBrustpkg\fR packages do not need to declare their versions with an attribute
157+
inside one of the source files, because rustpkg infers it from the version
158+
control system. When building a package that is in a git repository,
159+
rustpkg assumes that the most recent tag specifies the current version. When
160+
building a package that is not under version control, or that has no tags,
161+
rustpkg defaults the version to 0.1.
142162

143-
$ rustpkg [options..] unprefer <id|name>[@version]
163+
.SH "DEPENDENCIES"
144164

145-
Remove all symlinks from the store to the binary directory for a package
146-
name and optionally version. If version is not supplied, the latest version
147-
of the package will be unpreferred. See `rustpkg prefer -h` for more
148-
information.
165+
rustpkg infers dependencies from "extern mod" directives. Thus, there should
166+
be no need to pass a "-L" flag to rustpkg to tell it where to find a library.
167+
(In the future, it will also be possible to write an "extern mod" directive
168+
referring to a remote package.)
149169

150-
.SH "EXAMPLES"
170+
.SH "CUSTOM BUILD SCRIPTS"
151171

152-
To clone, build and install a specific version of the Servo engine from
153-
its git repository on Github:
154-
$ rustpkg install git://github.com/mozilla/servo.git v0.1.2
172+
A file called \fIpkg.rs\fR at the root level in a workspace is called a \fIpackage
173+
script\fR. If a package script exists, rustpkg executes it to build the
174+
package rather than inferring crates as described previously.
155175

156-
To download the archive and install Servo from a tarball:
157-
$ rustpkg install http://rust-lang.org/servo-0.1.2.tar.gz
176+
Inside \fIpkg.rs\fR, it's possible to call back into rustpkg to finish up the
177+
build. The \fIrustpkg::api\fR module contains functions to build, install, or
178+
clean libraries and executables in the way rustpkg normally would without
179+
custom build logic.
158180

159181
.SH "SEE ALSO"
160182

0 commit comments

Comments
 (0)