about summary refs log tree commit diff
path: root/pkgs/development/compilers/myrddin/default.nix
blob: 9ac2ed36be23cad9d26746cc55668210c99252a6 (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
52
53
54
55
56
57
58
59
{ stdenv
, lib
, fetchFromGitHub
, pkg-config
, bison
, binutils
, binutils-unwrapped
, makeWrapper
}:

stdenv.mkDerivation rec {
  pname = "myrddin";
  version = "0.3.1";

  src = fetchFromGitHub {
    repo = "mc";
    owner = "oridb";
    rev = "r${version}";
    sha256 = "7ImjiG/rIKGPHq3Vh/mftY7pqw/vfOxD3LJeT87HmCk=";
  };

  nativeBuildInputs = [
    bison
    pkg-config
    makeWrapper
  ];

  postPatch = ''
    substituteInPlace mk/c.mk \
        --replace "-Werror" ""
  '';

  buildPhase = ''
    make bootstrap
    make
  '';

  postInstall = ''
    for b in $out/bin/*; do
        wrapProgram $b --prefix PATH : $out/bin:${lib.makeBinPath [ binutils ]}
    done
  '';

  checkPhase = ''
    make check
  '';

  doCheck = true;

  meta = with lib; {
    # darwin: never built on Hydra https://hydra.nixos.org/job/nixpkgs/trunk/myrddin.x86_64-darwin
    broken = (stdenv.isLinux && stdenv.isAarch64) || stdenv.isDarwin;
    description = "Systems language that is both powerful and fun to use";
    homepage = "https://myrlang.org/";
    license = licenses.mit;
    maintainers = with maintainers; [ luc65r ];
    platforms = platforms.all;
  };
}