mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-29 16:40:18 +02:00
Merge pull request #69072 from thoughtpolice/nixpkgs/terra-updates
terra updates
This commit is contained in:
commit
8025787c74
|
@ -1,29 +1,40 @@
|
||||||
{ stdenv, fetchFromGitHub, fetchurl, llvmPackages, ncurses, lua }:
|
{ stdenv, fetchurl, fetchFromGitHub
|
||||||
|
, llvmPackages, ncurses, lua
|
||||||
|
}:
|
||||||
|
|
||||||
let
|
let
|
||||||
luajitArchive = "LuaJIT-2.0.5.tar.gz";
|
luajitArchive = "LuaJIT-2.0.5.tar.gz";
|
||||||
luajitSrc = fetchurl {
|
luajitSrc = fetchurl {
|
||||||
url = "http://luajit.org/download/${luajitArchive}";
|
url = "http://luajit.org/download/${luajitArchive}";
|
||||||
sha256 = "0yg9q4q6v028bgh85317ykc9whgxgysp76qzaqgq55y6jy11yjw7";
|
sha256 = "0yg9q4q6v028bgh85317ykc9whgxgysp76qzaqgq55y6jy11yjw7";
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "terra-git";
|
pname = "terra";
|
||||||
version = "1.0.0-beta1";
|
version = "1.0.0pre1175_${builtins.substring 0 7 src.rev}";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "zdevito";
|
owner = "zdevito";
|
||||||
repo = "terra";
|
repo = "terra";
|
||||||
rev = "release-${version}";
|
rev = "ef6a75ffee15a30f3c74f4e6943851cfbc0fec3d";
|
||||||
sha256 = "1blv3mbmlwb6fxkck6487ck4qq67cbwq6s1zlp86hy2wckgf8q2c";
|
sha256 = "0aky17vbv3d9zng34hp17p9zb00dbzwhvzsdjzrrqvk9lmyvix0s";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [ lua ];
|
||||||
|
buildInputs = with llvmPackages; [ llvm clang-unwrapped ncurses ];
|
||||||
|
|
||||||
|
doCheck = true;
|
||||||
|
enableParallelBuilding = true;
|
||||||
|
hardeningDisable = [ "fortify" ];
|
||||||
outputs = [ "bin" "dev" "out" "static" ];
|
outputs = [ "bin" "dev" "out" "static" ];
|
||||||
|
|
||||||
|
patches = [ ./nix-cflags.patch ];
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace Makefile --replace \
|
substituteInPlace Makefile \
|
||||||
'-lcurses' '-lncurses'
|
--replace '-lcurses' '-lncurses'
|
||||||
|
|
||||||
|
substituteInPlace src/terralib.lua \
|
||||||
|
--subst-var-by NIX_LIBC_INCLUDE ${stdenv.cc.libc.dev}/include
|
||||||
'';
|
'';
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
|
@ -36,6 +47,8 @@ stdenv.mkDerivation rec {
|
||||||
cp ${luajitSrc} build/${luajitArchive}
|
cp ${luajitSrc} build/${luajitArchive}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
checkPhase = "(cd tests && ../terra run)";
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
install -Dm755 -t $bin/bin release/bin/terra
|
install -Dm755 -t $bin/bin release/bin/terra
|
||||||
install -Dm755 -t $out/lib release/lib/terra${stdenv.hostPlatform.extensions.sharedLibrary}
|
install -Dm755 -t $out/lib release/lib/terra${stdenv.hostPlatform.extensions.sharedLibrary}
|
||||||
|
@ -45,13 +58,11 @@ stdenv.mkDerivation rec {
|
||||||
cp -rv release/include/terra $dev/include
|
cp -rv release/include/terra $dev/include
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildInputs = with llvmPackages; [ lua llvm clang-unwrapped ncurses ];
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
meta = with stdenv.lib; {
|
||||||
description = "A low-level counterpart to Lua";
|
description = "A low-level counterpart to Lua";
|
||||||
homepage = http://terralang.org/;
|
homepage = http://terralang.org/;
|
||||||
platforms = platforms.x86_64;
|
platforms = platforms.x86_64;
|
||||||
maintainers = with maintainers; [ jb55 ];
|
maintainers = with maintainers; [ jb55 thoughtpolice ];
|
||||||
license = licenses.mit;
|
license = licenses.mit;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
22
pkgs/development/compilers/terra/nix-cflags.patch
Normal file
22
pkgs/development/compilers/terra/nix-cflags.patch
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
diff --git a/src/terralib.lua b/src/terralib.lua
|
||||||
|
index 351238d..e638c90 100644
|
||||||
|
--- a/src/terralib.lua
|
||||||
|
+++ b/src/terralib.lua
|
||||||
|
@@ -3395,6 +3395,17 @@ 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
|
||||||
|
|
||||||
|
if cargs then
|
||||||
|
args:insertall(cargs)
|
Loading…
Reference in a new issue