diff options
author | Karel Kočí <cynerd@email.cz> | 2023-01-26 11:31:01 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2023-01-30 09:54:34 +0100 |
commit | af2839518ef448b37fd258d0158a8546f63c7246 (patch) | |
tree | 2a5233d12c4b360dd2a7301d4196f4e3c1cd1a79 /pkgs/development/interpreters | |
parent | 16d84e969372088c1434aadfec7364ee17b2cf12 (diff) |
luajit: fix cross build for 32 bit architectures
The 32bit compiler has to be used when building on 64bit system.
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r-- | pkgs/development/interpreters/luajit/default.nix | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/pkgs/development/interpreters/luajit/default.nix b/pkgs/development/interpreters/luajit/default.nix index 411220870e1a..8596e379e710 100644 --- a/pkgs/development/interpreters/luajit/default.nix +++ b/pkgs/development/interpreters/luajit/default.nix @@ -52,6 +52,15 @@ let ++ optional enableVMAssertions "-DLUAJIT_USE_ASSERT" ++ optional deterministicStringIds "-DLUAJIT_SECURITY_STRID=0" ; + + # LuaJIT requires build for 32bit architectures to be build on x86 not x86_64 + # TODO support also other build architectures. The ideal way would be to use + # stdenv_32bit but that doesn't work due to host platform mismatch: + # https://github.com/NixOS/nixpkgs/issues/212494 + buildStdenv = if buildPackages.stdenv.isx86_64 && stdenv.is32bit + then buildPackages.pkgsi686Linux.buildPackages.stdenv + else buildPackages.stdenv; + in stdenv.mkDerivation rec { pname = "luajit"; @@ -88,8 +97,7 @@ stdenv.mkDerivation rec { "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" + "HOST_CC=${buildStdenv.cc}/bin/cc" ] ++ lib.optional enableJITDebugModule "INSTALL_LJLIBD=$(INSTALL_LMOD)"; enableParallelBuilding = true; NIX_CFLAGS_COMPILE = XCFLAGS; |