@@ -2488,7 +2488,7 @@ def calculate(options):
2488
2488
return ret
2489
2489
2490
2490
2491
- def safe_copytree (src , dst ):
2491
+ def safe_copytree (src , dst , excludes = None ):
2492
2492
# We cannot use `shutil.copytree` there because we need to ensure the
2493
2493
# output tree is writable, and in some cases the emscripten tree
2494
2494
# itself is readonly (e.g. NixOS).
@@ -2497,35 +2497,37 @@ def safe_copytree(src, dst):
2497
2497
# unconditionally copy the source directory's mode bits.
2498
2498
os .makedirs (dst , exist_ok = True )
2499
2499
for entry in os .scandir (src ):
2500
+ if excludes and entry .name in excludes :
2501
+ continue
2500
2502
srcname = os .path .join (src , entry .name )
2501
2503
dstname = os .path .join (dst , entry .name )
2502
2504
if entry .is_dir ():
2503
- safe_copytree (srcname , dstname )
2505
+ safe_copytree (srcname , dstname , excludes )
2504
2506
else :
2505
2507
shared .safe_copy (srcname , dstname )
2506
2508
2507
2509
2508
2510
def install_system_headers (stamp ):
2509
2511
install_dirs = {
2510
- ( ' include',) : '' ,
2511
- ( ' lib' , ' compiler-rt' , ' include') : '' ,
2512
- ( ' lib' , ' libunwind' , ' include') : '' ,
2512
+ 'system/ include' : '' ,
2513
+ 'system/ lib/ compiler-rt/ include' : '' ,
2514
+ 'system/ lib/ libunwind/ include' : '' ,
2513
2515
# Copy the generic arch files first then
2514
- ( ' lib' , ' libc' , ' musl' , ' arch' , ' generic') : '' ,
2516
+ 'system/ lib/ libc/ musl/ arch/ generic' : '' ,
2515
2517
# Then overlay the emscripten directory on top.
2516
2518
# This mimics how musl itself installs its headers.
2517
- ( ' lib' , ' libc' , ' musl' , ' arch' , ' emscripten') : '' ,
2518
- ( ' lib' , ' libc' , ' musl' , ' include') : '' ,
2519
- ( ' lib' , ' libcxx' , ' include'): os . path . join ( 'c++' , ' v1') ,
2520
- ( ' lib' , ' libcxxabi' , ' include'): os . path . join ( 'c++' , ' v1') ,
2521
- ( ' lib' , ' mimalloc' , ' include') : '' ,
2519
+ 'system/ lib/ libc/ musl/ arch/ emscripten' : '' ,
2520
+ 'system/ lib/ libc/ musl/ include' : '' ,
2521
+ 'system/ lib/ libcxx/ include': 'c++/ v1' ,
2522
+ 'system/ lib/ libcxxabi/ include': 'c++/ v1' ,
2523
+ 'system/ lib/ mimalloc/ include' : '' ,
2522
2524
}
2523
2525
2524
2526
target_include_dir = cache .get_include_dir ()
2525
2527
for src , dest in install_dirs .items ():
2526
- src = utils .path_from_root ('system' , * src )
2528
+ src = utils .path_from_root (src )
2527
2529
dest = os .path .join (target_include_dir , dest )
2528
- safe_copytree (src , dest )
2530
+ safe_copytree (src , dest , excludes = { 'alltypes.h.in' } )
2529
2531
2530
2532
pkgconfig_src = utils .path_from_root ('system/lib/pkgconfig' )
2531
2533
pkgconfig_dest = cache .get_sysroot_dir ('lib/pkgconfig' )
0 commit comments