Skip to content

Commit 8347d55

Browse files
committed
---
yaml --- r: 80755 b: refs/heads/try c: 2dec95e h: refs/heads/master i: 80753: 010e5e4 80751: a5d95ee v: v3
1 parent 5a1bf2d commit 8347d55

File tree

10 files changed

+51
-125
lines changed

10 files changed

+51
-125
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 4c6bf4872012c010f84dc7fa2cdfe87522533f89
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cbd1eefbd350797b783df119fed7956d7e1c74ad
5-
refs/heads/try: 150b4ffcccbaf6f85b4b3f5be76305edb963689f
5+
refs/heads/try: 2dec95e417a71e1053d6b666b12d9cfdceaccb3c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/rustpkg.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,13 @@ A valid workspace must contain each of the following subdirectories:
5252
rustpkg will install libraries for bar to `foo/lib/x86_64-apple-darwin/`.
5353
The libraries will have names of the form `foo/lib/x86_64-apple-darwin/libbar-[hash].dylib`,
5454
where [hash] is a hash of the package ID.
55-
* 'bin/': `rustpkg install` installs executable binaries into this directory.
55+
* 'bin/': `rustpkg install` installs executable binaries into a target-specific subdirectory of this directory.
5656

57-
For example, rustpkg will install executables for `bar` to
58-
`foo/bin`.
59-
The executables will have names of the form `foo/bin/bar`.
57+
For example, on a 64-bit machine running Mac OS X,
58+
if `foo` is a workspace, containing the package `bar`,
59+
rustpkg will install executables for `bar` to
60+
`foo/bin/x86_64-apple-darwin/`.
61+
The executables will have names of the form `foo/bin/x86_64-apple-darwin/bar`.
6062
* 'build/': `rustpkg build` stores temporary build artifacts in a target-specific subdirectory of this directory.
6163

6264
For example, on a 64-bit machine running Mac OS X,
@@ -83,12 +85,6 @@ rustpkg also interprets any dependencies on such a package ID literally
8385
Thus, `github.com/mozilla/rust#5c4cd30f80` is also a valid package ID,
8486
since git can deduce that 5c4cd30f80 refers to a revision of the desired repository.
8587

86-
A package identifier can name a subdirectory of another package.
87-
For example, if `foo` is a workspace, and `foo/src/bar/lib.rs` exists,
88-
as well as `foo/src/bar/extras/baz/lib.rs`,
89-
then both `bar` and `bar/extras/baz` are valid package identifiers
90-
in the workspace `foo`.
91-
9288
## Source files
9389

9490
rustpkg searches for four different fixed filenames in order to determine the crates to build:
@@ -144,11 +140,9 @@ but not in their `lib` or `bin` directories.
144140

145141
## install
146142

147-
`rustpkg install foo` builds the libraries and/or executables that are targets for `foo`.
148-
If `RUST_PATH` is declared as an environment variable, then rustpkg installs the
149-
libraries and executables into the `lib` and `bin` subdirectories
150-
of the first entry in `RUST_PATH`.
151-
Otherwise, it installs them into `foo`'s `lib` and `bin` directories.
143+
`rustpkg install foo` builds the libraries and/or executables that are targets for `foo`,
144+
and then installs them either into `foo`'s `lib` and `bin` directories,
145+
or into the `lib` and `bin` subdirectories of the first entry in `RUST_PATH`.
152146

153147
## test
154148

branches/try/src/librustc/metadata/filesearch.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ pub fn mk_filesearch(maybe_sysroot: &Option<@Path>,
7777
if !found {
7878
let rustpath = rust_path();
7979
for path in rustpath.iter() {
80-
let tlib_path = make_rustpkg_target_lib_path(path, self.target_triple);
81-
debug!("is %s in visited_dirs? %?", tlib_path.to_str(),
82-
visited_dirs.contains(&tlib_path.to_str()));
80+
debug!("is %s in visited_dirs? %?",
81+
path.push("lib").to_str(),
82+
visited_dirs.contains(&path.push("lib").to_str()));
8383

84-
if !visited_dirs.contains(&tlib_path.to_str()) {
85-
visited_dirs.insert(tlib_path.to_str());
84+
if !visited_dirs.contains(&path.push("lib").to_str()) {
85+
visited_dirs.insert(path.push("lib").to_str());
8686
// Don't keep searching the RUST_PATH if one match turns up --
8787
// if we did, we'd get a "multiple matching crates" error
88-
match f(&tlib_path) {
88+
match f(&path.push("lib")) {
8989
FileMatches => {
9090
break;
9191
}
@@ -145,11 +145,6 @@ fn make_target_lib_path(sysroot: &Path,
145145
sysroot.push_rel(&relative_target_lib_path(target_triple))
146146
}
147147

148-
fn make_rustpkg_target_lib_path(dir: &Path,
149-
target_triple: &str) -> Path {
150-
dir.push_rel(&Path(libdir()).push(target_triple.to_owned()))
151-
}
152-
153148
fn get_or_default_sysroot() -> Path {
154149
match os::self_exe_path() {
155150
option::Some(ref p) => (*p).pop(),

branches/try/src/librustc/middle/trans/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -655,9 +655,9 @@ pub fn FastCall(cx: @mut Block, Fn: ValueRef, Args: &[ValueRef]) -> ValueRef {
655655
}
656656

657657
pub fn CallWithConv(cx: @mut Block, Fn: ValueRef, Args: &[ValueRef],
658-
Conv: CallConv, sret: bool) -> ValueRef {
658+
Conv: CallConv) -> ValueRef {
659659
if cx.unreachable { return _UndefReturn(cx, Fn); }
660-
B(cx).call_with_conv(Fn, Args, Conv, sret)
660+
B(cx).call_with_conv(Fn, Args, Conv)
661661
}
662662

663663
pub fn AtomicFence(cx: @mut Block, order: AtomicOrdering) {

branches/try/src/librustc/middle/trans/builder.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use lib::llvm::llvm;
1313
use lib::llvm::{CallConv, AtomicBinOp, AtomicOrdering, AsmDialect};
1414
use lib::llvm::{Opcode, IntPredicate, RealPredicate, False};
1515
use lib::llvm::{ValueRef, BasicBlockRef, BuilderRef, ModuleRef};
16-
use lib::llvm::{StructRetAttribute};
1716
use middle::trans::base;
1817
use middle::trans::common::*;
1918
use middle::trans::machine::llalign_of_min;
@@ -779,9 +778,14 @@ impl Builder {
779778

780779
pub fn call(&self, llfn: ValueRef, args: &[ValueRef]) -> ValueRef {
781780
self.count_insn("call");
781+
782+
debug!("Call(llfn=%s, args=%?)",
783+
self.ccx.tn.val_to_str(llfn),
784+
args.map(|arg| self.ccx.tn.val_to_str(*arg)));
785+
782786
do args.as_imm_buf |ptr, len| {
783787
unsafe {
784-
llvm::LLVMBuildCall(self.llbuilder, llfn, ptr, len as c_uint, noname())
788+
llvm::LLVMBuildCall(self.llbuilder, llfn, ptr, len as c_uint, noname())
785789
}
786790
}
787791
}
@@ -797,16 +801,12 @@ impl Builder {
797801
}
798802

799803
pub fn call_with_conv(&self, llfn: ValueRef, args: &[ValueRef],
800-
conv: CallConv, sret: bool) -> ValueRef {
804+
conv: CallConv) -> ValueRef {
801805
self.count_insn("callwithconv");
802806
unsafe {
803807
let v = llvm::LLVMBuildCall(self.llbuilder, llfn, vec::raw::to_ptr(args),
804808
args.len() as c_uint, noname());
805809
lib::llvm::SetInstructionCallConv(v, conv);
806-
if sret {
807-
let return_slot = 1;
808-
llvm::LLVMAddInstrAttribute(v, return_slot, StructRetAttribute as c_uint);
809-
}
810810
v
811811
}
812812
}

branches/try/src/librustc/middle/trans/foreign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ pub fn trans_native_call(bcx: @mut Block,
266266
}
267267
};
268268

269-
let llforeign_retval = CallWithConv(bcx, llfn, llargs_foreign, cc, fn_type.sret);
269+
let llforeign_retval = CallWithConv(bcx, llfn, llargs_foreign, cc);
270270

271271
// If the function we just called does not use an outpointer,
272272
// store the result into the rust outpointer. Cast the outpointer

branches/try/src/librustc/middle/trans/intrinsic.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,11 +402,6 @@ pub fn trans_intrinsic(ccx: @mut CrateContext,
402402
Ret(bcx, morestack_addr);
403403
}
404404
"offset" => {
405-
let ptr = get_param(decl, first_real_arg);
406-
let offset = get_param(decl, first_real_arg + 1);
407-
Ret(bcx, GEP(bcx, ptr, [offset]));
408-
}
409-
"offset_inbounds" => {
410405
let ptr = get_param(decl, first_real_arg);
411406
let offset = get_param(decl, first_real_arg + 1);
412407
Ret(bcx, InBoundsGEP(bcx, ptr, [offset]));

branches/try/src/librustpkg/path_util.rs

Lines changed: 11 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub use package_id::PkgId;
1414
pub use target::{OutputType, Main, Lib, Test, Bench, Target, Build, Install};
1515
pub use version::{Version, NoVersion, split_version_general, try_parsing_version};
1616
pub use rustc::metadata::filesearch::rust_path;
17-
use rustc::driver::driver::host_triple;
1817

1918
use std::libc::consts::os::posix88::{S_IRUSR, S_IWUSR, S_IXUSR};
2019
use std::os::mkdir_recursive;
@@ -95,29 +94,10 @@ pub fn workspace_contains_package_id_(pkgid: &PkgId, workspace: &Path,
9594
found
9695
}
9796

98-
/// Return the target-specific build subdirectory, pushed onto `base`;
99-
/// doesn't check that it exists or create it
100-
pub fn target_build_dir(workspace: &Path) -> Path {
101-
workspace.push("build").push(host_triple())
102-
}
103-
104-
/// Return the target-specific lib subdirectory, pushed onto `base`;
105-
/// doesn't check that it exists or create it
106-
fn target_lib_dir(workspace: &Path) -> Path {
107-
workspace.push("lib").push(host_triple())
108-
}
109-
110-
/// Return the bin subdirectory, pushed onto `base`;
111-
/// doesn't check that it exists or create it
112-
/// note: this isn't target-specific
113-
fn target_bin_dir(workspace: &Path) -> Path {
114-
workspace.push("bin")
115-
}
116-
11797
/// Figure out what the executable name for <pkgid> in <workspace>'s build
11898
/// directory is, and if the file exists, return it.
11999
pub fn built_executable_in_workspace(pkgid: &PkgId, workspace: &Path) -> Option<Path> {
120-
let mut result = target_build_dir(workspace);
100+
let mut result = workspace.push("build");
121101
// should use a target-specific subdirectory
122102
result = mk_output_path(Main, Build, pkgid, result);
123103
debug!("built_executable_in_workspace: checking whether %s exists",
@@ -144,7 +124,7 @@ pub fn built_bench_in_workspace(pkgid: &PkgId, workspace: &Path) -> Option<Path>
144124
}
145125

146126
fn output_in_workspace(pkgid: &PkgId, workspace: &Path, what: OutputType) -> Option<Path> {
147-
let mut result = target_build_dir(workspace);
127+
let mut result = workspace.push("build");
148128
// should use a target-specific subdirectory
149129
result = mk_output_path(what, Build, pkgid, result);
150130
debug!("output_in_workspace: checking whether %s exists",
@@ -192,21 +172,11 @@ pub fn library_in_workspace(path: &Path, short_name: &str, where: Target,
192172
prefix = %s", short_name, where, workspace.to_str(), prefix);
193173

194174
let dir_to_search = match where {
195-
Build => target_build_dir(workspace).push_rel(path),
196-
Install => target_lib_dir(workspace)
175+
Build => workspace.push(prefix).push_rel(path),
176+
Install => workspace.push(prefix)
197177
};
198-
199-
library_in(short_name, version, &dir_to_search)
200-
}
201-
202-
// rustc doesn't use target-specific subdirectories
203-
pub fn system_library(sysroot: &Path, lib_name: &str) -> Option<Path> {
204-
library_in(lib_name, &NoVersion, &sysroot.push("lib"))
205-
}
206-
207-
fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Option<Path> {
208178
debug!("Listing directory %s", dir_to_search.to_str());
209-
let dir_contents = os::list_dir(dir_to_search);
179+
let dir_contents = os::list_dir(&dir_to_search);
210180
debug!("dir has %? entries", dir_contents.len());
211181

212182
let lib_prefix = fmt!("%s%s", os::consts::DLL_PREFIX, short_name);
@@ -328,10 +298,9 @@ fn target_file_in_workspace(pkgid: &PkgId, workspace: &Path,
328298
};
329299
// Artifacts in the build directory live in a package-ID-specific subdirectory,
330300
// but installed ones don't.
331-
let result = match (where, what) {
332-
(Build, _) => target_build_dir(workspace).push_rel(&pkgid.path),
333-
(Install, Lib) => target_lib_dir(workspace),
334-
(Install, _) => target_bin_dir(workspace)
301+
let result = match where {
302+
Build => workspace.push(subdir).push_rel(&pkgid.path),
303+
_ => workspace.push(subdir)
335304
};
336305
if !os::path_exists(&result) && !mkdir_recursive(&result, U_RWX) {
337306
cond.raise((result.clone(), fmt!("target_file_in_workspace couldn't \
@@ -346,10 +315,10 @@ fn target_file_in_workspace(pkgid: &PkgId, workspace: &Path,
346315
pub fn build_pkg_id_in_workspace(pkgid: &PkgId, workspace: &Path) -> Path {
347316
use conditions::bad_path::cond;
348317

349-
let mut result = target_build_dir(workspace);
318+
let mut result = workspace.push("build");
319+
// n.b. Should actually use a target-specific
320+
// subdirectory of build/
350321
result = result.push_rel(&pkgid.path);
351-
debug!("Creating build dir %s for package id %s", result.to_str(),
352-
pkgid.to_str());
353322
if os::path_exists(&result) || os::mkdir_recursive(&result, U_RWX) {
354323
result
355324
}

branches/try/src/librustpkg/tests.rs

Lines changed: 11 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use path_util::{target_executable_in_workspace, target_test_in_workspace,
2727
target_bench_in_workspace, make_dir_rwx, U_RWX,
2828
library_in_workspace, installed_library_in_workspace,
2929
built_bench_in_workspace, built_test_in_workspace,
30-
built_library_in_workspace, built_executable_in_workspace, target_build_dir};
30+
built_library_in_workspace, built_executable_in_workspace};
3131
use rustc::back::link::get_cc_prog;
3232
use rustc::metadata::filesearch::rust_path;
3333
use rustc::driver::driver::{build_session, build_session_options, host_triple, optgroups};
@@ -382,7 +382,7 @@ fn llvm_bitcode_file_exists(repo: &Path, short_name: &str) -> bool {
382382
}
383383

384384
fn file_exists(repo: &Path, short_name: &str, extension: &str) -> bool {
385-
os::path_exists(&target_build_dir(repo).push_many([short_name.to_owned(),
385+
os::path_exists(&repo.push_many([~"build", short_name.to_owned(),
386386
fmt!("%s.%s", short_name, extension)]))
387387
}
388388

@@ -433,7 +433,7 @@ fn lib_output_file_name(workspace: &Path, parent: &str, short_name: &str) -> Pat
433433
}
434434

435435
fn output_file_name(workspace: &Path, short_name: &str) -> Path {
436-
target_build_dir(workspace).push(short_name).push(fmt!("%s%s", short_name, os::EXE_SUFFIX))
436+
workspace.push("build").push(short_name).push(fmt!("%s%s", short_name, os::EXE_SUFFIX))
437437
}
438438

439439
fn touch_source_file(workspace: &Path, pkgid: &PkgId) {
@@ -657,10 +657,11 @@ fn test_package_version() {
657657
None => false
658658
});
659659
assert!(built_executable_in_workspace(&temp_pkg_id, &ws)
660-
== Some(target_build_dir(&ws).push_many([~"mockgithub.com",
661-
~"catamorphism",
662-
~"test_pkg_version",
663-
~"test_pkg_version"])));
660+
== Some(ws.push("build").
661+
push("mockgithub.com").
662+
push("catamorphism").
663+
push("test_pkg_version").
664+
push("test_pkg_version")));
664665
}
665666
666667
#[test]
@@ -754,7 +755,7 @@ fn package_script_with_default_build() {
754755
}
755756
command_line_test([~"install", ~"fancy-lib"], &dir);
756757
assert_lib_exists(&dir, &Path("fancy-lib"), NoVersion);
757-
assert!(os::path_exists(&target_build_dir(&dir).push_many([~"fancy-lib", ~"generated.rs"])));
758+
assert!(os::path_exists(&dir.push("build").push("fancy-lib").push("generated.rs")));
758759
}
759760
760761
#[test]
@@ -1120,7 +1121,7 @@ fn test_import_rustpkg() {
11201121
"extern mod rustpkg; fn main() {}");
11211122
command_line_test([~"build", ~"foo"], &workspace);
11221123
debug!("workspace = %s", workspace.to_str());
1123-
assert!(os::path_exists(&target_build_dir(&workspace).push("foo").push(fmt!("pkg%s",
1124+
assert!(os::path_exists(&workspace.push("build").push("foo").push(fmt!("pkg%s",
11241125
os::EXE_SUFFIX))));
11251126
}
11261127

@@ -1132,7 +1133,7 @@ fn test_macro_pkg_script() {
11321133
"extern mod rustpkg; fn main() { debug!(\"Hi\"); }");
11331134
command_line_test([~"build", ~"foo"], &workspace);
11341135
debug!("workspace = %s", workspace.to_str());
1135-
assert!(os::path_exists(&target_build_dir(&workspace).push("foo").push(fmt!("pkg%s",
1136+
assert!(os::path_exists(&workspace.push("build").push("foo").push(fmt!("pkg%s",
11361137
os::EXE_SUFFIX))));
11371138
}
11381139

@@ -1621,33 +1622,6 @@ fn test_install_to_rust_path() {
16211622
assert!(!executable_exists(&second_workspace, "foo"));
16221623
}
16231624

1624-
fn test_target_specific_build_dir() {
1625-
let p_id = PkgId::new("foo");
1626-
let workspace = create_local_package(&p_id);
1627-
command_line_test([test_sysroot().to_str(),
1628-
~"build",
1629-
~"foo"],
1630-
&workspace);
1631-
assert!(os::path_is_dir(&target_build_dir(&workspace)));
1632-
assert!(built_executable_exists(&workspace, "foo"));
1633-
assert!(os::list_dir(&workspace.push("build")).len() == 1);
1634-
}
1635-
1636-
#[test]
1637-
fn test_target_specific_install_dir() {
1638-
let p_id = PkgId::new("foo");
1639-
let workspace = create_local_package(&p_id);
1640-
command_line_test([test_sysroot().to_str(),
1641-
~"install",
1642-
~"foo"],
1643-
&workspace);
1644-
assert!(os::path_is_dir(&workspace.push("lib").push(host_triple())));
1645-
assert_lib_exists(&workspace, &Path("foo"), NoVersion);
1646-
assert!(os::list_dir(&workspace.push("lib")).len() == 1);
1647-
assert!(os::path_is_dir(&workspace.push("bin")));
1648-
assert_executable_exists(&workspace, "foo");
1649-
}
1650-
16511625
/// Returns true if p exists and is executable
16521626
fn is_executable(p: &Path) -> bool {
16531627
use std::libc::consts::os::posix88::{S_IXUSR};

branches/try/src/librustpkg/util.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use context::{in_target, StopBefore, Link, Assemble, BuildContext};
2323
use package_id::PkgId;
2424
use package_source::PkgSrc;
2525
use workspace::pkg_parent_workspaces;
26-
use path_util::{installed_library_in_workspace, U_RWX, rust_path, system_library, target_build_dir};
26+
use path_util::{installed_library_in_workspace, U_RWX, rust_path};
2727
use messages::error;
2828

2929
pub use target::{OutputType, Main, Lib, Bench, Test};
@@ -170,7 +170,7 @@ pub fn compile_input(context: &BuildContext,
170170
// tjc: by default, use the package ID name as the link name
171171
// not sure if we should support anything else
172172

173-
let out_dir = target_build_dir(workspace).push_rel(&pkg_id.path);
173+
let out_dir = workspace.push("build").push_rel(&pkg_id.path);
174174

175175
let binary = os::args()[0].to_managed();
176176

@@ -381,8 +381,7 @@ pub fn find_and_install_dependencies(context: &BuildContext,
381381
None => sess.str_of(lib_ident)
382382
};
383383
debug!("Finding and installing... %s", lib_name);
384-
// Check standard Rust library path first
385-
match system_library(&context.sysroot(), lib_name) {
384+
match installed_library_in_workspace(&Path(lib_name), &context.sysroot()) {
386385
Some(ref installed_path) => {
387386
debug!("It exists: %s", installed_path.to_str());
388387
// Say that [path for c] has a discovered dependency on

0 commit comments

Comments
 (0)