@@ -26,25 +26,35 @@ pub struct Context {
2626 // FOO/src/bar-0.1 instead of FOO). The flag doesn't affect where
2727 // rustpkg stores build artifacts.
2828 use_rust_path_hack : bool ,
29- // The root directory containing the Rust standard libraries
30- sysroot : Path
3129}
3230
3331#[ deriving( Clone ) ]
3432pub struct BuildContext {
3533 // Context for workcache
3634 workcache_context : workcache:: Context ,
37- // Everything else
38- context : Context
35+ // Parsed command line options
36+ context : Context ,
37+ // The root directory containing the Rust standard libraries
38+ sysroot : Path
3939}
4040
4141impl BuildContext {
4242 pub fn sysroot ( & self ) -> Path {
43- self . context . sysroot . clone ( )
43+ self . sysroot . clone ( )
4444 }
4545
46+ // Hack so that rustpkg can run either out of a rustc target dir,
47+ // or the host dir
4648 pub fn sysroot_to_use ( & self ) -> Path {
47- self . context . sysroot_to_use ( )
49+ if !in_target ( & self . sysroot ) {
50+ self . sysroot . clone ( )
51+ } else {
52+ let mut p = self . sysroot . clone ( ) ;
53+ p. pop ( ) ;
54+ p. pop ( ) ;
55+ p. pop ( ) ;
56+ p
57+ }
4858 }
4959
5060 /// Returns the flags to pass to rustc, as a vector of strings
@@ -131,28 +141,6 @@ pub enum StopBefore {
131141}
132142
133143impl Context {
134- pub fn sysroot ( & self ) -> Path {
135- self . sysroot . clone ( )
136- }
137-
138- /// Debugging
139- pub fn sysroot_str ( & self ) -> ~str {
140- self . sysroot . as_str ( ) . unwrap ( ) . to_owned ( )
141- }
142-
143- // Hack so that rustpkg can run either out of a rustc target dir,
144- // or the host dir
145- pub fn sysroot_to_use ( & self ) -> Path {
146- if !in_target ( & self . sysroot ) {
147- self . sysroot . clone ( )
148- } else {
149- let mut p = self . sysroot . clone ( ) ;
150- p. pop ( ) ;
151- p. pop ( ) ;
152- p. pop ( ) ;
153- p
154- }
155- }
156144
157145 /// Returns the flags to pass to rustc, as a vector of strings
158146 pub fn flag_strs ( & self ) -> ~[ ~str ] {
0 commit comments