nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5
6 # build inputs
7 cacert,
8 libuuid,
9
10 # build inputs (darwin)
11 readline,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "premake5";
16 version = "5.0.0-beta4";
17
18 src = fetchFromGitHub {
19 owner = "premake";
20 repo = "premake-core";
21 rev = "v${finalAttrs.version}";
22 sha256 = "sha256-sNLCyIHWDW/8jIrMFCZAqtWsh4SRugqtPR4HaoW/Vzk=";
23 };
24
25 buildInputs = [
26 libuuid
27 ]
28 ++ lib.optionals stdenv.hostPlatform.isDarwin [
29 readline
30 ];
31
32 patches = [ ./no-curl-ca.patch ];
33 postPatch = ''
34 substituteInPlace contrib/curl/premake5.lua \
35 --replace-fail "ca = nil" "ca = '${cacert}/etc/ssl/certs/ca-bundle.crt'"
36 ''
37 + lib.optionalString stdenv.hostPlatform.isDarwin ''
38 substituteInPlace premake5.lua \
39 --replace-fail '"-arch arm64"' '""' \
40 --replace-fail '"-arch x86_64"' '""'
41 ''
42 + lib.optionalString stdenv.hostPlatform.isStatic ''
43 substituteInPlace \
44 binmodules/example/premake5.lua \
45 binmodules/luasocket/premake5.lua \
46 --replace-fail SharedLib StaticLib
47 '';
48
49 buildPhase =
50 if stdenv.hostPlatform.isDarwin then
51 # Error compiling the builtin zlib source, but it's not used currently
52 ''
53 make PREMAKE_OPTS="--zlib-src=none" \
54 PLATFORM="Universal" \
55 -f Bootstrap.mak osx
56 ''
57 else
58 ''
59 make PLATFORM=${stdenv.hostPlatform.linuxArch} \
60 -f Bootstrap.mak linux
61 '';
62
63 env.NIX_CFLAGS_COMPILE = toString (
64 lib.optionals stdenv.cc.isClang [
65 "-Wno-error=implicit-function-declaration"
66 ]
67 );
68
69 installPhase = ''
70 install -Dm755 bin/release/premake5 $out/bin/premake5
71 '';
72
73 premake_cmd = "premake5";
74 setupHook = ./setup-hook.sh;
75
76 meta = {
77 homepage = "https://premake.github.io";
78 description = "Simple build configuration and project generation tool using lua";
79 mainProgram = "premake5";
80 license = lib.licenses.bsd3;
81 maintainers = [ lib.maintainers.sarahec ];
82 platforms = [
83 "x86_64-linux"
84 "aarch64-linux"
85 "x86_64-darwin"
86 "aarch64-darwin"
87 ];
88 };
89})