nixpkgs/pkgs/development/compilers/terra/nix-cflags.patch
J. Neto 6cf3ec0947
terra: 1.0.0pre1175_ef6a75f -> 1.0.0-beta3
Contains the combined single-commit work by both @jnetod and myself
from NixOS/nixpkgs#122665. Brings the build up to LLVM 10, switches to
`symlinkJoin` for putting Clang where the CMake build expects it, and
updates to a fresh update of Terra that works around a few LLVM bugs.
2021-06-05 18:19:23 -07:00

21 lines
707 B
Diff

diff --git a/src/terralib.lua b/src/terralib.lua
index 532ed18..2c265dc 100644
--- a/src/terralib.lua
+++ b/src/terralib.lua
@@ -3426,6 +3426,16 @@ function terra.includecstring(code,cargs,target)
args:insert("-internal-isystem")
args:insert(path)
end
+ -- NOTE(aseipp): include relevant Nix header files
+ args:insert("-isystem")
+ args:insert("@NIX_LIBC_INCLUDE@")
+
+ local nix_cflags = os.getenv('NIX_CFLAGS_COMPILE')
+ if nix_cflags ~= nil then
+ for w in nix_cflags:gmatch("%S+") do
+ args:insert(w)
+ end
+ end
-- Obey the SDKROOT variable on macOS to match Clang behavior.
local sdkroot = os.getenv("SDKROOT")
if sdkroot then