summary refs log tree commit diff
path: root/pkgs/development/interpreters/ruby/patches.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/interpreters/ruby/patches.nix')
-rw-r--r--pkgs/development/interpreters/ruby/patches.nix29
1 files changed, 27 insertions, 2 deletions
diff --git a/pkgs/development/interpreters/ruby/patches.nix b/pkgs/development/interpreters/ruby/patches.nix
index 10b0b2023877..c4da956b57c8 100644
--- a/pkgs/development/interpreters/ruby/patches.nix
+++ b/pkgs/development/interpreters/ruby/patches.nix
@@ -1,5 +1,5 @@
 { fetchurl, writeScript, ruby, ncurses, sqlite, libxml2, libxslt, libffi
-, zlib, libuuid, gems, jdk, python }:
+, zlib, libuuid, gems, jdk, python, stdenv }:
 
 let
 
@@ -15,7 +15,32 @@ in
 {
   sup = { buildInputs = [ gems.ncursesw ]; };
 
-  libv8 = { buildInputs = [ python ]; };
+  libv8 = {
+    # This fix is needed to fool scons, which clears the environment by default.
+    # It's ugly, but it works.
+    #
+    # We create a gcc wrapper wrapper, which reexposes the environment variables
+    # that scons hides. Furthermore, they treat warnings as errors causing the
+    # build to fail, due to an unused variable.
+    #
+    # Finally, we must set CC and AR explicitly to allow scons to find the
+    # compiler and archiver
+    
+    preBuild = ''
+      cat > $TMPDIR/g++ <<EOF
+      #! ${stdenv.shell}
+      $(export)
+      
+      g++ \$(echo \$@ | sed 's/-Werror//g')
+      EOF
+      chmod +x $TMPDIR/g++
+      
+      
+      export CXX=$TMPDIR/g++
+      export AR=$(type -p ar)
+    '';
+    buildInputs = [ python ];
+  };
   
   sqlite3 = { propagatedBuildInputs = [ sqlite ]; };