@@ -13,36 +13,70 @@ pub struct Manifest {
13
13
impl Manifest {
14
14
/// Builds the rustc codegen c library
15
15
pub fn prepare ( & self ) {
16
- cprintln ! ( "<b>[BUILD]</b> codegen backend" ) ;
16
+ // Build codegen backend
17
+ if self . verbose {
18
+ cprintln ! ( "<b>[BUILD]</b> preparing codegen backend" ) ;
19
+ cprintln ! ( " target: {}" , self . codegen_backend( ) . display( ) ) ;
20
+ } else {
21
+ cprintln ! ( "<b>[BUILD]</b> codegen backend" ) ;
22
+ }
23
+
17
24
let mut command = Command :: new ( "cargo" ) ;
18
25
command. arg ( "build" ) . args ( [ "--manifest-path" , "crates/Cargo.toml" ] ) ;
19
26
if self . verbose {
20
- command. args ( [ "-F" , "debug" ] ) ;
27
+ command. args ( [ "-v" ] ) ;
28
+ cprintln ! ( " command: {}" , format!( "{:?}" , command) . replace( '"' , "" ) ) ;
21
29
}
22
30
if self . release {
23
31
command. arg ( "--release" ) ;
24
32
}
25
33
log:: debug!( "running {:?}" , command) ;
26
- command. status ( ) . unwrap ( ) ;
34
+ let status = command. status ( ) . unwrap ( ) ;
35
+ if self . verbose && status. success ( ) {
36
+ cprintln ! ( " <g>success</g>" ) ;
37
+ }
38
+
39
+ // Build runtime library
40
+ if self . verbose {
41
+ cprintln ! ( "<b>[BUILD]</b> preparing librust_runtime" ) ;
42
+ cprintln ! ( " output: {}" , self . out_dir. display( ) ) ;
43
+ } else {
44
+ cprintln ! ( "<b>[BUILD]</b> librust_runtime" ) ;
45
+ }
27
46
28
- cprintln ! ( "<b>[BUILD]</b> librust_runtime" ) ;
29
47
std:: fs:: create_dir_all ( & self . out_dir ) . unwrap ( ) ;
30
48
let cc = std:: env:: var ( "CC" ) . unwrap_or ( "clang" . to_string ( ) ) ;
49
+
50
+ // Compile runtime.c
31
51
let mut command = Command :: new ( & cc) ;
32
52
command
33
53
. arg ( "rust_runtime/rust_runtime.c" )
34
54
. arg ( "-o" )
35
55
. arg ( self . out_dir . join ( "rust_runtime.o" ) )
36
56
. arg ( "-c" ) ;
57
+ if self . verbose {
58
+ cprintln ! ( " compile: {}" , format!( "{:?}" , command) . replace( '"' , "" ) ) ;
59
+ }
37
60
log:: debug!( "running {:?}" , command) ;
38
- command. status ( ) . unwrap ( ) ;
61
+ let status = command. status ( ) . unwrap ( ) ;
62
+ if self . verbose && status. success ( ) {
63
+ cprintln ! ( " <g>success</g>" ) ;
64
+ }
65
+
66
+ // Create static library
39
67
let mut command = Command :: new ( "ar" ) ;
40
68
command
41
69
. arg ( "rcs" )
42
70
. arg ( self . out_dir . join ( "librust_runtime.a" ) )
43
71
. arg ( self . out_dir . join ( "rust_runtime.o" ) ) ;
72
+ if self . verbose {
73
+ cprintln ! ( " archive: {}" , format!( "{:?}" , command) . replace( '"' , "" ) ) ;
74
+ }
44
75
log:: debug!( "running {:?}" , command) ;
45
- command. status ( ) . unwrap ( ) ;
76
+ let status = command. status ( ) . unwrap ( ) ;
77
+ if self . verbose && status. success ( ) {
78
+ cprintln ! ( " <g>success</g>" ) ;
79
+ }
46
80
}
47
81
48
82
/// The path to the rustc codegen c library
0 commit comments