aboutsummaryrefslogtreecommitdiff
path: root/nix/libluv.nix
blob: e2d4652e50d6963763cfd26cafc170bdf0e77e5e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{ luajitPackages, luajit, libuv, fetchurl, stdenv, fetchgit, cmake, git, ... }:
let
  # lua-libluv = luajitPackages.libluv.overrideAttrs (oldAttrs: rec {
  #   version = "1.50.0-1";
  #   buildInputs = [luajit libuv];
  #   knownRockspec = (fetchurl {
  #     url    = "mirror://luarocks/luv-${version}.rockspec";
  #     sha256 = "sha256-IL2EejtmT0pw0cAupMz0gvP3a19NPsc45W1RaoeGJgY=";
  #   }).outPath;
  #   src = fetchurl {
  #     url    = "https://github.com/luvit/luv/releases/download/${version}/luv-${version}.tar.gz";
  #     sha256 = "sha256-2GfDAk2cmB1U8u3YPhP9bcEVjwYIY197HA9rVYa1vDQ=";
  #   };
  # });

  # TODO: Figure out static linking
  lua-libluv = stdenv.mkDerivation rec {
    version = "1.50.0-1";
    pname = "libluv";
    src = fetchgit {
      url = "https://github.com/luvit/luv";
      tag = version;
      sha256 = "sha256-pmp/lUX2lAFMZA8LiL21G0fNFLEOpNWLp5UPBubTQeM=";
      fetchSubmodules = true;
      leaveDotGit = true;
    };
    cmakeFlags = [
      "-DBUILD_MODULE=OFF"
      "-DBUILD_STATIC_LIBS=ON"
      "-DWITH_LUA_ENGINE=LuaJIT"
      "-DWITH_SHARED_LIBUV=OFF"
      "-DLUA_BUILD_TYPE=System"
    ];
    postInstall = ''
      mkdir -p $out/lib/pkgconfig;
      cp $src/libluv.pc.in $out/lib/pkgconfig/libluv.pc;
      substituteInPlace $out/lib/pkgconfig/libluv.pc \
        --replace "@prefix@" "$out" \
        --replace "@libdir@" "$out/lib" \
        --replace "@includedir@" "$out/include" \
        --replace "@LUV_VERSION@" ${version} \
        --replace "@LIBS" "";
    '';
    buildInputs = [luajit libuv];
    nativeBuildInputs = [cmake git];
  };
in
  lua-libluv