summary refs log tree commit diff
path: root/pkgs/by-name/m2/m2libc/package.nix
blob: 6c7b695ef715e4ba08b4ffb4f524a8a697fbf12e (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
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "m2libc";
  version = "unstable-2023-05-22";

  src = fetchFromGitHub {
    owner = "oriansj";
    repo = "M2libc";
    rev = "de7c75f144176c3b9be77695d9bf94440445aeae";
    hash = "sha256-248plvODhBRfmx7zOmf05ICbk8vzSbaceZJ0j+wPaAY=";
  };

  patches = [
    # # aarch64: syscall: mkdir -> mkdirat
    # https://github.com/oriansj/M2libc/pull/17
    (fetchpatch {
      url = "https://github.com/oriansj/M2libc/commit/ff7c3023b3ab6cfcffc5364620b25f8d0279e96b.patch";
      hash = "sha256-QAKddv4TixIQHpFa9SVu9fAkeKbzhQaxjaWzW2yJy7A=";
    })
  ];

  installPhase = ''
    runHook preInstall

    mkdir -p $out/include
    cp -r . $out/include/M2libc

    runHook postInstall
  '';

  meta = with lib; {
    description = "More standards compliant C library written in M2-Planet's C subset";
    homepage = "https://github.com/oriansj/m2libc";
    license = licenses.gpl3Only;
    maintainers = teams.minimal-bootstrap.members;
    platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "riscv32-linux" "riscv64-linux" ];
  };
})