@@ -15,146 +15,168 @@ install and test Rust programs.
15
15
16
16
.TP
17
17
\fB build \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 .
20
20
.TP
21
21
\fB clean \fR
22
- Remove all build files in the work cache for the package in the current
23
- directory.
24
- .TP
25
- \fB do \fR
26
- Runs a command in the package script.
27
- .TP
28
- \fB info \fR
29
- Probe the package script in the current directory for information.
22
+ Remove all generated files from the \fI build \fR directory in the target's workspace.
30
23
.TP
31
24
\fB install \fR
32
- Install a package given a local archive or a remote URI or VCS.
33
- .TP
34
- \fB prefer \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 \fI lib \fR and \fI bin \fR directories of their respective
27
+ workspaces.
36
28
.TP
37
29
\fB test \fR
38
- Build all targets described in the package script in the current directory
39
- with the test flag.
40
- .TP
41
- \fB uninstall \fR
42
- Remove a package by id or name and optionally version.
43
- .TP
44
- \fB unprefer \fR
45
- Remove links to the versioned binary.
46
- .TP
47
- \fB help \fR
48
- show detailed usage of a command
30
+ Builds the module called \fI test.rs \fR in the specified workspace, and then runs
31
+ the resulting executable in test mode.
49
32
50
- .SH "BUILD COMMAND"
33
+ .SS "BUILD COMMAND"
51
34
52
- The \fB build \fR command builds all targets described in the package script in
53
- the current directory.
35
+ rustpkg build \fI [pkgname] \fR
54
36
55
- .TP
56
- -c, --cfg
57
- Pass a cfg flag to the package script
37
+ The \fB build \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
+ \fI build \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
+ \fB install \fR command.
58
43
59
- .SH "DO COMMAND"
44
+ .SS "CLEAN COMMAND"
60
45
61
- The \fB do \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
63
47
64
- . SH "TEST COMMAND"
48
+ deletes the contents of package's build directory.
65
49
66
- The test command is an shortcut for the command line:
50
+ . SS "INSTALL COMMAND"
67
51
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 \fI lib \fR
56
+ and \fI bin \fR directories, or into the \fI lib \fR and \fI bin \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
69
63
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"
72
65
73
- . SH "INFO COMMAND"
66
+ rustpkg test \fI [pkgname] \fR
74
67
75
- Probe the package script in the current directory for information.
68
+ The test command is a shortcut for the command line:
76
69
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"
78
76
79
77
.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 \fB PATHS \fR for full details.
82
81
83
- .SH "INSTALL COMMAND "
82
+ .SH "PATHS "
84
83
85
- rustpkg [options..] install [url] [target]
84
+ The \fB rustpkg \fR tool searches for packages in the folders specified by the
85
+ \fB RUST_PATH \fR environment variable. Each folder constitutes a
86
+ \fI workspace \fR , which contains one or more modules available to import.
86
87
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
+ \fI always \fR searched, in the following order:
93
90
94
- Examples:
91
+ 1. Any folders named ".rust" in the current directory, \fI and every parent \fR
92
+ of the curent directory, up to the filesystem root;
95
93
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
100
96
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).
102
99
100
+ .SH "PACKAGE STRUCTURE"
101
+
102
+ A valid workspace must contain each of the following subdirectories:
103
+
104
+ .TP
105
+ \fB src/ \fR
106
+ Contains the Rust source code, with one subdirectory per package. Each
107
+ subdirectory contains source files for a given package.
103
108
.TP
104
- -c, --cfg
105
- Pass a cfg flag to the package script
109
+ \fB lib/ \fR
110
+ "rustpkg install" installs libraries into a target-specific subdirectory of this directory.
111
+ .TP
112
+ \fB bin/ \fR
113
+ "rustpkg install" installs executable binaries into a target-specific subdirectory of this directory.
114
+ .TP
115
+ \fB build/ \fR
116
+ "rustpkg build" stores temporary build artifacts in a target-specific subdirectory of this directory.
106
117
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.
108
121
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"
113
123
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.
115
127
116
- export PATH=$PATH:/home/user/.rustpkg/bin
117
-
118
- machine -v
119
- ==> v1.2.4
120
-
121
- machine -v
122
- ==> v0.4.6
128
+ For example, \fI github.com/mozilla/rust \fR is a package ID
129
+ that would refer to the git repository browsable at \fI http://github.com/mozilla/rust \fR .
123
130
124
- .SH "TEST COMMAND"
131
+ A package ID can also specify a version, like:
132
+ \fI github.com/mozilla/rust#0.3 \fR . In this case, \fB rustpkg \fR will check that
133
+ the repository \fI github.com/mozilla/rust \fR has a tag named \fI 0.3 \fR , and
134
+ report an error otherwise.
125
135
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"
129
137
130
- Options:
138
+ \fB rustpkg \fR searches for four different known filenames in the src directory
139
+ in order to determine which crates to build:
131
140
132
141
.TP
133
- -c, --cfg
134
- Pass a cfg flag to the package script
135
-
136
- .SH "UNINSTALL COMMAND"
142
+ \fB main.rs \fR
143
+ Assumed to be a main entry point for building an executable (install destination is 'bin' directory).
144
+ .TP
145
+ \fB lib.rs \fR
146
+ Assumed to be a library crate (install destination is 'lib' directory).
147
+ .TP
148
+ \fB test.rs \fR
149
+ Assumed to contain tests declared with the \fI #[test] \fR attribute.
150
+ .TP
151
+ \fB bench.rs \fR
152
+ Assumed to contain benchmarks declared with the \fI #[bench] \fR attribute.
137
153
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"
140
155
141
- .SH "UNPREFER COMMAND"
156
+ \fB rustpkg \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.
142
162
143
- $ rustpkg [options..] unprefer <id|name>[@version]
163
+ . SH "DEPENDENCIES"
144
164
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.)
149
169
150
- .SH "EXAMPLES "
170
+ .SH "CUSTOM BUILD SCRIPTS "
151
171
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 \fI pkg.rs \fR at the root level in a workspace is called a \fI package
173
+ script \fR . If a package script exists, rustpkg executes it to build the
174
+ package rather than inferring crates as described previously.
155
175
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 \fI pkg.rs \fR , it's possible to call back into rustpkg to finish up the
177
+ build. The \fI rustpkg::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.
158
180
159
181
.SH "SEE ALSO"
160
182
0 commit comments