File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -100,6 +100,10 @@ version = "0.3"
100
100
[dev-dependencies ]
101
101
walkdir = " 2"
102
102
103
+ [build-dependencies ]
104
+ lazy_static = " 1"
105
+ regex = " 1"
106
+
103
107
[workspace ]
104
108
members = [" download" ]
105
109
Original file line number Diff line number Diff line change 1
1
use std:: env;
2
2
3
+ include ! ( "src/dist/triple.rs" ) ;
4
+
5
+ pub fn from_build ( ) -> Result < PartialTargetTriple , String > {
6
+ let triple = if let Ok ( triple) = env:: var ( "RUSTUP_OVERRIDE_BUILD_TRIPLE" ) {
7
+ triple
8
+ } else {
9
+ env:: var ( "TARGET" ) . unwrap ( )
10
+ } ;
11
+ PartialTargetTriple :: new ( & triple) . ok_or ( triple)
12
+ }
13
+
3
14
fn main ( ) {
15
+ println ! ( "cargo:rerun-if-env-changed=RUSTUP_OVERRIDE_BUILD_TRIPLE" ) ;
16
+ println ! ( "cargo:rerun-if-env-changed=TARGET" ) ;
17
+ match from_build ( ) {
18
+ Ok ( triple) => eprintln ! ( "Computed build based partial target triple: {:#?}" , triple) ,
19
+ Err ( s) => {
20
+ eprintln ! ( "Unable to parse target '{}' as a PartialTargetTriple" , s) ;
21
+ eprintln ! (
22
+ "If you are attempting to bootstrap a new target you may need to adjust the\n \
23
+ permitted values found in src/dist/triple.rs"
24
+ ) ;
25
+ std:: process:: abort ( ) ;
26
+ }
27
+ }
4
28
let target = env:: var ( "TARGET" ) . unwrap ( ) ;
5
29
println ! ( "cargo:rustc-env=TARGET={}" , target) ;
6
30
}
You can’t perform that action at this time.
0 commit comments