about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2018-07-30 17:08:48 +0200
committerVladimír Čunát <vcunat@gmail.com>2018-07-30 17:08:48 +0200
commit597a5936d325ca594f7cf9654d65c4ce03ac0472 (patch)
tree1bc1ea6bd5230f58524d8a3d40fd2fead00558c4 /pkgs
parent837a9a467715e1fe67d672ae005d7ec1a929885c (diff)
downloadnixlib-597a5936d325ca594f7cf9654d65c4ce03ac0472.tar
nixlib-597a5936d325ca594f7cf9654d65c4ce03ac0472.tar.gz
nixlib-597a5936d325ca594f7cf9654d65c4ce03ac0472.tar.bz2
nixlib-597a5936d325ca594f7cf9654d65c4ce03ac0472.tar.lz
nixlib-597a5936d325ca594f7cf9654d65c4ce03ac0472.tar.xz
nixlib-597a5936d325ca594f7cf9654d65c4ce03ac0472.tar.zst
nixlib-597a5936d325ca594f7cf9654d65c4ce03ac0472.zip
lua*Packages.compat53: init at 0.7
The manual compilation is weird, but there's only a rockspec upstream,
and I don't know how to use that well inside the nix build.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/top-level/lua-packages.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix
index e7c947ca4d26..42b5a0de08cb 100644
--- a/pkgs/top-level/lua-packages.nix
+++ b/pkgs/top-level/lua-packages.nix
@@ -72,6 +72,44 @@ let
     };
   };
 
+  compat53 = buildLuaPackage rec {
+    version = "0.7";
+    name = "compat53-${version}";
+
+    src = fetchFromGitHub {
+      owner = "keplerproject";
+      repo = "lua-compat-5.3";
+      rev = "v${version}";
+      sha256 = "02a14nvn7aggg1yikj9h3dcf8aqjbxlws1bfvqbpfxv9d5phnrpz";
+    };
+
+    nativeBuildInputs = [ pkgconfig ];
+
+    postConfigure = ''
+      CFLAGS+=" -shared $(pkg-config --libs ${if isLuaJIT then "luajit" else "lua"})"
+    '';
+
+    buildPhase = ''
+      cc lstrlib.c $CFLAGS -o string.so
+      cc ltablib.c $CFLAGS -o table.so
+      cc lutf8lib.c $CFLAGS -o utf8.so
+    '';
+
+    # There's no need to separate *.lua and *.so, I guess?  TODO: conventions?
+    installPhase = ''
+      install -Dt "$out/lib/lua/${lua.luaversion}/compat53" \
+        compat53/*.lua *.so
+    '';
+
+    meta = with stdenv.lib; {
+      description = "Compatibility module providing Lua-5.3-style APIs for Lua 5.2 and 5.1";
+      homepage = "https://github.com/keplerproject/lua-compat-5.3";
+      license = licenses.mit;
+      maintainers = with maintainers; [ vcunat ];
+      platforms = platforms.all;
+    };
+  };
+
   cqueues = buildLuaPackage rec {
     name = "cqueues-${version}";
     version = "20171014";