1{ lib
2, stdenv
3, fetchFromGitHub
4, makeWrapper
5, gforth
6}:
7
8stdenv.mkDerivation {
9 pname = "gbforth";
10 version = "unstable-2023-03-02";
11
12 src = fetchFromGitHub {
13 owner = "ams-hackers";
14 repo = "gbforth";
15 rev = "428fcf5054fe301e90ac74b1d920ee3ecc375b5b";
16 hash = "sha256-v1bdwT15Wg1VKpo74Cc3tsTl1uOKvKdlHWtbZkJ/qbA=";
17 };
18
19 nativeBuildInputs = [
20 makeWrapper
21 ];
22
23 dontBuild = true;
24
25 installPhase = ''
26 runHook preInstall
27 mkdir -p $out/share/gbforth $out/bin
28 cp -r lib shared src gbforth.fs $out/share/gbforth/
29 makeWrapper ${gforth}/bin/gforth $out/bin/gbforth \
30 --set GBFORTH_PATH $out/share/gbforth/lib \
31 --add-flags $out/share/gbforth/gbforth.fs
32 runHook postInstall
33 '';
34
35 doInstallCheck = true;
36 installCheckPhase = ''
37 runHook preInstallCheck
38 $out/bin/gbforth examples/simon/simon.fs
39 runHook postInstallCheck
40 '';
41
42 meta = with lib; {
43 homepage = "https://gbforth.org/";
44 description = "A Forth-based Game Boy development kit";
45 longDescription = ''
46 A Forth-based Game Boy development kit.
47 It features a Forth-based assembler, a cross-compiler with support for
48 lazy code generation and a library of useful words.
49 '';
50 license = licenses.mit;
51 platforms = platforms.all;
52 maintainers = with maintainers; [ fgaz ];
53 };
54}