Subject: [PATCH 2/3] gnu: Add mruby-zest.

From: Alexandros Theodotou <[email-masked]>
Date: Sat, 04 Apr 2020 22:10:52 +0100

Hi,

This patch adds mruby-zest, a dependency of zynfusion. I had some help
from the developer for making it build without connecting to the
internet.

Thanks,
Alex
From fd6550f32f534591cb6aba4b9575bae405bc1094 Mon Sep 17 00:00:00 2001
From: Alexandros Theodotou <[email-masked]>
Date: Sat, 4 Apr 2020 22:03:31 +0100
Subject: [PATCH 2/3] gnu: Add mruby-zest.

* gnu/packages/audio.scm (mruby-zest): New variable.
---
 gnu/packages/audio.scm | 93 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 93 insertions(+)

diff --git a/gnu/packages/audio.scm b/gnu/packages/audio.scm
index f368fedee7..99f3737ed2 100644
--- a/gnu/packages/audio.scm
+++ b/gnu/packages/audio.scm
@@ -66,6 +66,7 @@
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages gnunet) ; libmicrohttpd
@@ -75,6 +76,7 @@
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages image)
   #:use-module (gnu packages libbsd)
+  #:use-module (gnu packages libevent)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages llvm)
@@ -93,6 +95,7 @@
   #:use-module (gnu packages qt)
   #:use-module (gnu packages rdf)
   #:use-module (gnu packages readline)
+  #:use-module (gnu packages ruby)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages telephony)
@@ -4160,3 +4163,93 @@ minimum.")
      `(("librsvg" ,librsvg)
        ,@(package-inputs ztoolkit)))
     (synopsis "ZToolkit with SVG support")))
+
+(define-public mruby-zest
+  (package
+    (name "mruby-zest")
+    (version "3.0.5-ba39aabd")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               ;; this is a meta repo that packs the mruby dependencies
+               ;; as submodules
+               (url "https://github.com/mruby-zest/mruby-zest-build.git")
+               ;; ghaction branch - suggested by the developer to avoid
+               ;; automatic downloading of some unneeded and
+               ;; hard-to-package dependencies used for debugging
+               (commit  "ba39aabd8d4ddc5f14137083b6f9a96c536f5f12")
+               (recursive? #t)))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          "1vqzdds30sr982dp7fclg4r19l44rv8pbz6h4a8vcginj494gvjn"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; no check target
+       #:make-flags
+       (list (string-append "CC=gcc"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'use-installed-libuv
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (let* ((libuv (assoc-ref inputs "libuv-static")))
+              (copy-file (string-append libuv "/lib/libuv.a")
+                         "deps/libuv.a")
+              (substitute* "Makefile"
+                           (("\\.\\./\\.\\./deps/\\$\\(UV_DIR\\)/include")
+                            (string-append libuv "/include")))
+              (substitute* "Makefile"
+                           (("\\./deps/\\$\\(UV_DIR\\)/\\.libs/libuv\\.a")
+                            (string-append libuv "/lib/libuv.a"))))))
+         (add-after 'unpack 'disable-unused-deps
+          (lambda _
+            (substitute* "build_config.rb"
+                         (("conf\\.gem 'deps/mruby-file-stat'")
+                          "#"))
+            (substitute* "deps/mruby-dir-glob/mrbgem.rake"
+                         (("spec\\.add_dependency 'mruby-file-stat'")
+                          "#"))
+            #t))
+         (replace 'configure
+           (lambda _
+             (invoke "make" "builddep")))
+        (add-before 'install 'pack
+          (lambda _
+            (setenv "CC" "gcc")
+            (invoke "make" "pack")))
+         (replace 'install
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out   (assoc-ref outputs "out"))
+                    (lib   (string-append out "/lib/zynfusion")))
+               (mkdir-p lib)
+               (copy-recursively "package" lib)
+               #t)))
+         (add-after 'install 'rename-to-zyn-fusion
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref %outputs "out"))
+                    (lib (string-append out "/lib/zynfusion")))
+               (rename-file (string-append lib "/zest")
+                            ;; zynfusion expects this name
+                            (string-append lib "/zyn-fusion"))
+               #t))))))
+    (inputs
+     `(("libx11" ,libx11)
+       ("cairo" ,cairo)
+       ("mesa" ,mesa)
+       ("libuv-static" ,libuv-static)
+       ("ruby" ,ruby)
+       ("mruby" ,mruby)))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("bison" ,bison)
+       ("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("libtool" ,libtool)
+       ("python-2" ,python-2)))
+    (home-page "https://github.com/mruby-zest/mruby-zest")
+    (synopsis "Widget classes for ZynFusion")
+    (description
+     "MRuby-Zest is a set of widgets needed to create the 'ZynFusion'
+user interface of ZynAddSubFX.")
+    (license license:lgpl2.1+)))
-- 
2.26.0