about summary refs log tree commit diff
path: root/pkgs/development/interpreters
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2014-02-24 06:46:07 +0100
committeraszlig <aszlig@redmoonstudios.org>2014-02-24 07:26:25 +0100
commit4f69722ee55cd1a685da069e6683f1af9eae645b (patch)
tree2ac7c9e2037223f1b3ad7b870f299cbf605aa777 /pkgs/development/interpreters
parentfbc307a18322c42db500aaebeaa21e0e93e82162 (diff)
downloadnixlib-4f69722ee55cd1a685da069e6683f1af9eae645b.tar
nixlib-4f69722ee55cd1a685da069e6683f1af9eae645b.tar.gz
nixlib-4f69722ee55cd1a685da069e6683f1af9eae645b.tar.bz2
nixlib-4f69722ee55cd1a685da069e6683f1af9eae645b.tar.lz
nixlib-4f69722ee55cd1a685da069e6683f1af9eae645b.tar.xz
nixlib-4f69722ee55cd1a685da069e6683f1af9eae645b.tar.zst
nixlib-4f69722ee55cd1a685da069e6683f1af9eae645b.zip
lua52/cross: Allow to cross-compile to mingw-w64.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r--pkgs/development/interpreters/lua-5/5.2.nix25
1 files changed, 24 insertions, 1 deletions
diff --git a/pkgs/development/interpreters/lua-5/5.2.nix b/pkgs/development/interpreters/lua-5/5.2.nix
index 70ab0c3bdf8b..609c6b3e404a 100644
--- a/pkgs/development/interpreters/lua-5/5.2.nix
+++ b/pkgs/development/interpreters/lua-5/5.2.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
     sha256 = "004zyh9p3lpvbwhyhlmrw6wwcia5abx84q4h2brkn4zdypipvmiz";
   };
 
-  buildInputs = [ readline ];
+  nativeBuildInputs = [ readline ];
 
   patches = [ dsoPatch ];
 
@@ -49,6 +49,29 @@ stdenv.mkDerivation rec {
     EOF
   '';
 
+  crossAttrs = let
+    isMingwW64 = stdenv.cross.config == "x86_64-w64-mingw32";
+  in {
+    configurePhase = ''
+      makeFlagsArray=(
+        INSTALL_TOP=$out
+        INSTALL_MAN=$out/share/man/man1
+        CC=${stdenv.cross.config}-gcc
+        STRIP=:
+        RANLIB=${stdenv.cross.config}-ranlib
+        V=${majorVersion}
+        R=${version}
+        ${stdenv.lib.optionals isMingwW64 "mingw"}
+      )
+    '' + stdenv.lib.optionalString isMingwW64 ''
+      installFlagsArray=(
+        TO_BIN="lua.exe luac.exe"
+        TO_LIB="liblua.a lua52.dll"
+        INSTALL_DATA="cp -d"
+      )
+    '';
+  };
+
   meta = {
     homepage = "http://www.lua.org";
     description = "Powerful, fast, lightweight, embeddable scripting language";