lol
1{ runCommand, src }:
2
3# we remove the patches so ghcjs-boot doesn't try to apply them again.
4runCommand "${src.name}-patched" {} ''
5 cp -r ${src} $out
6 chmod -R +w $out
7
8 # Make the patches be relative their corresponding package's directory.
9 # See: https://github.com/ghcjs/ghcjs-boot/pull/12
10 for patch in $out/patches/*.patch; do
11 echo ">> fixing patch: $patch"
12 sed -i -e 's@ \(a\|b\)/boot/[^/]\+@ \1@g' $patch
13 done
14
15 for package in $(cd $out/boot; echo *); do
16 patch=$out/patches/$package.patch
17 if [[ -e $patch ]]; then
18 echo ">> patching package: $package"
19 pushd $out/boot/$package
20 patch -p1 < $patch
21 rm $patch
22 popd
23 fi
24 done
25''