about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/compilers/ghcjs/ghcjs-boot.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/ghcjs/ghcjs-boot.nix')
-rw-r--r--nixpkgs/pkgs/development/compilers/ghcjs/ghcjs-boot.nix25
1 files changed, 25 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/compilers/ghcjs/ghcjs-boot.nix b/nixpkgs/pkgs/development/compilers/ghcjs/ghcjs-boot.nix
new file mode 100644
index 000000000000..c00e13a92404
--- /dev/null
+++ b/nixpkgs/pkgs/development/compilers/ghcjs/ghcjs-boot.nix
@@ -0,0 +1,25 @@
+{ runCommand, src }:
+
+# we remove the patches so ghcjs-boot doesn't try to apply them again.
+runCommand "${src.name}-patched" {} ''
+  cp -r ${src} $out
+  chmod -R +w $out
+
+  # Make the patches be relative their corresponding package's directory.
+  # See: https://github.com/ghcjs/ghcjs-boot/pull/12
+  for patch in $out/patches/*.patch; do
+    echo ">> fixing patch: $patch"
+    sed -i -e 's@ \(a\|b\)/boot/[^/]\+@ \1@g' $patch
+  done
+
+  for package in $(cd $out/boot; echo *); do
+    patch=$out/patches/$package.patch
+    if [[ -e $patch ]]; then
+      echo ">> patching package: $package"
+      pushd $out/boot/$package
+      patch -p1 < $patch
+      rm $patch
+      popd
+    fi
+  done
+''