summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2019-03-08 00:04:33 +0100
committerRicardo Wurmus <rekado@elephly.net>2019-03-08 00:07:45 +0100
commit933dad9156bfb05fc264fda01de351839403316b (patch)
tree8e5662bb1b7327a649df40c8a9bb1d982e996632
parentd6234620ace1863d8102b065311ef3d94e0931da (diff)
downloadguix-933dad9156bfb05fc264fda01de351839403316b.tar.gz
gnu: Add mruby.
* gnu/packages/ruby.scm (mruby): New variable.
-rw-r--r--gnu/packages/ruby.scm61
1 files changed, 61 insertions, 0 deletions
diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index 66eb2607e6..818553848d 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -34,6 +34,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages bison)
   #:use-module (gnu packages check)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages crypto)
@@ -160,6 +161,66 @@ a focus on simplicity and productivity.")
                    (delete-file-recursively "ext/fiddle/libffi-3.2.1")
                    #t))))))
 
+(define-public mruby
+  (package
+    (name "mruby")
+    (version "2.0.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/mruby/mruby.git")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1r6w1asjshff43ymdwa6xmrkggza99mi2kw88k7ic6ag2j81hcj5"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'unpack 'enable-verbose-tests
+           (lambda _
+             (substitute* "Makefile"
+               (("ruby ./minirake" m)
+                (string-append m " --verbose")))
+             #t))
+         (add-after 'unpack 'disable-broken-tests
+           (lambda _
+             (substitute* "mrbgems/mruby-io/test/io.rb"
+               (("assert\\('IO.popen.+$" m)
+                (string-append m "skip \"Hangs in the Guix build environment\"\n"))
+               (("assert\\('IO#isatty.+$" m)
+                (string-append m "skip \"Disable for Guix; there is no /dev/tty\"\n"))
+               ;; This one is really weird.  The *expected* output is all wrong.
+               (("assert\\('`cmd`.*" m)
+                (string-append m "skip \"Disable for Guix\"\n"))
+               (("echo foo")
+                (string-append (which "echo") " foo")))
+             #t))
+         ;; There is no install target
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (lib (string-append out "/lib")))
+               (mkdir-p bin)
+               (copy-recursively "build/host/bin" bin)
+               (mkdir-p lib)
+               (copy-recursively "build/host/lib" lib))
+             #t)))))
+    (native-inputs
+     `(("ruby" ,ruby)
+       ("bison" ,bison)))
+    (home-page "https://github.com/mruby/mruby")
+    (synopsis "Lightweight Ruby")
+    (description "mruby is the lightweight implementation of the Ruby
+language.  Its syntax is Ruby 1.9 compatible.  mruby can be linked and
+embedded within your application.")
+    (license license:expat)))
+
 (define-public ruby-commander
   (package
     (name "ruby-commander")