Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 17.09 72 lines 1.9 kB view raw
1{ stdenv, lib, fetchurl, hostPlatform }: 2rec { 3 4 luajit = luajit_2_1; 5 6 luajit_2_0 = generic { 7 version = "2.0.5"; 8 isStable = true; 9 sha256 = "0yg9q4q6v028bgh85317ykc9whgxgysp76qzaqgq55y6jy11yjw7"; 10 } // { 11 # 64-bit ARM isn't supported upstream 12 meta = meta // { 13 platforms = lib.filter (p: p != "aarch64-linux") meta.platforms; 14 }; 15 }; 16 17 luajit_2_1 = generic { 18 version = "2.1.0-beta3"; 19 isStable = false; 20 sha256 = "1hyrhpkwjqsv54hnnx4cl8vk44h9d6c9w0fz1jfjz00w255y7lhs"; 21 }; 22 23 24 meta = with stdenv.lib; { 25 description = "High-performance JIT compiler for Lua 5.1"; 26 homepage = http://luajit.org; 27 license = licenses.mit; 28 platforms = platforms.linux ++ platforms.darwin; 29 maintainers = with maintainers ; [ thoughtpolice smironov vcunat ]; 30 }; 31 32 generic = 33 { version, sha256 ? null, isStable 34 , name ? "luajit-${version}" 35 , src ? 36 (fetchurl { 37 url = "http://luajit.org/download/LuaJIT-${version}.tar.gz"; 38 inherit sha256; 39 }) 40 }: 41 42 stdenv.mkDerivation rec { 43 inherit name version src meta; 44 45 luaversion = "5.1"; 46 47 patchPhase = '' 48 substituteInPlace Makefile \ 49 --replace /usr/local "$out" 50 51 substituteInPlace src/Makefile --replace gcc cc 52 '' + stdenv.lib.optionalString (stdenv.cc.libc != null) 53 '' 54 substituteInPlace Makefile \ 55 --replace ldconfig ${stdenv.cc.libc.bin or stdenv.cc.libc}/bin/ldconfig 56 ''; 57 58 configurePhase = false; 59 60 buildFlags = [ "amalg" ]; # Build highly optimized version 61 enableParallelBuilding = true; 62 63 installPhase = '' 64 make install INSTALL_INC="$out"/include PREFIX="$out" 65 ln -s "$out"/bin/luajit-* "$out"/bin/lua 66 '' 67 + stdenv.lib.optionalString (!isStable) 68 '' 69 ln -s "$out"/bin/luajit-* "$out"/bin/luajit 70 ''; 71 }; 72}