summary refs log tree commit diff
path: root/pkgs/development/interpreters/lua-5
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2014-04-21 10:00:35 +0200
committeraszlig <aszlig@redmoonstudios.org>2014-04-21 10:00:35 +0200
commit625d7b9043be673a8df33cc842ec5032d7705c06 (patch)
tree38777f48f2bb7b403b3e9f148000d0ffa8026cde /pkgs/development/interpreters/lua-5
parentcdd1c9caa5d2a6eb184ec159bcfde3ac9745c56d (diff)
parent2d3376e84e4a24ca10480a9ade972db1e5c54e9f (diff)
downloadnixlib-625d7b9043be673a8df33cc842ec5032d7705c06.tar
nixlib-625d7b9043be673a8df33cc842ec5032d7705c06.tar.gz
nixlib-625d7b9043be673a8df33cc842ec5032d7705c06.tar.bz2
nixlib-625d7b9043be673a8df33cc842ec5032d7705c06.tar.lz
nixlib-625d7b9043be673a8df33cc842ec5032d7705c06.tar.xz
nixlib-625d7b9043be673a8df33cc842ec5032d7705c06.tar.zst
nixlib-625d7b9043be673a8df33cc842ec5032d7705c06.zip
Merge pull request #1928 from 'cross-win-osx'.
This includes a lot of fixes for cross-building to Windows and Mac OS X
and could possibly fix things even for non-cross-builds, like for
example OpenSSL on Windows.

The main reason for merging this in 14.04 already is that we already
have runInWindowsVM in master and it doesn't work until we actually
cross-build Cygwin's setup binary as the upstream version is a fast
moving target which gets _overwritten_ on every new release.

Conflicts:
	pkgs/top-level/all-packages.nix
Diffstat (limited to 'pkgs/development/interpreters/lua-5')
-rw-r--r--pkgs/development/interpreters/lua-5/5.2.nix33
1 files changed, 32 insertions, 1 deletions
diff --git a/pkgs/development/interpreters/lua-5/5.2.nix b/pkgs/development/interpreters/lua-5/5.2.nix
index 3e7323e461d1..f346b1b09868 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 = if stdenv.isDarwin then [ ./5.2.darwin.patch ] else [ dsoPatch ];
 
@@ -54,6 +54,37 @@ stdenv.mkDerivation rec {
     EOF
   '';
 
+  crossAttrs = let
+    isMingw = stdenv.cross.libc == "msvcrt";
+    isDarwin = stdenv.cross.libc == "libSystem";
+  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}
+        ${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin ''
+        AR="${stdenv.cross.config}-ar rcu"
+        macosx
+        ''}
+      )
+    '' + stdenv.lib.optionalString isMingw ''
+      installFlagsArray=(
+        TO_BIN="lua.exe luac.exe"
+        TO_LIB="liblua.a lua52.dll"
+        INSTALL_DATA="cp -d"
+      )
+    '';
+  } // stdenv.lib.optionalAttrs isDarwin {
+    postPatch = ''
+      sed -i -e 's/-Wl,-soname[^ ]* *//' src/Makefile
+    '';
+  };
+
   meta = {
     homepage = "http://www.lua.org";
     description = "Powerful, fast, lightweight, embeddable scripting language";