File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,29 +3,34 @@ use std::path::PathBuf;
33
44fn main ( ) {
55 let target = env:: var ( "TARGET" ) . unwrap_or_default ( ) ;
6- let host = env:: var ( "HOST" ) . unwrap_or_default ( ) ;
7-
8- eprintln ! ( "build.rs: TARGET={} HOST={}" , target, host) ;
96
7+ // Only run nasm for x86_64 bare metal, skip blog_os cross-compile target on ARM runners
108 if !target. starts_with ( "x86_64" ) {
11- eprintln ! ( "build.rs: skipping nasm for non-x86_64 target" ) ;
9+ return ;
10+ }
11+
12+ // Check if nasm is available before trying to run it
13+ let nasm_available = std:: process:: Command :: new ( "nasm" )
14+ . arg ( "--version" )
15+ . status ( )
16+ . map ( |s| s. success ( ) )
17+ . unwrap_or ( false ) ;
18+
19+ if !nasm_available {
20+ println ! ( "cargo:warning=nasm not found, skipping switch.s assembly" ) ;
1221 return ;
1322 }
1423
1524 let out_dir = PathBuf :: from ( env:: var ( "OUT_DIR" ) . unwrap ( ) ) ;
1625
1726 println ! ( "cargo:rerun-if-changed=src/task/switch.s" ) ;
1827
19- let status = std:: process:: Command :: new ( "nasm" )
28+ std:: process:: Command :: new ( "nasm" )
2029 . args ( & [ "-f" , "elf64" , "src/task/switch.s" , "-o" ] )
2130 . arg ( & format ! ( "{}/switch.o" , out_dir. display( ) ) )
2231 . status ( )
2332 . expect ( "Failed to assemble switch.s" ) ;
2433
25- if !status. success ( ) {
26- panic ! ( "nasm failed" ) ;
27- }
28-
2934 println ! ( "cargo:rustc-link-search={}" , out_dir. display( ) ) ;
3035 println ! ( "cargo:rustc-link-lib=static=switch" ) ;
3136
You can’t perform that action at this time.
0 commit comments