From 65c7c61841652e070ca4f0209df142aa7c69ea73 Mon Sep 17 00:00:00 2001 From: Charles Strahan Date: Wed, 21 Jan 2015 20:37:05 -0500 Subject: [PATCH] ruby: use patch for libv8 --- .../ruby/bundler-env/default-gem-config.nix | 9 +- .../interpreters/ruby/bundler-env/location.rb | 84 ------------------- 2 files changed, 7 insertions(+), 86 deletions(-) delete mode 100644 pkgs/development/interpreters/ruby/bundler-env/location.rb diff --git a/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix b/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix index b4ae465d37e..71fe06f7f44 100644 --- a/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix +++ b/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix @@ -19,7 +19,7 @@ { lib, fetchurl, writeScript, ruby, libxml2, libxslt, python, stdenv, which , libiconv, postgresql, v8, v8_3_16_14, clang, sqlite, zlib, imagemagick, pkgconfig -, ncurses, xapian, gpgme, utillinux +, ncurses, xapian, gpgme, utillinux, fetchpatch }: let @@ -39,9 +39,14 @@ in libv8 = attrs: { buildInputs = [ which v8 python ]; # The "--with-system-v8" flag doesn't seem to work... + patches = [ + (fetchpatch { + url = https://github.com/cowboyd/libv8/pull/161.patch; + sha256 = "1l6572cmigc22g249jj8h0xlbig88mj43kdqdbimhw2pmpv3q0rs"; + }) + ]; postPatch = '' rm -r vendor - cp ${./location.rb} ext/libv8/location.rb cat <<-EOF > ext/libv8/extconf.rb require 'mkmf' create_makefile('libv8') diff --git a/pkgs/development/interpreters/ruby/bundler-env/location.rb b/pkgs/development/interpreters/ruby/bundler-env/location.rb deleted file mode 100644 index bea759d6a0c..00000000000 --- a/pkgs/development/interpreters/ruby/bundler-env/location.rb +++ /dev/null @@ -1,84 +0,0 @@ -# See: https://github.com/cowboyd/libv8/pull/161 - -require 'yaml' -require 'pathname' -require File.expand_path '../paths', __FILE__ - -module Libv8 - class Location - def install! - File.open(Pathname(__FILE__).dirname.join('.location.yml'), "w") do |f| - f.write self.to_yaml - end - return 0 - end - - def self.load! - File.open(Pathname(__FILE__).dirname.join('.location.yml')) do |f| - YAML.load f - end - end - - class Vendor < Location - def install! - require File.expand_path '../builder', __FILE__ - builder = Libv8::Builder.new - exit_status = builder.build_libv8! - super if exit_status == 0 - verify_installation! - return exit_status - end - def configure(context = MkmfContext.new) - context.incflags.insert 0, Libv8::Paths.include_paths.map{|p| "-I#{p}"}.join(" ") + " " - context.ldflags.insert 0, Libv8::Paths.object_paths.join(" ") + " " - end - - def verify_installation! - Libv8::Paths.object_paths.each do |p| - fail ArchiveNotFound, p unless File.exist? p - end - end - - class ArchiveNotFound < StandardError - def initialize(filename) - super "libv8 did not install properly, expected binary v8 archive '#{filename}'to exist, but it was not found" - end - end - end - - class System < Location - def configure(context = MkmfContext.new) - context.send(:dir_config, 'v8') - context.send(:find_header, 'v8.h') or fail NotFoundError - context.send(:have_library, 'v8') or fail NotFoundError - end - - class NotFoundError < StandardError - def initialize(*args) - super(<<-EOS) -You have chosen to use the version of V8 found on your system -and *not* the one that is bundle with the libv8 rubygem. However, -it could not be located. please make sure you have a version of -v8 that is compatible with #{Libv8::VERSION} installed. You may -need to special --with-v8-dir options if it is in a non-standard -location - -thanks, -The Mgmt - -EOS - end - end - end - - class MkmfContext - def incflags - $INCFLAGS - end - - def ldflags - $LDFLAGS - end - end - end -end