mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-06 05:13:37 +00:00
The package set is built entirely from source using the stdenv and Hugs. This also replaces the recently added microhs package, which was built from pre-generated compiler output. Co-authored-by: sternenseemann <sternenseemann@systemli.org>
51 lines
1.3 KiB
Nix
51 lines
1.3 KiB
Nix
{
|
|
args,
|
|
hugs,
|
|
microhs,
|
|
stdenv,
|
|
}:
|
|
|
|
stdenv.mkDerivation (
|
|
finalAttrs:
|
|
let
|
|
args' = args finalAttrs;
|
|
in
|
|
args'
|
|
// {
|
|
pname = "microhs-cpphs";
|
|
|
|
nativeBuildInputs = [ hugs ];
|
|
|
|
makeFlags = [ "USECPPHS=$(TMP)/cpphs-boot" ];
|
|
buildFlags = [
|
|
"bootstrapcpphs"
|
|
"bin/cpphs"
|
|
];
|
|
|
|
# Generate cpphs-boot and populate paths that the target uses
|
|
# We can't use cpphs-hugs directly because it's too primitive
|
|
preBuild = ''
|
|
mkdir -p $TMP/cpphs-hugs/src
|
|
cp -r hugs/* cpphscompat/* cpphssrc/malcolm-wallace-universe/{polyparse-*/src,cpphs-*}/* $TMP/cpphs-hugs/src/
|
|
find $TMP/cpphs-hugs/src -type f -name '*.hs' -exec ${hugs}/bin/cpphs-hugs --noline '{}' '-O{}.tmp' \;
|
|
find $TMP/cpphs-hugs/src -type f -name '*.hs' -exec mv '{}.tmp' '{}' \;
|
|
sed -i -e '/fail *= *Fail\.fail/d' $TMP/cpphs-hugs/src/Text/ParserCombinators/Poly/Parser.hs
|
|
|
|
${microhs}/bin/mhs -l -i$TMP/cpphs-hugs/src $TMP/cpphs-hugs/src/cpphs.hs -o$TMP/cpphs-boot
|
|
|
|
mkdir -p bin generated
|
|
touch cpphssrc/malcolm-wallace-universe/.git targets.conf
|
|
cp ${microhs}/bin/mhs bin/mhs
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
install -m755 -d $out/bin
|
|
install -m755 bin/cpphs $out/bin/cpphs
|
|
runHook postInstall
|
|
'';
|
|
|
|
doInstallCheck = false;
|
|
}
|
|
)
|