Skip to content

Commit d6d85d2

Browse files
committed
---
yaml --- r: 140029 b: refs/heads/try2 c: d834c0d h: refs/heads/master i: 140027: 720a00c v: v3
1 parent bd772b6 commit d6d85d2

File tree

33 files changed

+275
-148
lines changed

33 files changed

+275
-148
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 3867470feb72e847e2960314b134199a9f3cd02d
8+
refs/heads/try2: d834c0d59d7b4febbf8dc411b5d3aa925ee7a447
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rustpkg.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
% Rustpkg Reference Manual
2+
3+
# Introduction
4+
5+
This document is the reference manual for the Rustpkg packaging and build tool for the Rust programming language.
6+
7+
## Disclaimer
8+
9+
Rustpkg is a work in progress, as is this reference manual.
10+
If the actual behavior of rustpkg differs from the behavior described in this reference,
11+
that reflects either an incompleteness or a bug in rustpkg.
12+
13+
# Package searching
14+
15+
rustpkg searches for packages using the `RUST_PATH` environment variable,
16+
which is a colon-separated list (semicolon-separated on Windows) of directories.
17+
18+
Each directory in this list is a *workspace* for rustpkg.
19+
20+
`RUST_PATH` implicitly contains an entry for `./.rust` (as well as
21+
`../.rust`, `../../.rust`,
22+
and so on for every parent of `.` up to the filesystem root).
23+
That means that if `RUST_PATH` is not set,
24+
then rustpkg will still search for workspaces in `./.rust` and so on
25+
26+
Each workspace may contain one or more packages.
27+
28+
# Package structure
29+
30+
A valid workspace must contain each of the following subdirectories:
31+
32+
* 'src/': contains one subdirectory per package. Each subdirectory contains source files for a given package.
33+
34+
For example, if `foo` is a workspace containing the package `bar`,
35+
then `foo/src/bar/main.rs` could be the `main` entry point for
36+
building a `bar` executable.
37+
* 'lib/': `rustpkg install` installs libraries into a target-specific subdirectory of this directory.
38+
39+
For example, on a 64-bit machine running Mac OS X,
40+
if `foo` is a workspace containing the package `bar`,
41+
rustpkg will install libraries for bar to `foo/lib/x86_64-apple-darwin/`.
42+
The libraries will have names of the form `foo/lib/x86_64-apple-darwin/libbar-[hash].dylib`,
43+
where [hash] is a hash of the package ID.
44+
* 'bin/': `rustpkg install` installs executable binaries into a target-specific subdirectory of this directory.
45+
46+
For example, on a 64-bit machine running Mac OS X,
47+
if `foo` is a workspace, containing the package `bar`,
48+
rustpkg will install executables for `bar` to
49+
`foo/bin/x86_64-apple-darwin/`.
50+
The executables will have names of the form `foo/bin/x86_64-apple-darwin/bar`.
51+
* 'build/': `rustpkg build` stores temporary build artifacts in a target-specific subdirectory of this directory.
52+
53+
For example, on a 64-bit machine running Mac OS X,
54+
if `foo` is a workspace containing the package `bar` and `foo/src/bar/main.rs` exists,
55+
then `rustpkg build` will create `foo/build/x86_64-apple-darwin/bar/main.o`.
56+
57+
# Package identifiers
58+
59+
A package identifier identifies a package uniquely.
60+
A package can be stored in a workspace on the local file system,
61+
or on a remote Web server, in which case the package ID resembles a URL.
62+
For example, `github.com/mozilla/rust` is a package ID
63+
that would refer to the git repository browsable at `http://github.com/mozilla/rust`.
64+
65+
## Source files
66+
67+
rustpkg searches for four different fixed filenames in order to determine the crates to build:
68+
69+
* `main.rs`: Assumed to be a main entry point for building an executable.
70+
* `lib.rs`: Assumed to be a library crate.
71+
* `test.rs`: Assumed to contain tests declared with the `#[test]` attribute.
72+
* `bench.rs`: Assumed to contain benchmarks declared with the `#[bench]` attribute.
73+
74+
# Custom build scripts
75+
76+
A file called `pkg.rs` at the root level in a workspace is called a *package script*.
77+
If a package script exists, rustpkg executes it to build the package
78+
rather than inferring crates as described previously.
79+
80+
# Command reference
81+
82+
## build
83+
84+
`rustpkg build foo` searches for a package with ID `foo`
85+
and builds it in any workspace(s) where it finds one.
86+
Supposing such packages are found in workspaces X, Y, and Z,
87+
the command leaves behind files in `X`'s, `Y`'s, and `Z`'s `build` directories,
88+
but not in their `lib` or `bin` directories.
89+
90+
## clean
91+
92+
`rustpkg clean foo` deletes the contents of `foo`'s `build` directory.
93+
94+
## install
95+
96+
`rustpkg install foo` builds the libraries and/or executables that are targets for `foo`,
97+
and then installs them either into `foo`'s `lib` and `bin` directories,
98+
or into the `lib` and `bin` subdirectories of the first entry in `RUST_PATH`.
99+
100+
## test
101+
102+
`rustpkg test foo` builds `foo`'s `test.rs` file if necessary,
103+
then runs the resulting test executable.

branches/try2/mk/docs.mk

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,20 @@ doc/rust.pdf: doc/rust.tex
8181
endif
8282
endif
8383

84+
DOCS += doc/rustpkg.html
85+
doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css doc/manual.css
86+
@$(call E, pandoc: $@)
87+
$(Q)$(CFG_NODE) $(S)doc/prep.js --highlight $< | \
88+
"$(CFG_PANDOC)" \
89+
--standalone --toc \
90+
--section-divs \
91+
--number-sections \
92+
--from=markdown --to=html \
93+
--css=rust.css \
94+
--css=manual.css \
95+
--include-before-body=doc/version_info.html \
96+
--output=$@
97+
8498
######################################################################
8599
# Node (tutorial related)
86100
######################################################################

branches/try2/src/libcore/num/strconv.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,6 @@ mod test {
655655
use option::*;
656656

657657
#[test]
658-
#[ignore(reason = "fails in x86")]
659658
fn from_str_ignore_underscores() {
660659
let s : Option<u8> = from_str_common("__1__", 2, false, false, false,
661660
ExpNone, false, true);

branches/try2/src/librustc/back/link.rs

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -61,32 +61,23 @@ pub fn llvm_err(sess: Session, msg: ~str) -> ! {
6161
6262
pub fn WriteOutputFile(sess: Session,
6363
PM: lib::llvm::PassManagerRef, M: ModuleRef,
64-
Triple: &str,
65-
Feature: &str,
66-
Output: &str,
64+
Triple: *c_char,
6765
// FIXME: When #2334 is fixed, change
6866
// c_uint to FileType
69-
FileType: c_uint,
67+
Output: *c_char, FileType: c_uint,
7068
OptLevel: c_int,
7169
EnableSegmentedStacks: bool) {
7270
unsafe {
73-
do str::as_c_str(Triple) |Triple| {
74-
do str::as_c_str(Feature) |Feature| {
75-
do str::as_c_str(Output) |Output| {
76-
let result = llvm::LLVMRustWriteOutputFile(
77-
PM,
78-
M,
79-
Triple,
80-
Feature,
81-
Output,
82-
FileType,
83-
OptLevel,
84-
EnableSegmentedStacks);
85-
if (!result) {
86-
llvm_err(sess, ~"Could not write output");
87-
}
88-
}
89-
}
71+
let result = llvm::LLVMRustWriteOutputFile(
72+
PM,
73+
M,
74+
Triple,
75+
Output,
76+
FileType,
77+
OptLevel,
78+
EnableSegmentedStacks);
79+
if (!result) {
80+
llvm_err(sess, ~"Could not write output");
9081
}
9182
}
9283
}
@@ -319,49 +310,66 @@ pub mod write {
319310
llvm::LLVMWriteBitcodeToFile(llmod, buf)
320311
});
321312
pm = mk_pass_manager();
322-
323313
// Save the assembly file if -S is used
314+
324315
if output_type == output_type_assembly {
325-
WriteOutputFile(
326-
sess,
327-
pm.llpm,
328-
llmod,
316+
let _: () = str::as_c_str(
329317
sess.targ_cfg.target_strs.target_triple,
330-
opts.target_feature,
331-
output.to_str(),
332-
lib::llvm::AssemblyFile as c_uint,
333-
CodeGenOptLevel,
334-
true);
318+
|buf_t| {
319+
str::as_c_str(output.to_str(), |buf_o| {
320+
WriteOutputFile(
321+
sess,
322+
pm.llpm,
323+
llmod,
324+
buf_t,
325+
buf_o,
326+
lib::llvm::AssemblyFile as c_uint,
327+
CodeGenOptLevel,
328+
true)
329+
})
330+
});
335331
}
336332

333+
337334
// Save the object file for -c or --save-temps alone
338335
// This .o is needed when an exe is built
339336
if output_type == output_type_object ||
340337
output_type == output_type_exe {
341-
WriteOutputFile(
342-
sess,
343-
pm.llpm,
344-
llmod,
338+
let _: () = str::as_c_str(
345339
sess.targ_cfg.target_strs.target_triple,
346-
opts.target_feature,
347-
output.to_str(),
348-
lib::llvm::ObjectFile as c_uint,
349-
CodeGenOptLevel,
350-
true);
340+
|buf_t| {
341+
str::as_c_str(output.to_str(), |buf_o| {
342+
WriteOutputFile(
343+
sess,
344+
pm.llpm,
345+
llmod,
346+
buf_t,
347+
buf_o,
348+
lib::llvm::ObjectFile as c_uint,
349+
CodeGenOptLevel,
350+
true)
351+
})
352+
});
351353
}
352354
} else {
353355
// If we aren't saving temps then just output the file
354356
// type corresponding to the '-c' or '-S' flag used
355-
WriteOutputFile(
356-
sess,
357-
pm.llpm,
358-
llmod,
357+
358+
let _: () = str::as_c_str(
359359
sess.targ_cfg.target_strs.target_triple,
360-
opts.target_feature,
361-
output.to_str(),
362-
FileType as c_uint,
363-
CodeGenOptLevel,
364-
true);
360+
|buf_t| {
361+
str::as_c_str(output.to_str(), |buf_o| {
362+
WriteOutputFile(
363+
sess,
364+
pm.llpm,
365+
llmod,
366+
buf_t,
367+
buf_o,
368+
FileType as c_uint,
369+
CodeGenOptLevel,
370+
true)
371+
})
372+
});
365373
}
366374
// Clean up and return
367375

branches/try2/src/librustc/driver/driver.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,6 @@ pub fn build_session_options(binary: @~str,
599599
let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot");
600600
let sysroot_opt = sysroot_opt.map(|m| Path(*m));
601601
let target_opt = getopts::opt_maybe_str(matches, ~"target");
602-
let target_feature_opt = getopts::opt_maybe_str(matches, ~"target-feature");
603602
let save_temps = getopts::opt_present(matches, ~"save-temps");
604603
match output_type {
605604
// unless we're emitting huamn-readable assembly, omit comments.
@@ -638,10 +637,6 @@ pub fn build_session_options(binary: @~str,
638637
None => host_triple(),
639638
Some(s) => s
640639
};
641-
let target_feature = match target_feature_opt {
642-
None => ~"",
643-
Some(s) => s
644-
};
645640
646641
let addl_lib_search_paths =
647642
getopts::opt_strs(matches, ~"L")
@@ -664,7 +659,6 @@ pub fn build_session_options(binary: @~str,
664659
addl_lib_search_paths: addl_lib_search_paths,
665660
maybe_sysroot: sysroot_opt,
666661
target_triple: target,
667-
target_feature: target_feature,
668662
cfg: cfg,
669663
binary: binary,
670664
test: test,
@@ -775,9 +769,6 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
775769
~"Target triple cpu-manufacturer-kernel[-os]
776770
to compile for (see chapter 3.4 of http://www.sourceware.org/autobook/
777771
for detail)", ~"TRIPLE"),
778-
optopt(~"", ~"target-feature",
779-
~"Target specific attributes (llc -mattr=help
780-
for detail)", ~"FEATURE"),
781772
optopt(~"", ~"android-cross-path",
782773
~"The path to the Android NDK", "PATH"),
783774
optmulti(~"W", ~"warn",

branches/try2/src/librustc/driver/session.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ pub struct options {
126126
addl_lib_search_paths: ~[Path],
127127
maybe_sysroot: Option<Path>,
128128
target_triple: ~str,
129-
target_feature: ~str,
130129
// User-specified cfg meta items. The compiler itself will add additional
131130
// items to the crate config, and during parsing the entire crate config
132131
// will be added to the crate AST node. This should not be used for
@@ -303,7 +302,6 @@ pub fn basic_options() -> @options {
303302
addl_lib_search_paths: ~[],
304303
maybe_sysroot: None,
305304
target_triple: host_triple(),
306-
target_feature: ~"",
307305
cfg: ~[],
308306
binary: @~"rustc",
309307
test: false,

branches/try2/src/librustc/front/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ fn mk_std(cx: &TestCtxt) -> @ast::view_item {
274274
ast::view_item_use(
275275
~[@nospan(ast::view_path_simple(id_std,
276276
path_node(~[id_std]),
277+
ast::type_value_ns,
277278
cx.sess.next_node_id()))])
278279
} else {
279280
ast::view_item_extern_mod(id_std, ~[@mi],

branches/try2/src/librustc/lib/llvm.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1799,10 +1799,9 @@ pub mod llvm {
17991799
pub unsafe fn LLVMRustWriteOutputFile(PM: PassManagerRef,
18001800
M: ModuleRef,
18011801
Triple: *c_char,
1802-
Feature: *c_char,
1803-
Output: *c_char,
18041802
// FIXME: When #2334 is fixed,
18051803
// change c_uint to FileType
1804+
Output: *c_char,
18061805
FileType: c_uint,
18071806
OptLevel: c_int,
18081807
EnableSegmentedStacks: bool)

branches/try2/src/librustc/middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ pub impl Resolver {
14131413
14141414
let mut module_path = ~[];
14151415
match view_path.node {
1416-
view_path_simple(_, full_path, _) => {
1416+
view_path_simple(_, full_path, _, _) => {
14171417
let path_len = full_path.idents.len();
14181418
assert!(path_len != 0);
14191419
@@ -1435,7 +1435,7 @@ pub impl Resolver {
14351435
// Build up the import directives.
14361436
let module_ = self.get_module_from_parent(parent);
14371437
match view_path.node {
1438-
view_path_simple(binding, full_path, _) => {
1438+
view_path_simple(binding, full_path, _, _) => {
14391439
let source_ident = *full_path.idents.last();
14401440
let subclass = @SingleImport(binding,
14411441
source_ident);

0 commit comments

Comments
 (0)