@@ -8,34 +8,40 @@ const BOOTLOADER_VERSION: &str = env!("CARGO_PKG_VERSION");
8
8
fn main ( ) {
9
9
let out_dir = PathBuf :: from ( std:: env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
10
10
11
- let uefi_path = build_uefi_bootloader ( & out_dir) ;
12
- println ! (
13
- "cargo:rustc-env=UEFI_BOOTLOADER_PATH={}" ,
14
- uefi_path. display( )
15
- ) ;
11
+ #[ cfg( feature = "uefi" ) ]
12
+ {
13
+ let uefi_path = build_uefi_bootloader ( & out_dir) ;
14
+ println ! (
15
+ "cargo:rustc-env=UEFI_BOOTLOADER_PATH={}" ,
16
+ uefi_path. display( )
17
+ ) ;
18
+ }
16
19
17
- let bios_boot_sector_path = build_bios_boot_sector ( & out_dir) ;
18
- println ! (
19
- "cargo:rustc-env=BIOS_BOOT_SECTOR_PATH={}" ,
20
- bios_boot_sector_path. display( )
21
- ) ;
22
- let bios_stage_2_path = build_bios_stage_2 ( & out_dir) ;
23
- println ! (
24
- "cargo:rustc-env=BIOS_STAGE_2_PATH={}" ,
25
- bios_stage_2_path. display( )
26
- ) ;
20
+ #[ cfg( feature = "bios" ) ]
21
+ {
22
+ let bios_boot_sector_path = build_bios_boot_sector ( & out_dir) ;
23
+ println ! (
24
+ "cargo:rustc-env=BIOS_BOOT_SECTOR_PATH={}" ,
25
+ bios_boot_sector_path. display( )
26
+ ) ;
27
+ let bios_stage_2_path = build_bios_stage_2 ( & out_dir) ;
28
+ println ! (
29
+ "cargo:rustc-env=BIOS_STAGE_2_PATH={}" ,
30
+ bios_stage_2_path. display( )
31
+ ) ;
27
32
28
- let bios_stage_3_path = build_bios_stage_3 ( & out_dir) ;
29
- println ! (
30
- "cargo:rustc-env=BIOS_STAGE_3_PATH={}" ,
31
- bios_stage_3_path. display( )
32
- ) ;
33
+ let bios_stage_3_path = build_bios_stage_3 ( & out_dir) ;
34
+ println ! (
35
+ "cargo:rustc-env=BIOS_STAGE_3_PATH={}" ,
36
+ bios_stage_3_path. display( )
37
+ ) ;
33
38
34
- let bios_stage_4_path = build_bios_stage_4 ( & out_dir) ;
35
- println ! (
36
- "cargo:rustc-env=BIOS_STAGE_4_PATH={}" ,
37
- bios_stage_4_path. display( )
38
- ) ;
39
+ let bios_stage_4_path = build_bios_stage_4 ( & out_dir) ;
40
+ println ! (
41
+ "cargo:rustc-env=BIOS_STAGE_4_PATH={}" ,
42
+ bios_stage_4_path. display( )
43
+ ) ;
44
+ }
39
45
}
40
46
41
47
#[ cfg( not( docsrs_dummy_build) ) ]
@@ -270,23 +276,23 @@ fn convert_elf_to_bin(elf_path: PathBuf) -> PathBuf {
270
276
271
277
// dummy implementations because docsrs builds have no network access
272
278
273
- #[ cfg( any ( docsrs_dummy_build, not ( feature = "uefi" ) ) ) ]
279
+ #[ cfg( docsrs_dummy_build) ]
274
280
fn build_uefi_bootloader ( _out_dir : & Path ) -> PathBuf {
275
281
PathBuf :: new ( )
276
282
}
277
- #[ cfg( any ( docsrs_dummy_build, not ( feature = "bios" ) ) ) ]
283
+ #[ cfg( docsrs_dummy_build) ]
278
284
fn build_bios_boot_sector ( _out_dir : & Path ) -> PathBuf {
279
285
PathBuf :: new ( )
280
286
}
281
- #[ cfg( any ( docsrs_dummy_build, not ( feature = "bios" ) ) ) ]
287
+ #[ cfg( docsrs_dummy_build) ]
282
288
fn build_bios_stage_2 ( _out_dir : & Path ) -> PathBuf {
283
289
PathBuf :: new ( )
284
290
}
285
- #[ cfg( any ( docsrs_dummy_build, not ( feature = "bios" ) ) ) ]
291
+ #[ cfg( docsrs_dummy_build) ]
286
292
fn build_bios_stage_3 ( _out_dir : & Path ) -> PathBuf {
287
293
PathBuf :: new ( )
288
294
}
289
- #[ cfg( any ( docsrs_dummy_build, not ( feature = "bios" ) ) ) ]
295
+ #[ cfg( docsrs_dummy_build) ]
290
296
fn build_bios_stage_4 ( _out_dir : & Path ) -> PathBuf {
291
297
PathBuf :: new ( )
292
298
}
0 commit comments