11{
2+ apple-sdk ,
23 cmake ,
34 fetchFromGitHub ,
45 git ,
1011 python3 ,
1112 zlib ,
1213
13- # *NOT* from LLVM 9 !
14+ # *NOT* from LLVM 13 !
1415 # The compiler used to compile Cling may affect the runtime include and lib
1516 # directories it expects to be run with. Cling builds against (a fork of) Clang,
1617 # so we prefer to use Clang as the compiler as well for consistency.
131132 } ;
132133 } ;
133134
134- # Runtime flags for the C++ standard library
135- cxxFlags =
136- if useLLVMLibcxx then
137- [
138- "-I"
139- "${ lib . getDev llvmPackages_13 . libcxx } /include/c++/v1"
140- "-L"
141- "${ llvmPackages_13 . libcxx } /lib"
142- "-l"
143- "${ llvmPackages_13 . libcxx } /lib/libc++${ stdenv . hostPlatform . extensions . sharedLibrary } "
144- ]
145- else
146- [
147- "-I"
148- "${ gcc-unwrapped } /include/c++/${ gcc-unwrapped . version } "
149- "-I"
150- "${ gcc-unwrapped } /include/c++/${ gcc-unwrapped . version } /${ stdenv . hostPlatform . config } "
151- ] ;
152-
153135 # The flags passed to the wrapped cling should
154136 # a) prevent it from searching for system include files and libs, and
155137 # b) provide it with the include files and libs it needs (C and C++ standard library plus
@@ -172,15 +154,35 @@ let
172154 "-isystem"
173155 "${ lib . getLib unwrapped } /lib/clang/${ llvmPackages_13 . clang . version } /include"
174156 ]
175- ++ cxxFlags
157+ ++ lib . optionals useLLVMLibcxx [
158+ "-I"
159+ "${ lib . getDev llvmPackages_13 . libcxx } /include/c++/v1"
160+ "-L"
161+ "${ llvmPackages_13 . libcxx } /lib"
162+ "-l"
163+ "${ llvmPackages_13 . libcxx } /lib/libc++${ stdenv . hostPlatform . extensions . sharedLibrary } "
164+ ]
165+ ++ lib . optionals ( ! useLLVMLibcxx ) [
166+ "-I"
167+ "${ gcc-unwrapped } /include/c++/${ gcc-unwrapped . version } "
168+ "-I"
169+ "${ gcc-unwrapped } /include/c++/${ gcc-unwrapped . version } /${ stdenv . hostPlatform . config } "
170+ ]
176171 ++ [
177- # System libc
172+ # System libc on Linux
173+ # On Darwin, this is an empty directory, so we need a separate include with
174+ # apple-sdk (see below)
178175 "-isystem"
179176 "${ lib . getDev stdenv . cc . libc } /include"
180177
181178 # cling includes
182179 "-isystem"
183180 "${ lib . getDev unwrapped } /include"
181+ ]
182+ ++ lib . optionals stdenv . hostPlatform . isDarwin [
183+ # On Darwin, we need the system includes
184+ "-isystem"
185+ "${ apple-sdk } /Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
184186 ] ;
185187
186188in
0 commit comments