@@ -8,34 +8,40 @@ const BOOTLOADER_VERSION: &str = env!("CARGO_PKG_VERSION");
88fn main ( ) {
99 let out_dir = PathBuf :: from ( std:: env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
1010
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+ }
1619
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+ ) ;
2732
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+ ) ;
3338
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+ }
3945}
4046
4147#[ cfg( not( docsrs_dummy_build) ) ]
@@ -270,23 +276,23 @@ fn convert_elf_to_bin(elf_path: PathBuf) -> PathBuf {
270276
271277// dummy implementations because docsrs builds have no network access
272278
273- #[ cfg( any ( docsrs_dummy_build, not ( feature = "uefi" ) ) ) ]
279+ #[ cfg( docsrs_dummy_build) ]
274280fn build_uefi_bootloader ( _out_dir : & Path ) -> PathBuf {
275281 PathBuf :: new ( )
276282}
277- #[ cfg( any ( docsrs_dummy_build, not ( feature = "bios" ) ) ) ]
283+ #[ cfg( docsrs_dummy_build) ]
278284fn build_bios_boot_sector ( _out_dir : & Path ) -> PathBuf {
279285 PathBuf :: new ( )
280286}
281- #[ cfg( any ( docsrs_dummy_build, not ( feature = "bios" ) ) ) ]
287+ #[ cfg( docsrs_dummy_build) ]
282288fn build_bios_stage_2 ( _out_dir : & Path ) -> PathBuf {
283289 PathBuf :: new ( )
284290}
285- #[ cfg( any ( docsrs_dummy_build, not ( feature = "bios" ) ) ) ]
291+ #[ cfg( docsrs_dummy_build) ]
286292fn build_bios_stage_3 ( _out_dir : & Path ) -> PathBuf {
287293 PathBuf :: new ( )
288294}
289- #[ cfg( any ( docsrs_dummy_build, not ( feature = "bios" ) ) ) ]
295+ #[ cfg( docsrs_dummy_build) ]
290296fn build_bios_stage_4 ( _out_dir : & Path ) -> PathBuf {
291297 PathBuf :: new ( )
292298}
0 commit comments