1{ stdenv, fetchurl }:
2
3stdenv.mkDerivation rec {
4 name = "luajit-${version}";
5 version = "2.1.0-beta1";
6 luaversion = "5.1";
7
8 src = fetchurl {
9 url = "http://luajit.org/download/LuaJIT-${version}.tar.gz";
10 sha256 = "06170d38387c59d1292001a166e7f5524f5c5deafa8705a49a46fa42905668dd";
11 };
12
13 enableParallelBuilding = true;
14
15 patchPhase = ''
16 substituteInPlace Makefile \
17 --replace /usr/local $out
18
19 substituteInPlace src/Makefile --replace gcc cc
20 '' + stdenv.lib.optionalString (stdenv.cc.libc != null)
21 ''
22 substituteInPlace Makefile \
23 --replace ldconfig ${stdenv.cc.libc.bin or stdenv.cc.libc}/bin/ldconfig
24 '';
25
26 configurePhase = false;
27 buildFlags = [ "amalg" ]; # Build highly optimized version
28 installPhase = ''
29 make install INSTALL_INC=$out/include PREFIX=$out
30 ln -s $out/bin/luajit* $out/bin/lua
31 ln -s $out/bin/luajit* $out/bin/luajit
32 '';
33
34 meta = with stdenv.lib; {
35 description = "High-performance JIT compiler for Lua 5.1";
36 homepage = http://luajit.org;
37 license = licenses.mit;
38 platforms = platforms.linux ++ platforms.darwin;
39 maintainers = with maintainers ; [ thoughtpolice smironov ];
40 };
41}