mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 22:50:49 +00:00
luajit: Expose build options, enable JIT debug module
This commit is contained in:
parent
bbb4a1be3d
commit
e34db5a568
|
@ -7,9 +7,33 @@
|
||||||
, callPackage
|
, callPackage
|
||||||
, self
|
, self
|
||||||
, packageOverrides ? (self: super: {})
|
, packageOverrides ? (self: super: {})
|
||||||
|
, enableFFI ? true
|
||||||
|
, enableJIT ? true
|
||||||
|
, enableJITDebugModule ? enableJIT
|
||||||
|
, enable52Compat ? false
|
||||||
|
, enableValgrindSupport ? false
|
||||||
|
, valgrind ? null
|
||||||
|
, enableGDBJITSupport ? false
|
||||||
|
, enableAPICheck ? false
|
||||||
|
, enableVMAssertions ? false
|
||||||
|
, useSystemMalloc ? false
|
||||||
}:
|
}:
|
||||||
|
assert enableJITDebugModule -> enableJIT;
|
||||||
|
assert enableGDBJITSupport -> enableJIT;
|
||||||
|
assert enableValgrindSupport -> valgrind != null;
|
||||||
let
|
let
|
||||||
luaPackages = callPackage ../../lua-modules {lua=self; overrides=packageOverrides;};
|
luaPackages = callPackage ../../lua-modules {lua=self; overrides=packageOverrides;};
|
||||||
|
|
||||||
|
XCFLAGS = with stdenv.lib;
|
||||||
|
optional (!enableFFI) "-DLUAJIT_DISABLE_FFI"
|
||||||
|
++ optional (!enableJIT) "-DLUAJIT_DISABLE_JIT"
|
||||||
|
++ optional enable52Compat "-DLUAJIT_ENABLE_LUA52COMPAT"
|
||||||
|
++ optional useSystemMalloc "-DLUAJIT_USE_SYSMALLOC"
|
||||||
|
++ optional enableValgrindSupport "-DLUAJIT_USE_VALGRIND"
|
||||||
|
++ optional enableGDBJITSupport "-DLUAJIT_USE_GDBJIT"
|
||||||
|
++ optional enableAPICheck "-DLUAJIT_USE_APICHECK"
|
||||||
|
++ optional enableVMAssertions "-DLUAJIT_USE_ASSERT"
|
||||||
|
;
|
||||||
in
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
inherit name version;
|
inherit name version;
|
||||||
|
@ -22,27 +46,36 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
substituteInPlace Makefile --replace ldconfig :
|
substituteInPlace Makefile --replace ldconfig :
|
||||||
|
if test -n "''${dontStrip-}"; then
|
||||||
|
# CCDEBUG must be non-empty or everything will be stripped, -g being
|
||||||
|
# passed by nixpkgs CC wrapper is insufficient on its own
|
||||||
|
substituteInPlace src/Makefile --replace "#CCDEBUG= -g" "CCDEBUG= -g"
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configurePhase = false;
|
configurePhase = false;
|
||||||
|
|
||||||
|
buildInputs = stdenv.lib.optional enableValgrindSupport valgrind;
|
||||||
|
|
||||||
|
buildFlags = [
|
||||||
|
"amalg" # Build highly optimized version
|
||||||
|
];
|
||||||
makeFlags = [
|
makeFlags = [
|
||||||
"PREFIX=$(out)"
|
"PREFIX=$(out)"
|
||||||
"DEFAULT_CC=cc"
|
"DEFAULT_CC=cc"
|
||||||
"CROSS=${stdenv.cc.targetPrefix}"
|
"CROSS=${stdenv.cc.targetPrefix}"
|
||||||
# TODO: when pointer size differs, we would need e.g. -m32
|
# TODO: when pointer size differs, we would need e.g. -m32
|
||||||
"HOST_CC=${buildPackages.stdenv.cc}/bin/cc"
|
"HOST_CC=${buildPackages.stdenv.cc}/bin/cc"
|
||||||
];
|
] ++ stdenv.lib.optional enableJITDebugModule "INSTALL_LJLIBD=$(INSTALL_LMOD)";
|
||||||
buildFlags = [ "amalg" ]; # Build highly optimized version
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
NIX_CFLAGS_COMPILE = XCFLAGS;
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
( cd "$out/include"; ln -s luajit-*/* . )
|
( cd "$out/include"; ln -s luajit-*/* . )
|
||||||
ln -s "$out"/bin/luajit-* "$out"/bin/lua
|
ln -s "$out"/bin/luajit-* "$out"/bin/lua
|
||||||
''
|
'' + stdenv.lib.optionalString (!isStable) ''
|
||||||
+ stdenv.lib.optionalString (!isStable) ''
|
ln -s "$out"/bin/luajit-* "$out"/bin/luajit
|
||||||
ln -s "$out"/bin/luajit-* "$out"/bin/luajit
|
'';
|
||||||
'';
|
|
||||||
|
|
||||||
LuaPathSearchPaths = [
|
LuaPathSearchPaths = [
|
||||||
"lib/lua/${luaversion}/?.lua" "share/lua/${luaversion}/?.lua"
|
"lib/lua/${luaversion}/?.lua" "share/lua/${luaversion}/?.lua"
|
||||||
|
@ -70,4 +103,3 @@ stdenv.mkDerivation rec {
|
||||||
maintainers = with maintainers; [ thoughtpolice smironov vcunat andir ];
|
maintainers = with maintainers; [ thoughtpolice smironov vcunat andir ];
|
||||||
} // extraMeta;
|
} // extraMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue