This repository was archived by the owner on Mar 4, 2024. It is now read-only.
File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -14,22 +14,23 @@ use std::process::Command;
14
14
use std:: str;
15
15
use tempfile:: Builder ;
16
16
17
- static PACKAGES : & [ & str ] = & [ "gio-2.0" , "gio-2.0-unix" ] ;
17
+ static PACKAGES : & [ & str ] = & [ "gio-2.0" ] ;
18
+ static PACKAGES_FALLBACK : & [ & str ] = & [ "gio-2.0-unix" ] ;
18
19
19
20
#[ derive( Clone , Debug ) ]
20
21
struct Compiler {
21
22
pub args : Vec < String > ,
22
23
}
23
24
24
25
impl Compiler {
25
- pub fn new ( ) -> Result < Compiler , Box < dyn Error > > {
26
+ pub fn new ( packages : & [ & str ] ) -> Result < Compiler , Box < dyn Error > > {
26
27
let mut args = get_var ( "CC" , "cc" ) ?;
27
28
args. push ( "-Wno-deprecated-declarations" . to_owned ( ) ) ;
28
29
// For %z support in printf when using MinGW.
29
30
args. push ( "-D__USE_MINGW_ANSI_STDIO" . to_owned ( ) ) ;
30
31
args. extend ( get_var ( "CFLAGS" , "" ) ?) ;
31
32
args. extend ( get_var ( "CPPFLAGS" , "" ) ?) ;
32
- args. extend ( pkg_config_cflags ( PACKAGES ) ?) ;
33
+ args. extend ( pkg_config_cflags ( packages ) ?) ;
33
34
Ok ( Compiler { args } )
34
35
}
35
36
@@ -131,7 +132,10 @@ fn cross_validate_constants_with_c() {
131
132
. prefix ( "abi" )
132
133
. tempdir ( )
133
134
. expect ( "temporary directory" ) ;
134
- let cc = Compiler :: new ( ) . expect ( "configured compiler" ) ;
135
+ let cc = match Compiler :: new ( PACKAKES ) {
136
+ Ok ( cc) => Ok ( cc) ,
137
+ Err ( _) => Compiler :: new ( PACKAGES_FALLBACK ) ,
138
+ } . expect ( "configured compiler" ) ;
135
139
136
140
assert_eq ! (
137
141
"1" ,
You can’t perform that action at this time.
0 commit comments