aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Woodcroft <donttrustben@gmail.com>2018-02-05 11:48:31 +0100
committerChristopher Baines <mail@cbaines.net>2018-12-31 10:01:11 +0000
commit58f99f335b8b7ec7ed57cd37a1a3ada41c57b755 (patch)
treeb2af0cf54fa043c29e7465947746a78175a4bd14
parent70d8ffaa2cd25d0f0b65cf64daf2cc4ffc2b5d12 (diff)
downloadgnu-guix-58f99f335b8b7ec7ed57cd37a1a3ada41c57b755.tar
gnu-guix-58f99f335b8b7ec7ed57cd37a1a3ada41c57b755.tar.gz
gnu: Add ruby-therubyracer.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/ruby-therubyracer-fix-gemspec.patch16
-rw-r--r--gnu/packages/ruby.scm57
3 files changed, 74 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index dc78fadc70..a596bbe7a0 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1144,6 +1144,7 @@ dist_patch_DATA = \
%D%/packages/patches/ruby-rspec-its-remove-rspec-gemspec.patch\
%D%/packages/patches/ruby-listen-patch-gemspec.patch \
%D%/packages/patches/ruby-listen-3.0.8-patch-gemspec.patch \
+ %D%/packages/patches/ruby-therubyracer-fix-gemspec.patch \
%D%/packages/patches/ruby-tzinfo-data-ignore-broken-test.patch\
%D%/packages/patches/rust-1.19-mrustc.patch \
%D%/packages/patches/rust-1.25-accept-more-detailed-gdb-lines.patch \
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 df519978f3..27e2662751 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -1384,6 +1384,63 @@ Ruby.")
(home-page "https://github.com/maik/xml-simple")
(license license:ruby)))
+(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)))
+ (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)))
+
(define-public ruby-thor
(package
(name "ruby-thor")