@@ -14,7 +14,7 @@ fn src_hotfix_dir() -> PathBuf {
1414fn do_cc ( ) {
1515 let target = env:: var ( "TARGET" ) . unwrap ( ) ;
1616 if cfg ! ( unix) {
17- let exclude = [ "redox" , "wasi" ] ;
17+ let exclude = [ "redox" , "wasi" , "wali" ] ;
1818 if !exclude. iter ( ) . any ( |x| target. contains ( x) ) {
1919 let mut cmsg = cc:: Build :: new ( ) ;
2020
@@ -26,7 +26,7 @@ fn do_cc() {
2626 cmsg. compile ( "cmsg" ) ;
2727 }
2828
29- if target. contains ( "linux" )
29+ if ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) )
3030 || target. contains ( "android" )
3131 || target. contains ( "emscripten" )
3232 || target. contains ( "fuchsia" )
@@ -35,10 +35,10 @@ fn do_cc() {
3535 cc:: Build :: new ( ) . file ( "src/makedev.c" ) . compile ( "makedev" ) ;
3636 }
3737 }
38- if target. contains ( "android" ) || target. contains ( "linux" ) {
38+ if target. contains ( "android" ) || ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) ) {
3939 cc:: Build :: new ( ) . file ( "src/errqueue.c" ) . compile ( "errqueue" ) ;
4040 }
41- if target. contains ( "linux" )
41+ if ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) )
4242 || target. contains ( "l4re" )
4343 || target. contains ( "android" )
4444 || target. contains ( "emscripten" )
@@ -3437,6 +3437,7 @@ fn test_linux(target: &str) {
34373437 let x86_64_gnux32 = target. contains ( "gnux32" ) && x86_64;
34383438 let riscv64 = target. contains ( "riscv64" ) ;
34393439 let loongarch64 = target. contains ( "loongarch64" ) ;
3440+ let wasm32 = target. contains ( "wasm32" ) ;
34403441 let uclibc = target. contains ( "uclibc" ) ;
34413442
34423443 let mut cfg = ctest_cfg ( ) ;
@@ -3562,68 +3563,73 @@ fn test_linux(target: &str) {
35623563 cfg:
35633564 [ loongarch64 || riscv64] : "asm/hwcap.h" ,
35643565 "asm/mman.h" ,
3565- [ gnu] : "linux/aio_abi.h" ,
3566- "linux/can.h" ,
3567- "linux/can/raw.h" ,
3568- "linux/can/j1939.h" ,
3569- "linux/dccp.h" ,
3570- "linux/errqueue.h" ,
3571- "linux/falloc.h" ,
3572- "linux/filter.h" ,
3573- "linux/fs.h" ,
3574- "linux/futex.h" ,
3575- "linux/genetlink.h" ,
3576- "linux/if.h" ,
3577- "linux/if_addr.h" ,
3578- "linux/if_alg.h" ,
3579- "linux/if_ether.h" ,
3580- "linux/if_packet.h" ,
3581- "linux/if_tun.h" ,
3582- "linux/if_xdp.h" ,
3583- "linux/input.h" ,
3584- "linux/ipv6.h" ,
3585- "linux/kexec.h" ,
3586- "linux/keyctl.h" ,
3587- "linux/magic.h" ,
3588- "linux/memfd.h" ,
3589- "linux/membarrier.h" ,
3590- "linux/mempolicy.h" ,
3591- "linux/mman.h" ,
3592- "linux/module.h" ,
3593- "linux/mount.h" ,
3594- "linux/net_tstamp.h" ,
3595- "linux/netfilter/nfnetlink.h" ,
3596- "linux/netfilter/nfnetlink_log.h" ,
3597- "linux/netfilter/nfnetlink_queue.h" ,
3598- "linux/netfilter/nf_tables.h" ,
3599- "linux/netfilter_arp.h" ,
3600- "linux/netfilter_bridge.h" ,
3601- "linux/netfilter_ipv4.h" ,
3602- "linux/netfilter_ipv6.h" ,
3603- "linux/netfilter_ipv6/ip6_tables.h" ,
3604- "linux/netlink.h" ,
3605- "linux/openat2.h" ,
3606- // FIXME(linux): some items require Linux >= 5.6:
3607- "linux/ptp_clock.h" ,
3608- "linux/ptrace.h" ,
3609- "linux/quota.h" ,
3610- "linux/random.h" ,
3611- "linux/reboot.h" ,
3612- "linux/rtnetlink.h" ,
3613- "linux/sched.h" ,
3614- "linux/sctp.h" ,
3615- "linux/seccomp.h" ,
3616- "linux/sock_diag.h" ,
3617- "linux/sockios.h" ,
3618- "linux/tls.h" ,
3619- "linux/uinput.h" ,
3620- "linux/vm_sockets.h" ,
3621- "linux/wait.h" ,
3622- "linux/wireless.h" ,
3623- "sys/fanotify.h" ,
3624- // <sys/auxv.h> is not present on uclibc
3625- [ !uclibc] : "sys/auxv.h" ,
3626- [ gnu || musl] : "linux/close_range.h" ,
3566+ }
3567+
3568+ if !wasm32 {
3569+ headers ! { cfg:
3570+ [ gnu] : "linux/aio_abi.h" ,
3571+ "linux/can.h" ,
3572+ "linux/can/raw.h" ,
3573+ "linux/can/j1939.h" ,
3574+ "linux/dccp.h" ,
3575+ "linux/errqueue.h" ,
3576+ "linux/falloc.h" ,
3577+ "linux/filter.h" ,
3578+ "linux/fs.h" ,
3579+ "linux/futex.h" ,
3580+ "linux/genetlink.h" ,
3581+ "linux/if.h" ,
3582+ "linux/if_addr.h" ,
3583+ "linux/if_alg.h" ,
3584+ "linux/if_ether.h" ,
3585+ "linux/if_packet.h" ,
3586+ "linux/if_tun.h" ,
3587+ "linux/if_xdp.h" ,
3588+ "linux/input.h" ,
3589+ "linux/ipv6.h" ,
3590+ "linux/kexec.h" ,
3591+ "linux/keyctl.h" ,
3592+ "linux/magic.h" ,
3593+ "linux/memfd.h" ,
3594+ "linux/membarrier.h" ,
3595+ "linux/mempolicy.h" ,
3596+ "linux/mman.h" ,
3597+ "linux/module.h" ,
3598+ "linux/mount.h" ,
3599+ "linux/net_tstamp.h" ,
3600+ "linux/netfilter/nfnetlink.h" ,
3601+ "linux/netfilter/nfnetlink_log.h" ,
3602+ "linux/netfilter/nfnetlink_queue.h" ,
3603+ "linux/netfilter/nf_tables.h" ,
3604+ "linux/netfilter_arp.h" ,
3605+ "linux/netfilter_bridge.h" ,
3606+ "linux/netfilter_ipv4.h" ,
3607+ "linux/netfilter_ipv6.h" ,
3608+ "linux/netfilter_ipv6/ip6_tables.h" ,
3609+ "linux/netlink.h" ,
3610+ "linux/openat2.h" ,
3611+ // FIXME(linux): some items require Linux >= 5.6:
3612+ "linux/ptp_clock.h" ,
3613+ "linux/ptrace.h" ,
3614+ "linux/quota.h" ,
3615+ "linux/random.h" ,
3616+ "linux/reboot.h" ,
3617+ "linux/rtnetlink.h" ,
3618+ "linux/sched.h" ,
3619+ "linux/sctp.h" ,
3620+ "linux/seccomp.h" ,
3621+ "linux/sock_diag.h" ,
3622+ "linux/sockios.h" ,
3623+ "linux/tls.h" ,
3624+ "linux/uinput.h" ,
3625+ "linux/vm_sockets.h" ,
3626+ "linux/wait.h" ,
3627+ "linux/wireless.h" ,
3628+ "sys/fanotify.h" ,
3629+ // <sys/auxv.h> is not present on uclibc
3630+ [ !uclibc] : "sys/auxv.h" ,
3631+ [ gnu || musl] : "linux/close_range.h" ,
3632+ }
36273633 }
36283634
36293635 // note: aio.h must be included before sys/mount.h
@@ -4556,6 +4562,7 @@ fn test_linux_like_apis(target: &str) {
45564562 let gnu = target. contains ( "gnu" ) ;
45574563 let musl = target. contains ( "musl" ) || target. contains ( "ohos" ) ;
45584564 let linux = target. contains ( "linux" ) ;
4565+ let wali = target. contains ( "linux" ) && target. contains ( "wasm32" ) ;
45594566 let emscripten = target. contains ( "emscripten" ) ;
45604567 let android = target. contains ( "android" ) ;
45614568 assert ! ( linux || android || emscripten) ;
@@ -4605,7 +4612,7 @@ fn test_linux_like_apis(target: &str) {
46054612 cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_fcntl.rs" ) ;
46064613 }
46074614
4608- if linux || android {
4615+ if ( linux && !wali ) || android {
46094616 // test termios
46104617 let mut cfg = ctest_cfg ( ) ;
46114618 cfg. header ( "asm/termbits.h" ) ;
@@ -4657,7 +4664,7 @@ fn test_linux_like_apis(target: &str) {
46574664 cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_ipv6.rs" ) ;
46584665 }
46594666
4660- if linux || android {
4667+ if ( linux && !wali ) || android {
46614668 // Test Elf64_Phdr and Elf32_Phdr
46624669 // These types have a field called `p_type`, but including
46634670 // "resolve.h" defines a `p_type` macro that expands to `__p_type`
@@ -4679,7 +4686,7 @@ fn test_linux_like_apis(target: &str) {
46794686 cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_elf.rs" ) ;
46804687 }
46814688
4682- if linux || android {
4689+ if ( linux && !wali ) || android {
46834690 // Test `ARPHRD_CAN`.
46844691 let mut cfg = ctest_cfg ( ) ;
46854692 cfg. header ( "linux/if_arp.h" ) ;
0 commit comments