Skip to content

Commit a5766a1

Browse files
committed
premake5: fix build on Darwin and arm64
1 parent 0f88b38 commit a5766a1

File tree

1 file changed

+25
-11
lines changed
  • pkgs/development/tools/misc/premake

1 file changed

+25
-11
lines changed

pkgs/development/tools/misc/premake/5.nix

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,30 @@
22
lib,
33
stdenv,
44
fetchFromGitHub,
5-
libuuid,
5+
6+
# build inputs
67
cacert,
8+
libuuid,
9+
10+
# build inputs (darwin)
711
readline,
812
}:
913

10-
stdenv.mkDerivation rec {
14+
stdenv.mkDerivation (finalAttrs: {
1115
pname = "premake5";
1216
version = "5.0.0-beta4";
1317

1418
src = fetchFromGitHub {
1519
owner = "premake";
1620
repo = "premake-core";
17-
rev = "v${version}";
21+
rev = "v${finalAttrs.version}";
1822
sha256 = "sha256-sNLCyIHWDW/8jIrMFCZAqtWsh4SRugqtPR4HaoW/Vzk=";
1923
};
2024

2125
buildInputs =
22-
[ libuuid ]
26+
[
27+
libuuid
28+
]
2329
++ lib.optionals stdenv.hostPlatform.isDarwin [
2430
readline
2531
];
@@ -28,29 +34,32 @@ stdenv.mkDerivation rec {
2834
postPatch =
2935
''
3036
substituteInPlace contrib/curl/premake5.lua \
31-
--replace "ca = nil" "ca = '${cacert}/etc/ssl/certs/ca-bundle.crt'"
37+
--replace-fail "ca = nil" "ca = '${cacert}/etc/ssl/certs/ca-bundle.crt'"
3238
''
3339
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
3440
substituteInPlace premake5.lua \
35-
--replace -mmacosx-version-min=10.4 -mmacosx-version-min=10.5 \
3641
--replace-fail '"-arch arm64"' '""' \
3742
--replace-fail '"-arch x86_64"' '""'
3843
''
3944
+ lib.optionalString stdenv.hostPlatform.isStatic ''
4045
substituteInPlace \
4146
binmodules/example/premake5.lua \
4247
binmodules/luasocket/premake5.lua \
43-
--replace SharedLib StaticLib
48+
--replace-fail SharedLib StaticLib
4449
'';
4550

4651
buildPhase =
4752
if stdenv.hostPlatform.isDarwin then
53+
# Error compiling the builtin zlib source, but it's not used currently
4854
''
49-
make -f Bootstrap.mak osx
55+
make PREMAKE_OPTS="--zlib-src=none" \
56+
PLATFORM="Universal" \
57+
-f Bootstrap.mak osx
5058
''
5159
else
5260
''
53-
make -f Bootstrap.mak linux
61+
make PLATFORM=${stdenv.hostPlatform.linuxArch} \
62+
-f Bootstrap.mak linux
5463
'';
5564

5665
env.NIX_CFLAGS_COMPILE = toString (
@@ -71,6 +80,11 @@ stdenv.mkDerivation rec {
7180
description = "Simple build configuration and project generation tool using lua";
7281
mainProgram = "premake5";
7382
license = lib.licenses.bsd3;
74-
platforms = lib.platforms.darwin ++ lib.platforms.linux;
83+
platforms = [
84+
"x86_64-linux"
85+
"aarch64-linux"
86+
"x86_64-darwin"
87+
"aarch64-darwin"
88+
];
7589
};
76-
}
90+
})

0 commit comments

Comments
 (0)