pforth: allow cross-compile

This commit is contained in:
Daniel Nagy 2023-07-09 19:15:00 +02:00 committed by Anderson Torres
parent da56af6c22
commit 971ef1a8e0

View file

@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchFromGitHub
, buildPackages
}:
stdenv.mkDerivation (finalAttrs: {
@ -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 = {