mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-22 05:33:23 +00:00
43 lines
1.4 KiB
Diff
43 lines
1.4 KiB
Diff
From 4bbbb640934aa653bcfec0335798b77a8935b815 Mon Sep 17 00:00:00 2001
|
|
From: Yureka <yuka@yuka.dev>
|
|
Date: Sat, 7 Aug 2021 09:16:46 +0200
|
|
Subject: [PATCH] emulate clang 'sysroot + /include' logic
|
|
|
|
Authored-By: Alexander Khovansky <alex@khovansky.me>
|
|
Co-Authored-By: Yureka <yuka@yuka.dev>
|
|
|
|
Clang provided by nix patches out logic that appends 'sysroot + /include'
|
|
to the include path as well as automatic inclusion of libcxx includes (/include/c++/v1).
|
|
The patch below adds that logic back by introducing cflags emulating this behavior to emcc
|
|
invocations directly.
|
|
|
|
Important note: with non-nix clang, sysroot/include dir ends up being the last
|
|
in the include search order, right after the resource root.
|
|
Hence usage of -idirafter. Clang also documents an -isystem-after flag
|
|
but it doesn't appear to work
|
|
---
|
|
emcc.py | 7 ++++++-
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/emcc.py b/emcc.py
|
|
index ba8d1b556..7d89644c5 100755
|
|
--- a/emcc.py
|
|
+++ b/emcc.py
|
|
@@ -883,7 +883,12 @@ def parse_s_args(args):
|
|
|
|
|
|
def emsdk_cflags(user_args):
|
|
- cflags = ['--sysroot=' + cache.get_sysroot(absolute=True)]
|
|
+ cflags = [
|
|
+ '--sysroot=' + cache.get_sysroot(absolute=True),
|
|
+ '-resource-dir=@resourceDir@',
|
|
+ '-idirafter' + cache.get_sysroot(absolute=True) + os.path.join('/include'),
|
|
+ '-iwithsysroot' + os.path.join('/include','c++','v1')
|
|
+ ]
|
|
|
|
def array_contains_any_of(hay, needles):
|
|
for n in needles:
|
|
--
|
|
2.40.0
|
|
|