@@ -14,7 +14,7 @@ fn src_hotfix_dir() -> PathBuf {
14
14
fn do_cc ( ) {
15
15
let target = env:: var ( "TARGET" ) . unwrap ( ) ;
16
16
if cfg ! ( unix) {
17
- let exclude = [ "redox" , "wasi" ] ;
17
+ let exclude = [ "redox" , "wasi" , "wali" ] ;
18
18
if !exclude. iter ( ) . any ( |x| target. contains ( x) ) {
19
19
let mut cmsg = cc:: Build :: new ( ) ;
20
20
@@ -26,7 +26,7 @@ fn do_cc() {
26
26
cmsg. compile ( "cmsg" ) ;
27
27
}
28
28
29
- if target. contains ( "linux" )
29
+ if ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) )
30
30
|| target. contains ( "android" )
31
31
|| target. contains ( "emscripten" )
32
32
|| target. contains ( "fuchsia" )
@@ -35,10 +35,10 @@ fn do_cc() {
35
35
cc:: Build :: new ( ) . file ( "src/makedev.c" ) . compile ( "makedev" ) ;
36
36
}
37
37
}
38
- if target. contains ( "android" ) || target. contains ( "linux" ) {
38
+ if target. contains ( "android" ) || ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) ) {
39
39
cc:: Build :: new ( ) . file ( "src/errqueue.c" ) . compile ( "errqueue" ) ;
40
40
}
41
- if target. contains ( "linux" )
41
+ if ( target. contains ( "linux" ) && !target . contains ( "wasm32" ) )
42
42
|| target. contains ( "l4re" )
43
43
|| target. contains ( "android" )
44
44
|| target. contains ( "emscripten" )
@@ -3423,6 +3423,7 @@ fn test_linux(target: &str) {
3423
3423
let x86_64_gnux32 = target. contains ( "gnux32" ) && x86_64;
3424
3424
let riscv64 = target. contains ( "riscv64" ) ;
3425
3425
let loongarch64 = target. contains ( "loongarch64" ) ;
3426
+ let wasm32 = target. contains ( "wasm32" ) ;
3426
3427
let uclibc = target. contains ( "uclibc" ) ;
3427
3428
3428
3429
let mut cfg = ctest_cfg ( ) ;
@@ -3548,68 +3549,73 @@ fn test_linux(target: &str) {
3548
3549
cfg:
3549
3550
[ loongarch64 || riscv64] : "asm/hwcap.h" ,
3550
3551
"asm/mman.h" ,
3551
- [ gnu] : "linux/aio_abi.h" ,
3552
- "linux/can.h" ,
3553
- "linux/can/raw.h" ,
3554
- "linux/can/j1939.h" ,
3555
- "linux/dccp.h" ,
3556
- "linux/errqueue.h" ,
3557
- "linux/falloc.h" ,
3558
- "linux/filter.h" ,
3559
- "linux/fs.h" ,
3560
- "linux/futex.h" ,
3561
- "linux/genetlink.h" ,
3562
- "linux/if.h" ,
3563
- "linux/if_addr.h" ,
3564
- "linux/if_alg.h" ,
3565
- "linux/if_ether.h" ,
3566
- "linux/if_packet.h" ,
3567
- "linux/if_tun.h" ,
3568
- "linux/if_xdp.h" ,
3569
- "linux/input.h" ,
3570
- "linux/ipv6.h" ,
3571
- "linux/kexec.h" ,
3572
- "linux/keyctl.h" ,
3573
- "linux/magic.h" ,
3574
- "linux/memfd.h" ,
3575
- "linux/membarrier.h" ,
3576
- "linux/mempolicy.h" ,
3577
- "linux/mman.h" ,
3578
- "linux/module.h" ,
3579
- "linux/mount.h" ,
3580
- "linux/net_tstamp.h" ,
3581
- "linux/netfilter/nfnetlink.h" ,
3582
- "linux/netfilter/nfnetlink_log.h" ,
3583
- "linux/netfilter/nfnetlink_queue.h" ,
3584
- "linux/netfilter/nf_tables.h" ,
3585
- "linux/netfilter_arp.h" ,
3586
- "linux/netfilter_bridge.h" ,
3587
- "linux/netfilter_ipv4.h" ,
3588
- "linux/netfilter_ipv6.h" ,
3589
- "linux/netfilter_ipv6/ip6_tables.h" ,
3590
- "linux/netlink.h" ,
3591
- "linux/openat2.h" ,
3592
- // FIXME(linux): some items require Linux >= 5.6:
3593
- "linux/ptp_clock.h" ,
3594
- "linux/ptrace.h" ,
3595
- "linux/quota.h" ,
3596
- "linux/random.h" ,
3597
- "linux/reboot.h" ,
3598
- "linux/rtnetlink.h" ,
3599
- "linux/sched.h" ,
3600
- "linux/sctp.h" ,
3601
- "linux/seccomp.h" ,
3602
- "linux/sock_diag.h" ,
3603
- "linux/sockios.h" ,
3604
- "linux/tls.h" ,
3605
- "linux/uinput.h" ,
3606
- "linux/vm_sockets.h" ,
3607
- "linux/wait.h" ,
3608
- "linux/wireless.h" ,
3609
- "sys/fanotify.h" ,
3610
- // <sys/auxv.h> is not present on uclibc
3611
- [ !uclibc] : "sys/auxv.h" ,
3612
- [ gnu || musl] : "linux/close_range.h" ,
3552
+ }
3553
+
3554
+ if !wasm32 {
3555
+ headers ! {
3556
+ [ gnu] : "linux/aio_abi.h" ,
3557
+ "linux/can.h" ,
3558
+ "linux/can/raw.h" ,
3559
+ "linux/can/j1939.h" ,
3560
+ "linux/dccp.h" ,
3561
+ "linux/errqueue.h" ,
3562
+ "linux/falloc.h" ,
3563
+ "linux/filter.h" ,
3564
+ "linux/fs.h" ,
3565
+ "linux/futex.h" ,
3566
+ "linux/genetlink.h" ,
3567
+ "linux/if.h" ,
3568
+ "linux/if_addr.h" ,
3569
+ "linux/if_alg.h" ,
3570
+ "linux/if_ether.h" ,
3571
+ "linux/if_packet.h" ,
3572
+ "linux/if_tun.h" ,
3573
+ "linux/if_xdp.h" ,
3574
+ "linux/input.h" ,
3575
+ "linux/ipv6.h" ,
3576
+ "linux/kexec.h" ,
3577
+ "linux/keyctl.h" ,
3578
+ "linux/magic.h" ,
3579
+ "linux/memfd.h" ,
3580
+ "linux/membarrier.h" ,
3581
+ "linux/mempolicy.h" ,
3582
+ "linux/mman.h" ,
3583
+ "linux/module.h" ,
3584
+ "linux/mount.h" ,
3585
+ "linux/net_tstamp.h" ,
3586
+ "linux/netfilter/nfnetlink.h" ,
3587
+ "linux/netfilter/nfnetlink_log.h" ,
3588
+ "linux/netfilter/nfnetlink_queue.h" ,
3589
+ "linux/netfilter/nf_tables.h" ,
3590
+ "linux/netfilter_arp.h" ,
3591
+ "linux/netfilter_bridge.h" ,
3592
+ "linux/netfilter_ipv4.h" ,
3593
+ "linux/netfilter_ipv6.h" ,
3594
+ "linux/netfilter_ipv6/ip6_tables.h" ,
3595
+ "linux/netlink.h" ,
3596
+ "linux/openat2.h" ,
3597
+ // FIXME(linux): some items require Linux >= 5.6:
3598
+ "linux/ptp_clock.h" ,
3599
+ "linux/ptrace.h" ,
3600
+ "linux/quota.h" ,
3601
+ "linux/random.h" ,
3602
+ "linux/reboot.h" ,
3603
+ "linux/rtnetlink.h" ,
3604
+ "linux/sched.h" ,
3605
+ "linux/sctp.h" ,
3606
+ "linux/seccomp.h" ,
3607
+ "linux/sock_diag.h" ,
3608
+ "linux/sockios.h" ,
3609
+ "linux/tls.h" ,
3610
+ "linux/uinput.h" ,
3611
+ "linux/vm_sockets.h" ,
3612
+ "linux/wait.h" ,
3613
+ "linux/wireless.h" ,
3614
+ "sys/fanotify.h" ,
3615
+ // <sys/auxv.h> is not present on uclibc
3616
+ [ !uclibc] : "sys/auxv.h" ,
3617
+ [ gnu || musl] : "linux/close_range.h" ,
3618
+ }
3613
3619
}
3614
3620
3615
3621
// note: aio.h must be included before sys/mount.h
@@ -4533,6 +4539,7 @@ fn test_linux_like_apis(target: &str) {
4533
4539
let gnu = target. contains ( "gnu" ) ;
4534
4540
let musl = target. contains ( "musl" ) || target. contains ( "ohos" ) ;
4535
4541
let linux = target. contains ( "linux" ) ;
4542
+ let wali = target. contains ( "linux" ) && target. contains ( "wasm32" ) ;
4536
4543
let emscripten = target. contains ( "emscripten" ) ;
4537
4544
let android = target. contains ( "android" ) ;
4538
4545
assert ! ( linux || android || emscripten) ;
@@ -4582,7 +4589,7 @@ fn test_linux_like_apis(target: &str) {
4582
4589
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_fcntl.rs" ) ;
4583
4590
}
4584
4591
4585
- if linux || android {
4592
+ if ( linux && !wali ) || android {
4586
4593
// test termios
4587
4594
let mut cfg = ctest_cfg ( ) ;
4588
4595
cfg. header ( "asm/termbits.h" ) ;
@@ -4634,7 +4641,7 @@ fn test_linux_like_apis(target: &str) {
4634
4641
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_ipv6.rs" ) ;
4635
4642
}
4636
4643
4637
- if linux || android {
4644
+ if ( linux && !wali ) || android {
4638
4645
// Test Elf64_Phdr and Elf32_Phdr
4639
4646
// These types have a field called `p_type`, but including
4640
4647
// "resolve.h" defines a `p_type` macro that expands to `__p_type`
@@ -4656,7 +4663,7 @@ fn test_linux_like_apis(target: &str) {
4656
4663
cfg. generate ( src_hotfix_dir ( ) . join ( "lib.rs" ) , "linux_elf.rs" ) ;
4657
4664
}
4658
4665
4659
- if linux || android {
4666
+ if ( linux && !wali ) || android {
4660
4667
// Test `ARPHRD_CAN`.
4661
4668
let mut cfg = ctest_cfg ( ) ;
4662
4669
cfg. header ( "linux/if_arp.h" ) ;
0 commit comments