Files
Emily fdb820602b treewide: drop simple x86_64-darwin mentions
To reproduce:

    $ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
        -- scan --update-all --inline-rules '
          id: nix-x86_64-darwin
          language: nix
          rule:
            any:
              - pattern: "\"x86_64-darwin\""
                kind: list_expression > string_expression
              - pattern:
                  context: "{ \"x86_64-darwin\" = $EXPR; }"
                  selector: binding
              - pattern:
                  context: "{ x86_64-darwin = $EXPR; }"
                  selector: binding
          fix:
            template: ""
        ' pkgs
    $ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
        -- scan --update-all --inline-rules '
          id: json-first-x86_64-darwin
          language: json
          rule:
            kind: object > pair:nth-child(1)
            has:
              pattern: "\"x86_64-darwin\""
              field: key
          fix:
            template: ""
            expandEnd: { regex: "," }
        ' pkgs
    $ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
        -- scan --update-all --inline-rules '
          id: json-x86_64-darwin
          language: json
          rule:
            kind: object > pair
            has:
              pattern: "\"x86_64-darwin\""
              field: key
          fix:
            template: ""
            expandStart: { regex: "," }
        ' pkgs
    $ git restore pkgs/by-name/om/omnix/package.nix
    $ git diff --name-only -z \
        | nix shell nixpkgs/3b32825de172d0bc85664f495edb096b10862524#gnused \
            -c xargs -0 sed -i '/^$/N; /^\n\? \+$/d'
    $ treefmt
2026-07-15 03:58:16 +01:00

99 lines
2.4 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
# build inputs
cacert,
libuuid,
# build inputs (darwin)
readline,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "premake5";
version = "5.0.0-beta8";
src = fetchFromGitHub {
owner = "premake";
repo = "premake-core";
rev = "v${finalAttrs.version}";
hash = "sha256-Tl/XU9Hy/VZw59S4K478EaLgE88/oTzLCe+DoVwtlcU=";
};
buildInputs = [
libuuid
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
readline
];
patches = [
# https://github.com/premake/premake-core/issues/2614
(fetchpatch {
name = "0001-premake5-Fix-filters-using-alias-value.patch";
url = "https://github.com/premake/premake-core/commit/d01097bb38da6855beeef7158b8b04ab1e63249b.patch";
hash = "sha256-ZGhNUoXZbbW9ioFnAgPwypYhepoChtWF1SOCxs1WLj8=";
})
./no-curl-ca.patch
];
postPatch = ''
substituteInPlace contrib/curl/premake5.lua \
--replace-fail "ca = nil" "ca = '${cacert}/etc/ssl/certs/ca-bundle.crt'"
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace premake5.lua \
--replace-fail '"-arch arm64"' '""' \
--replace-fail '"-arch x86_64"' '""'
''
+ lib.optionalString stdenv.hostPlatform.isStatic ''
substituteInPlace \
binmodules/example/premake5.lua \
binmodules/luasocket/premake5.lua \
--replace-fail SharedLib StaticLib
'';
buildPhase =
if stdenv.hostPlatform.isDarwin then
# Error compiling the builtin zlib source, but it's not used currently
''
make PREMAKE_OPTS="--zlib-src=none" \
PLATFORM="Universal" \
-f Bootstrap.mak osx
''
else
''
make PLATFORM=${stdenv.hostPlatform.linuxArch} \
-f Bootstrap.mak linux
'';
env.NIX_CFLAGS_COMPILE = toString (
lib.optionals stdenv.cc.isClang [
"-Wno-error=implicit-function-declaration"
]
);
installPhase = ''
install -Dm755 bin/release/premake5 $out/bin/premake5
'';
premake_cmd = "premake5";
setupHook = ./setup-hook.sh;
meta = {
homepage = "https://premake.github.io";
description = "Simple build configuration and project generation tool using lua";
mainProgram = "premake5";
license = lib.licenses.bsd3;
maintainers = [ lib.maintainers.sarahec ];
platforms = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
];
};
})