blob: 7b288ebe4120e8ba4b796e2de3c0c241ed802bbe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
{
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;
}
)
|