Skip to content

Commit 0e9686a

Browse files
authored
Avoid installing alltypes.h.in. NFC (#24843)
Also cleanup install_system_headers as little.
1 parent e500d61 commit 0e9686a

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

tools/system_libs.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2488,7 +2488,7 @@ def calculate(options):
24882488
return ret
24892489

24902490

2491-
def safe_copytree(src, dst):
2491+
def safe_copytree(src, dst, excludes=None):
24922492
# We cannot use `shutil.copytree` there because we need to ensure the
24932493
# output tree is writable, and in some cases the emscripten tree
24942494
# itself is readonly (e.g. NixOS).
@@ -2497,35 +2497,37 @@ def safe_copytree(src, dst):
24972497
# unconditionally copy the source directory's mode bits.
24982498
os.makedirs(dst, exist_ok=True)
24992499
for entry in os.scandir(src):
2500+
if excludes and entry.name in excludes:
2501+
continue
25002502
srcname = os.path.join(src, entry.name)
25012503
dstname = os.path.join(dst, entry.name)
25022504
if entry.is_dir():
2503-
safe_copytree(srcname, dstname)
2505+
safe_copytree(srcname, dstname, excludes)
25042506
else:
25052507
shared.safe_copy(srcname, dstname)
25062508

25072509

25082510
def install_system_headers(stamp):
25092511
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': '',
25132515
# Copy the generic arch files first then
2514-
('lib', 'libc', 'musl', 'arch', 'generic'): '',
2516+
'system/lib/libc/musl/arch/generic': '',
25152517
# Then overlay the emscripten directory on top.
25162518
# 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': '',
25222524
}
25232525

25242526
target_include_dir = cache.get_include_dir()
25252527
for src, dest in install_dirs.items():
2526-
src = utils.path_from_root('system', *src)
2528+
src = utils.path_from_root(src)
25272529
dest = os.path.join(target_include_dir, dest)
2528-
safe_copytree(src, dest)
2530+
safe_copytree(src, dest, excludes={'alltypes.h.in'})
25292531

25302532
pkgconfig_src = utils.path_from_root('system/lib/pkgconfig')
25312533
pkgconfig_dest = cache.get_sysroot_dir('lib/pkgconfig')

0 commit comments

Comments
 (0)