Skip to content

Commit

Permalink
pforth: allow cross-compile
Browse files Browse the repository at this point in the history
  • Loading branch information
nagy authored and AndersonTorres committed Jul 14, 2023
1 parent da56af6 commit 971ef1a
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions pkgs/development/compilers/pforth/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
, buildPackages
}:

stdenv.mkDerivation (finalAttrs: {
Expand All @@ -14,14 +15,26 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-vEjFeHSJl+yAtatYJEnu+r9hmOr/kZOgIbSUXR/c8WU=";
};

dontConfigure = true;

preBuild = ''
cd platforms/unix
# We build the dictionary in a cross-compile compatible way.
# For that, we perform steps, that the Makefile would otherwise do.
buildPhase = ''
runHook preBuild
make -C platforms/unix pfdicapp
pushd fth/
${stdenv.hostPlatform.emulator buildPackages} ../platforms/unix/pforth -i system.fth
${stdenv.hostPlatform.emulator buildPackages} ../platforms/unix/pforth -d pforth.dic <<< "include savedicd.fth sdad bye"
mv pforth.dic pfdicdat.h ../platforms/unix/
popd
make -C platforms/unix pforthapp
runHook postBuild
'';

installPhase = ''
install -Dm755 pforth_standalone $out/bin/pforth
runHook preInstall
install -Dm755 platforms/unix/pforth_standalone $out/bin/pforth
mkdir -p $out/share/pforth
cp -r fth/* $out/share/pforth/
runHook postInstall
'';

meta = {
Expand Down

0 comments on commit 971ef1a

Please sign in to comment.