summaryrefslogtreecommitdiff
path: root/custom/luaSha2.nix
blob: aa520c25d4ecfd42cb4e2f2c500bad2225ca3ebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
{ stdenv
, fetchgit
, pkgs
}:

let
  lua = pkgs.lua51Packages.lua;
in pkgs.lua51Packages.buildLuaPackage {
  name = "luaSha2";
  src = fetchgit {
    url = "https://code.google.com/p/sha2";
    rev = "02bd4bfdc8062c7e1ae51c5a72906efc0a6375ee";
    sha256 = "57ca5f1fb63b00aba7bcbb6e153a7878bc855a0cc6fb539abba33933da727c6f";
  };
  buildPhase = ''
    gcc -L${lua}/lib -I$LUA_INC -I. sha2.c sha2lib.c -fPIC -DSHA2_USE_INTTYPES_H -DBYTE_ORDER -DLITTLE_ENDIAN -llua -shared -o sha2.so
  '';
  installPhase = ''
    mkdir -p $out/lib/lua/${lua.luaversion}
    install sha2.so $out/lib/lua/${lua.luaversion}
  '';
}