nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 22.05 42 lines 1.5 kB view raw
1From 67f54fde2b1683aae3800f7a86a4e507c1125be8 Mon Sep 17 00:00:00 2001 2From: Yureka <yuka@yuka.dev> 3Date: Sat, 7 Aug 2021 09:16:46 +0200 4Subject: [PATCH] emulate clang 'sysroot + /include' logic 5 6Authored-By: Alexander Khovansky <alex@khovansky.me> 7Co-Authored-By: Yureka <yuka@yuka.dev> 8 9Clang provided by nix patches out logic that appends 'sysroot + /include' 10to the include path as well as automatic inclusion of libcxx includes (/include/c++/v1). 11The patch below adds that logic back by introducing cflags emulating this behavior to emcc 12invocations directly. 13 14Important note: with non-nix clang, sysroot/include dir ends up being the last 15in the include search order, right after the resource root. 16Hence usage of -idirafter. Clang also documents an -isystem-after flag 17but it doesn't appear to work 18--- 19 emcc.py | 7 ++++++- 20 1 file changed, 6 insertions(+), 1 deletion(-) 21 22diff --git a/emcc.py b/emcc.py 23index 999314afc..0e23c066c 100755 24--- a/emcc.py 25+++ b/emcc.py 26@@ -759,7 +759,12 @@ def emsdk_ldflags(user_args): 27 28 29 def emsdk_cflags(user_args): 30- cflags = ['--sysroot=' + shared.Cache.get_sysroot(absolute=True)] 31+ cflags = [ 32+ '--sysroot=' + shared.Cache.get_sysroot(absolute=True), 33+ '-resource-dir=@resourceDir@', 34+ '-idirafter' + shared.Cache.get_sysroot(absolute=True) + os.path.join('/include'), 35+ '-iwithsysroot' + os.path.join('/include','c++','v1') 36+ ] 37 38 def array_contains_any_of(hay, needles): 39 for n in needles: 40-- 412.32.0 42