2016-06-23 00:21:15 +01:00
|
|
|
{ stdenv, fetchFromGitHub, fetchurl, llvmPackages, ncurses, lua }:
|
2016-06-15 00:37:37 +01:00
|
|
|
|
|
|
|
let
|
2018-12-21 11:57:16 +00:00
|
|
|
luajitArchive = "LuaJIT-2.0.5.tar.gz";
|
2016-06-15 00:37:37 +01:00
|
|
|
luajitSrc = fetchurl {
|
|
|
|
url = "http://luajit.org/download/${luajitArchive}";
|
2018-12-21 11:57:16 +00:00
|
|
|
sha256 = "0yg9q4q6v028bgh85317ykc9whgxgysp76qzaqgq55y6jy11yjw7";
|
2016-06-15 00:37:37 +01:00
|
|
|
};
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 13:41:18 +01:00
|
|
|
pname = "terra-git";
|
2018-12-21 11:57:16 +00:00
|
|
|
version = "1.0.0-beta1";
|
2016-01-18 00:50:10 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "zdevito";
|
|
|
|
repo = "terra";
|
2018-12-21 11:57:16 +00:00
|
|
|
rev = "release-${version}";
|
|
|
|
sha256 = "1blv3mbmlwb6fxkck6487ck4qq67cbwq6s1zlp86hy2wckgf8q2c";
|
2016-01-18 00:50:10 +00:00
|
|
|
};
|
|
|
|
|
2016-08-29 01:30:01 +01:00
|
|
|
outputs = [ "bin" "dev" "out" "static" ];
|
2016-06-15 00:37:37 +01:00
|
|
|
|
|
|
|
postPatch = ''
|
2016-01-18 00:50:10 +00:00
|
|
|
substituteInPlace Makefile --replace \
|
|
|
|
'-lcurses' '-lncurses'
|
|
|
|
'';
|
|
|
|
|
2016-06-15 00:37:37 +01:00
|
|
|
preBuild = ''
|
2016-06-23 00:21:15 +01:00
|
|
|
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}
|
|
|
|
'';
|
|
|
|
|
|
|
|
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
|
2016-06-15 00:37:37 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
2016-06-23 00:21:15 +01:00
|
|
|
buildInputs = with llvmPackages; [ lua llvm clang-unwrapped ncurses ];
|
2016-01-18 00:50:10 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A low-level counterpart to Lua";
|
2019-04-27 14:47:19 +01:00
|
|
|
homepage = http://terralang.org/;
|
|
|
|
platforms = platforms.x86_64;
|
2016-01-18 00:50:10 +00:00
|
|
|
maintainers = with maintainers; [ jb55 ];
|
|
|
|
license = licenses.mit;
|
|
|
|
};
|
|
|
|
}
|