From f8a418cc2313bc2deda468a115d80fdd3264e29f Mon Sep 17 00:00:00 2001 From: Ben Woodcroft Date: Mon, 5 Feb 2018 11:48:31 +0100 Subject: gnu: Add ruby-therubyracer. --- gnu/local.mk | 1 + .../patches/ruby-therubyracer-fix-gemspec.patch | 16 ++++++ gnu/packages/ruby.scm | 57 ++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 gnu/packages/patches/ruby-therubyracer-fix-gemspec.patch diff --git a/gnu/local.mk b/gnu/local.mk index 77b3575f4a..7bf2c06a72 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1124,6 +1124,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-bootstrap-stage0-test.patch \ %D%/packages/patches/rust-coresimd-doctest.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 00ad7e8fc1..9d295457ba 100644 --- a/gnu/packages/ruby.scm +++ b/gnu/packages/ruby.scm @@ -1428,6 +1428,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") -- cgit v1.2.3