about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/misc/premake/5.nix
blob: a42d4c1a7b6e89c100eac0f9be798f9a58451a4b (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
49
50
51
{ lib, stdenv, fetchFromGitHub, libuuid, cacert, Foundation, readline }:

stdenv.mkDerivation rec {
  pname = "premake5";
  version = "5.0.0-beta2";

  src = fetchFromGitHub {
    owner = "premake";
    repo = "premake-core";
    rev = "v${version}";
    sha256 = "sha256-2R5gq4jaQsp8Ny1oGuIYkef0kn2UG9jMf20vq0714oY=";
  };

  buildInputs = [ libuuid ] ++ lib.optionals stdenv.isDarwin [ Foundation readline ];

  patches = [ ./no-curl-ca.patch ];
  postPatch = ''
    substituteInPlace contrib/curl/premake5.lua \
      --replace "ca = nil" "ca = '${cacert}/etc/ssl/certs/ca-bundle.crt'"
  '' + lib.optionalString stdenv.isDarwin ''
    substituteInPlace premake5.lua \
      --replace -mmacosx-version-min=10.4 -mmacosx-version-min=10.5
  '' + lib.optionalString stdenv.hostPlatform.isStatic ''
    substituteInPlace \
      binmodules/example/premake5.lua \
      binmodules/luasocket/premake5.lua \
      --replace SharedLib StaticLib
  '';

  buildPhase =
    if stdenv.isDarwin then ''
       make -f Bootstrap.mak osx
    '' else ''
       make -f Bootstrap.mak linux
    '';

  installPhase = ''
    install -Dm755 bin/release/premake5 $out/bin/premake5
  '';

  premake_cmd = "premake5";
  setupHook = ./setup-hook.sh;

  meta = {
    homepage = "https://premake.github.io";
    description = "A simple build configuration and project generation tool using lua";
    license = lib.licenses.bsd3;
    platforms = lib.platforms.darwin ++ lib.platforms.linux;
    broken = stdenv.isDarwin && stdenv.isAarch64;
  };
}