1{ lib, stdenv, fetchFromGitHub, callPackage
2, autoreconfHook, texinfo, libffi
3}:
4
5let
6 swig = callPackage ./swig.nix { };
7 bootForth = callPackage ./boot-forth.nix { };
8 lispDir = "${placeholder "out"}/share/emacs/site-lisp";
9in stdenv.mkDerivation rec {
10
11 pname = "gforth";
12 version = "0.7.9_20230518";
13
14 src = fetchFromGitHub {
15 owner = "forthy42";
16 repo = "gforth";
17 rev = version;
18 hash = "sha256-rXtmmENBt9RMdLPq8GDyndh4+CYnCmz6NYpe3kH5OwU=";
19 };
20
21 nativeBuildInputs = [
22 autoreconfHook texinfo bootForth swig
23 ];
24 buildInputs = [
25 libffi
26 ];
27
28 passthru = { inherit bootForth; };
29
30 configureFlags = [
31 "--with-lispdir=${lispDir}"
32 ] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
33 "--build=x86_64-apple-darwin"
34 ];
35
36 preConfigure = ''
37 mkdir -p ${lispDir}
38 '';
39
40 meta = {
41 description = "The Forth implementation of the GNU project";
42 homepage = "https://github.com/forthy42/gforth";
43 license = lib.licenses.gpl3;
44 broken = stdenv.isDarwin && stdenv.isAarch64; # segfault when running ./gforthmi
45 platforms = lib.platforms.all;
46 };
47}