base16-schemes: unstable-2024-06-21 -> unstable-2024-11-12
[NixPkgs.git] / pkgs / by-name / pf / pforth / package.nix
blob91efc25fc1e0bc01c6dd74820d0483dd28b01422
1 { lib
2 , stdenv
3 , fetchFromGitHub
4 , buildPackages
5 }:
7 stdenv.mkDerivation (finalAttrs: {
8   pname = "pforth";
9   version = "2.0.1";
11   src = fetchFromGitHub {
12     owner = "philburk";
13     repo = "pforth";
14     rev = "v${finalAttrs.version}";
15     hash = "sha256-vEjFeHSJl+yAtatYJEnu+r9hmOr/kZOgIbSUXR/c8WU=";
16   };
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   '';
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   '';
40   meta = {
41     homepage = "https://www.softsynth.com/pforth/";
42     description = "Portable Portable ANS-like Forth written in ANSI 'C'";
43     mainProgram = "pforth";
44     changelog = "https://github.com/philburk/pforth/blob/v${finalAttrs.version}/RELEASES.md";
45     license = lib.licenses.bsd0;
46     maintainers = with lib.maintainers; [ AndersonTorres yrashk ];
47     platforms = lib.platforms.unix;
48   };
50 # TODO: option for install the non-standalone executable