aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Woodcroft <donttrustben@gmail.com>2018-02-05 11:48:31 +0100
committerChristopher Baines <mail@cbaines.net>2018-05-18 11:54:03 +0100
commit772f164914ee311367dd29949089c1266408133c (patch)
tree542a0ef2e43db0e09395e1d9c564c7ec24836e24
parenta604be516293b307616a726f600e56fa232cfa45 (diff)
downloadguix-772f164914ee311367dd29949089c1266408133c.tar
guix-772f164914ee311367dd29949089c1266408133c.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 16d58b9806..5e9961d212 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1082,6 +1082,7 @@ dist_patch_DATA = \
%D%/packages/patches/ruby-concurrent-test-arm.patch \
%D%/packages/patches/ruby-rack-ignore-failing-test.patch \
%D%/packages/patches/ruby-rspec-its-remove-rspec-gemspec.patch\
+ %D%/packages/patches/ruby-therubyracer-fix-gemspec.patch \
%D%/packages/patches/ruby-tzinfo-data-ignore-broken-test.patch\
%D%/packages/patches/rxvt-unicode-escape-sequences.patch \
%D%/packages/patches/scheme48-tests.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 e3da4c3cf6..faa814d1ed 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)))