1{ lib
2, stdenv
3, fetchFromGitHub
4, buildPackages
5}:
6
7stdenv.mkDerivation (finalAttrs: {
8 pname = "pforth";
9 version = "2.0.1";
10
11 src = fetchFromGitHub {
12 owner = "philburk";
13 repo = "pforth";
14 rev = "v${finalAttrs.version}";
15 hash = "sha256-vEjFeHSJl+yAtatYJEnu+r9hmOr/kZOgIbSUXR/c8WU=";
16 };
17
18 # We build the dictionary in a cross-compile compatible way.
19 # For that, we perform steps, that the Makefile would otherwise do.
20 buildPhase = ''
21 runHook preBuild
22 make -C platforms/unix pfdicapp
23 pushd fth/
24 ${stdenv.hostPlatform.emulator buildPackages} ../platforms/unix/pforth -i system.fth
25 ${stdenv.hostPlatform.emulator buildPackages} ../platforms/unix/pforth -d pforth.dic <<< "include savedicd.fth sdad bye"
26 mv pforth.dic pfdicdat.h ../platforms/unix/
27 popd
28 make -C platforms/unix pforthapp
29 runHook postBuild
30 '';
31
32 installPhase = ''
33 runHook preInstall
34 install -Dm755 platforms/unix/pforth_standalone $out/bin/pforth
35 mkdir -p $out/share/pforth
36 cp -r fth/* $out/share/pforth/
37 runHook postInstall
38 '';
39
40 meta = {
41 homepage = "http://www.softsynth.com/pforth/";
42 description = "Portable Portable ANS-like Forth written in ANSI 'C'";
43 changelog = "https://github.com/philburk/pforth/blob/v${finalAttrs.version}/RELEASES.md";
44 license = lib.licenses.bsd0;
45 maintainers = with lib.maintainers; [ AndersonTorres yrashk ];
46 platforms = lib.platforms.unix;
47 };
48})
49# TODO: option for install the non-standalone executable