aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/patches/ruby-therubyracer-fix-gemspec.patch16
-rw-r--r--gnu/packages/ruby.scm57
2 files changed, 73 insertions, 0 deletions
diff --git a/gnu/packages/patches/ruby-therubyracer-fix-gemspec.patch b/gnu/packages/patches/ruby-therubyracer-fix-gemspec.patch
new file mode 100644
index 0000000000..83787192d2
--- /dev/null
+++ b/gnu/packages/patches/ruby-therubyracer-fix-gemspec.patch
@@ -0,0 +1,16 @@
+diff --git a/therubyracer.gemspec b/therubyracer.gemspec
+index 5a6ace7..95e2a27 100644
+--- a/therubyracer.gemspec
++++ b/therubyracer.gemspec
+@@ -8,9 +8,8 @@ Gem::Specification.new do |gem|
+ gem.description = "Call JavaScript code and manipulate JavaScript objects from Ruby. Call Ruby code and manipulate Ruby objects from JavaScript."
+ gem.homepage = "http://github.com/cowboyd/therubyracer"
+
+- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+- gem.files = `git ls-files`.split("\n")
+- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
++ gem.files = `find . -type f |sort`.split("\n")
++ gem.test_files = `find spec -type f |sort`.split("\n")
+ gem.name = "therubyracer"
+ gem.extensions = ["ext/v8/extconf.rb"]
+ gem.require_paths = ["lib", "ext"]
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 14c9fc845f..957eca690a 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -6318,3 +6318,60 @@ implementation of maps/hashes that use references and a reference queue.")
(home-page
"http://github.com/ruby-concurrency/ref")
(license license:expat)))
+
+(define-public ruby-therubyracer
+ (package
+ (name "ruby-therubyracer")
+ (version "0.12.2")
+ (source
+ (origin
+ (method url-fetch)
+ ;; Build from GitHub source so that patches can be applied.
+ (uri (string-append "https://github.com/cowboyd/therubyracer/archive/v"
+ version ".tar.gz"))
+ (file-name (string-append name "-" version ".tar.gz"))
+ (sha256
+ (base32
+ "0vyiacgg0hngl3gxh7n5lvskac5ms2rcbjrixj4mc8c2adhmqj1a"))
+ (patches (search-patches "ruby-therubyracer-fix-gemspec.patch"))))
+ (build-system ruby-build-system)
+ (arguments
+ `(#:test-target "spec"
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'extract-gemspec)
+ (add-before 'build 'fix-gemfile
+ (lambda _
+ (substitute* "Gemfile"
+ (("redjs.*") "redjs'\n")
+ ((".*gem-compiler.*") "\n"))
+ #t))
+ (add-before 'install 'prepare-libv8
+ ;; Since therubyracer requires 'libv8' when compiling native
+ ;; extensions during installation, it must be installed into the same
+ ;; gem directory. We make 'libv8' a native input and copy the entire
+ ;; libv8 gem directory into the the current output and install
+ ;; therubyracer into that.
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (copy-recursively
+ (assoc-ref inputs "ruby-libv8")
+ (assoc-ref outputs "out"))
+ #t))
+ (add-before 'check 'compile
+ (lambda _
+ (zero? (system* "rake" "compile")))))))
+ (propagated-inputs
+ `(("ruby-ref" ,ruby-ref)))
+ (native-inputs
+ `(("bundler" ,bundler)
+ ("ruby-redjs" ,ruby-redjs)
+ ("ruby-rspec" ,ruby-rspec-2)
+ ("ruby-rake-compiler" ,ruby-rake-compiler)
+ ("ruby-libv8" ,ruby-libv8-3.16.14)))
+ (synopsis
+ "Call JavaScript code and manipulate JavaScript objects from Ruby. Call Ruby code and manipulate Ruby objects from JavaScript.")
+ (description
+ "Call JavaScript code and manipulate JavaScript objects from Ruby. Call Ruby code and manipulate Ruby objects from JavaScript.")
+ (home-page
+ "http://github.com/cowboyd/therubyracer")
+ (license license:expat)))