diff --git a/pkgs/development/interpreters/luajit/default.nix b/pkgs/development/interpreters/luajit/default.nix index c95b9e8b8e37..abd1fda47cb6 100644 --- a/pkgs/development/interpreters/luajit/default.nix +++ b/pkgs/development/interpreters/luajit/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl +{ stdenv, lib, fetchurl, buildPackages , name ? "luajit-${version}" , isStable , sha256 @@ -20,24 +20,23 @@ stdenv.mkDerivation rec { luaversion = "5.1"; - patchPhase = '' - substituteInPlace Makefile \ - --replace /usr/local "$out" - - substituteInPlace src/Makefile --replace gcc cc - '' + stdenv.lib.optionalString (stdenv.cc.libc != null) - '' - substituteInPlace Makefile \ - --replace ldconfig ${stdenv.cc.libc.bin or stdenv.cc.libc}/bin/ldconfig + postPatch = '' + substituteInPlace Makefile --replace ldconfig : ''; configurePhase = false; + makeFlags = [ + "PREFIX=$(out)" + "DEFAULT_CC=cc" + "CROSS=${stdenv.cc.targetPrefix}" + # TODO: when pointer size differs, we would need e.g. -m32 + "HOST_CC=${buildPackages.stdenv.cc}/bin/cc" + ]; buildFlags = [ "amalg" ]; # Build highly optimized version enableParallelBuilding = true; - installPhase = '' - make install PREFIX="$out" + postInstall = '' ( cd "$out/include"; ln -s luajit-*/* . ) ln -s "$out"/bin/luajit-* "$out"/bin/lua ''