1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-25 03:17:13 +00:00
nixpkgs/pkgs/development/compilers/terra/default.nix

69 lines
1.9 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, fetchFromGitHub
, llvmPackages, ncurses, lua
}:
let
2018-12-21 11:57:16 +00:00
luajitArchive = "LuaJIT-2.0.5.tar.gz";
luajitSrc = fetchurl {
url = "http://luajit.org/download/${luajitArchive}";
2018-12-21 11:57:16 +00:00
sha256 = "0yg9q4q6v028bgh85317ykc9whgxgysp76qzaqgq55y6jy11yjw7";
};
in
stdenv.mkDerivation rec {
pname = "terra";
version = "1.0.0pre1175_${builtins.substring 0 7 src.rev}";
2016-01-18 00:50:10 +00:00
src = fetchFromGitHub {
owner = "zdevito";
repo = "terra";
rev = "ef6a75ffee15a30f3c74f4e6943851cfbc0fec3d";
sha256 = "0aky17vbv3d9zng34hp17p9zb00dbzwhvzsdjzrrqvk9lmyvix0s";
2016-01-18 00:50:10 +00:00
};
nativeBuildInputs = [ lua ];
buildInputs = with llvmPackages; [ llvm clang-unwrapped ncurses ];
doCheck = true;
enableParallelBuilding = true;
hardeningDisable = [ "fortify" ];
outputs = [ "bin" "dev" "out" "static" ];
patches = [ ./nix-cflags.patch ];
postPatch = ''
substituteInPlace Makefile \
--replace '-lcurses' '-lncurses'
substituteInPlace src/terralib.lua \
2019-09-24 07:22:39 +01:00
--subst-var-by NIX_LIBC_INCLUDE ${stdenv.lib.getDev stdenv.cc.libc}/include
2016-01-18 00:50:10 +00:00
'';
preBuild = ''
cat >Makefile.inc<<EOF
CLANG = ${stdenv.lib.getBin llvmPackages.clang-unwrapped}/bin/clang
LLVM_CONFIG = ${stdenv.lib.getBin llvmPackages.llvm}/bin/llvm-config
EOF
2016-01-18 00:50:10 +00:00
mkdir -p build
cp ${luajitSrc} build/${luajitArchive}
'';
checkPhase = "(cd tests && ../terra run)";
2016-01-18 00:50:10 +00:00
installPhase = ''
2019-04-27 14:47:19 +01:00
install -Dm755 -t $bin/bin release/bin/terra
install -Dm755 -t $out/lib release/lib/terra${stdenv.hostPlatform.extensions.sharedLibrary}
install -Dm644 -t $static/lib release/lib/libterra.a
mkdir -pv $dev/include
cp -rv release/include/terra $dev/include
2019-04-27 14:47:19 +01:00
'';
2016-01-18 00:50:10 +00:00
meta = with stdenv.lib; {
description = "A low-level counterpart to Lua";
homepage = "http://terralang.org/";
platforms = platforms.x86_64;
maintainers = with maintainers; [ jb55 thoughtpolice ];
license = licenses.mit;
2016-01-18 00:50:10 +00:00
};
}