about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/gbforth/default.nix
blob: e85e621cff16cfdc04db9f87732434ec56d6af1d (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
{ lib
, stdenv
, fetchFromGitHub
, makeWrapper
, gforth
}:

stdenv.mkDerivation {
  pname = "gbforth";
  version = "unstable-2023-03-02";

  src = fetchFromGitHub {
    owner = "ams-hackers";
    repo = "gbforth";
    rev = "428fcf5054fe301e90ac74b1d920ee3ecc375b5b";
    hash = "sha256-v1bdwT15Wg1VKpo74Cc3tsTl1uOKvKdlHWtbZkJ/qbA=";
  };

  nativeBuildInputs = [
    makeWrapper
  ];

  dontBuild = true;

  installPhase = ''
    runHook preInstall
    mkdir -p $out/share/gbforth $out/bin
    cp -r lib shared src gbforth.fs $out/share/gbforth/
    makeWrapper ${gforth}/bin/gforth $out/bin/gbforth \
      --set GBFORTH_PATH $out/share/gbforth/lib \
      --add-flags $out/share/gbforth/gbforth.fs
    runHook postInstall
  '';

  doInstallCheck = true;
  installCheckPhase = ''
    runHook preInstallCheck
    $out/bin/gbforth examples/simon/simon.fs
    runHook postInstallCheck
  '';

  meta = with lib; {
    homepage = "https://gbforth.org/";
    description = "A Forth-based Game Boy development kit";
    longDescription = ''
      A Forth-based Game Boy development kit.
      It features a Forth-based assembler, a cross-compiler with support for
      lazy code generation and a library of useful words.
    '';
    license = licenses.mit;
    platforms = platforms.all;
    maintainers = with maintainers; [ fgaz ];
  };
}