unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Sughosha via Guix-patches via <guix-patches@gnu.org>
To: "63254@debbugs.gnu.org" <63254@debbugs.gnu.org>
Subject: [bug#63254] [PATCH v3 4/5] gnu: Add mruby-zest.
Date: Thu, 04 May 2023 08:37:50 +0000	[thread overview]
Message-ID: <4UQSmfkT8PD3IZFQBYvYwM_cjtjE7zZZ3pvjsbRTsOBm25G-XvEHHZrKG1Z46Ew_dfuhzEl3fvi3kYBnV4U-STg6mwezJv88PkPtIk3fdTc=@proton.me> (raw)
In-Reply-To: <xFwn-qV2bLvixSdTGGbORhvuP891xykYhD_AoAITAeE8IZ30TMVhpOthI979E6g9Lz58sV-jrnzgWICclGC2AXR0ZWvWbwGzvI3SxrKSREU=@proton.me>

* gnu/packages/mruby-xyz.scm: New file.
* gnu/local.mk: Register the file.
---
 gnu/local.mk               |   1 +
 gnu/packages/mruby-xyz.scm | 176 +++++++++++++++++++++++++++++++++++++
 2 files changed, 177 insertions(+)
 create mode 100644 gnu/packages/mruby-xyz.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index aa50fc0465..6f213b2e7f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -436,6 +436,7 @@ GNU_SYSTEM_MODULES =				\
   %D%/packages/mpd.scm				\
   %D%/packages/mp3.scm				\
   %D%/packages/mpi.scm				\
+  %D%/packages/mruby-xyz.scm			\
   %D%/packages/multiprecision.scm		\
   %D%/packages/music.scm			\
   %D%/packages/musl.scm				\
diff --git a/gnu/packages/mruby-xyz.scm b/gnu/packages/mruby-xyz.scm
new file mode 100644
index 0000000000..5524976dec
--- /dev/null
+++ b/gnu/packages/mruby-xyz.scm
@@ -0,0 +1,176 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2023 <sughosha@proton.me>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages mruby-xyz)
+  #:use-module (guix packages)
+  #:use-module (guix git-download)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix gexp)
+  #:use-module (guix utils)
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages audio)
+  #:use-module (gnu packages bash)
+  #:use-module (gnu packages fonts)
+  #:use-module (gnu packages gl)
+  #:use-module (gnu packages libevent)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages ruby)
+  #:use-module (gnu packages xorg))
+
+(define-public mruby-zest
+  (package
+    (name "mruby-zest")
+    (version "3.0.6")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/mruby-zest/mruby-zest-build")
+                    (commit version)
+                    ;; Cloning recursively for and the required mruby sources
+                    ;; and gems.
+                    (recursive? #t)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0dz4zv1km9805lji2q2qqdd8s8hgfd723dxdzcivbhm612szm1mc"))
+              (modules '((guix build utils)))
+              (snippet
+               ;; This packages contains a custom "pugl". Replacing it with the
+               ;; system "pugl" fails to build.
+               ;; Delete the bundled "libuv", "nanovg" and "rtosc".
+               '(with-directory-excursion "deps"
+                  (for-each delete-file-recursively
+                   (list "libuv" "nanovg" "rtosc"))))))
+    (build-system gnu-build-system)
+    (arguments
+     (list #:tests? #f ;no test suite
+           #:make-flags
+           #~(list (string-append "CC=" #$(cc-for-target))
+                    "CONFIG_SHELL=bash")
+           #:phases
+           #~(modify-phases %standard-phases
+               (delete 'configure) ;no configure script
+               (add-after 'unpack 'patch-paths
+                 (lambda* (#:key inputs #:allow-other-keys)
+                   ;; Do not compile "nanovg" and "libuv" and use the system
+                   ;; provided versions of them.
+                   (substitute* "Makefile"
+                     (("cd deps/nanovg") "#cd deps/nanovg")
+                     (("\\$\\(AR\\) rc deps/libnanovg\\.a")
+                      "#$(AR) rc deps/libnanovg.a")
+                     (("\\./deps/libnanovg\\.a")
+                      "-lnanovg")
+                     (("cd deps/libuv") "#cd deps/libuv")
+                     (("\\./deps/libuv/\\.libs/libuv\\.a")
+                      "-luv")
+                     (("\\./deps/libuv/\\.libs/libuv-win\\.a")
+                      "-luv-win"))
+                   (substitute* "build_config.rb"
+                     (("#\\{`pwd`\\.strip\\}/\\.\\./deps/libnanovg\\.a")
+                      "-lnanovg")
+                     (("#\\{`pwd`\\.strip\\}/\\.\\./deps/libuv\\.a")
+                      "-luv")
+                     (("cc\\.include_paths.*\\./deps/nanovg/.*$")
+                      "#")
+                     (("cc\\.include_paths.*\\./deps/libuv/.*$")
+                      "#"))
+                   (substitute* "deps/mruby-nanovg/src/nvg_screenshot.c"
+                    (("\\.\\./\\.\\./nanovg/.*/stb_image_write\\.h")
+                     (search-input-file inputs "/example/stb_image_write.h")))
+                   ;; Use the system provided "rtosc" headers.
+                   (substitute* "src/mruby-widget-lib/src/gem.c"
+                     (("\"\\.\\./\\.\\./\\.\\./deps/.*/rtosc\\.h\"")
+                      "<rtosc/rtosc.h>"))
+                   ;; Fix missing fonts.
+                   (substitute*
+                    "src/mruby-widget-lib/mrblib/script.rb"
+                     (("sans = \\[")
+                      (string-append
+                       "sans = [\""
+                       (search-input-file inputs
+                        "/share/fonts/truetype/Roboto-Regular.ttf")
+                        "\", "))
+                     (("bold = \\[")
+                      (string-append
+                       "bold = [\""
+                       (search-input-file inputs
+                        "/share/fonts/truetype/Roboto-Bold.ttf")
+                        "\", ")))
+                   ;; Fix paths for zyn-fusion files.
+                   (substitute* "src/osc-bridge/src/bridge.c"
+                     (("fopen\\(\\\"schema/")
+                      (string-append
+                       "fopen(\"" #$output "/share/zyn-fusion/schema/")))
+                   (substitute* "test-libversion.c"
+                     (("./libzest.so")
+                      (string-append #$output "/lib/libzest.so")))
+                   (substitute* "src/mruby-widget-lib/src/api.c"
+                     ((", \\\"\\./qml/") ", \"../share/zyn-fusion/qml/")
+                     (("\\./qml/")
+                      (string-append #$output "/share/zyn-fusion/qml")))))
+               (replace 'install
+                 (lambda _
+                   (rename-file "zest" "zyn-fusion")
+                   (install-file "zyn-fusion" (string-append #$output "/bin"))
+                   (install-file "libzest.so" (string-append #$output "/lib"))
+                   (for-each
+                     (lambda (folder)
+                       (for-each
+                         (lambda (file)
+                           (install-file file
+                            (string-append #$output "/share/zyn-fusion/qml")))
+                         (find-files folder "\\.qml$")))
+                     '("src/mruby-zest/qml" "src/mruby-zest/example"))
+                   (install-file "src/osc-bridge/schema/test.json"
+                    (string-append #$output "/share/zyn-fusion/schema"))
+                   (install-file "completions/zyn-fusion"
+                    (string-append
+                     #$output "/share/bash-completion/completions")))))))
+    (native-inputs
+     (list (package-source nanovg) ;for "stb_image_write.h"
+           pkg-config
+           ruby))
+    (inputs
+     (list font-google-roboto
+           libuv
+           libx11
+           mesa
+           ;; With the latest version of "nanovg" the contents are not
+           ;; displayed properly.
+           (let ((version "0")
+                 (revision "0")
+                 (commit "b83cf926525e7cea8d2483da2a75852b8c7b6d28"))
+             (package (inherit nanovg)
+               (version (git-version version revision commit))
+               (source
+                (origin
+                  (method git-fetch)
+                  (uri (git-reference
+                         (url "https://github.com/memononen/nanovg")
+                         (commit commit)))
+                  (sha256
+                   (base32
+                    "1zp355pw6xnb5mjarz67cxkglv7j1s0qzv705fz1wf0gl0sjhy8f"))))))
+           rtosc))
+    (home-page "https://github.com/mruby-zest/mruby-zest-build")
+    (synopsis "Zyn-Fusion user interface")
+    (description
+     "This package provides user interface for Zyn-Fusion.")
+    (license
+     (list license:lgpl2.1))))
-- 
2.39.2





  parent reply	other threads:[~2023-05-04  8:39 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-03 22:58 [bug#63254] [PATCH 0/5] gnu: zynaddsubfx: Switch to Zyn-Fusion interface Sughosha via Guix-patches via
2023-05-03 23:00 ` [bug#63254] [PATCH 1/5] gnu: Add pugl Sughosha via Guix-patches via
2023-05-03 23:01 ` [bug#63254] [PATCH 2/5] gnu: Add nanovg Sughosha via Guix-patches via
2023-05-03 23:01 ` [bug#63254] [PATCH 3/5] gnu: Add rtosc Sughosha via Guix-patches via
2023-05-03 23:02 ` [bug#63254] [PATCH 4/5] gnu: Add mruby-zest Sughosha via Guix-patches via
2023-05-03 23:02 ` [bug#63254] [PATCH 5/5] gnu: zynaddsubfx: Switch to Zyn-Fusion interface Sughosha via Guix-patches via
2023-05-04  8:04 ` [bug#63254] [PATCH v2 0/5] " Sughosha via Guix-patches via
2023-05-04  8:05 ` [bug#63254] [PATCH v2 1/5] gnu: Add pugl Sughosha via Guix-patches via
2023-05-04  8:06 ` [bug#63254] [PATCH v2 2/5] gnu: Add nanovg Sughosha via Guix-patches via
2023-05-04  8:07 ` [bug#63254] [PATCH v2 3/5] gnu: Add rtosc Sughosha via Guix-patches via
2023-05-04  8:07 ` [bug#63254] [PATCH v2 4/5] gnu: Add mruby-zest Sughosha via Guix-patches via
2023-05-04  8:08 ` [bug#63254] [PATCH v2 5/5] gnu: zynaddsubfx: Switch to Zyn-Fusion interface Sughosha via Guix-patches via
2023-05-04  8:35 ` [bug#63254] [PATCH v3 0/5] " Sughosha via Guix-patches via
2023-05-04  8:36 ` [bug#63254] [PATCH v3 1/5] gnu: Add pugl Sughosha via Guix-patches via
2023-05-04  8:37 ` [bug#63254] [PATCH v3 2/5] gnu: Add nanovg Sughosha via Guix-patches via
2023-05-04  8:37 ` [bug#63254] [PATCH v3 3/5] gnu: Add rtosc Sughosha via Guix-patches via
2023-05-04  8:37 ` Sughosha via Guix-patches via [this message]
2023-05-04  8:38 ` [bug#63254] [PATCH v3 5/5] gnu: zynaddsubfx: Switch to Zyn-Fusion interface Sughosha via Guix-patches via
2023-06-16 18:59   ` [bug#63254] [PATCH v4 0/5] " Sughosha via Guix-patches via
2023-06-16 19:04     ` [bug#63254] [PATCH v4 5/5] " Sughosha via Guix-patches via
2023-06-16 19:02 ` [bug#63254] [PATCH v4 1/5] gnu: Add pugl Sughosha via Guix-patches via
2023-06-16 19:02 ` [bug#63254] [PATCH v4 2/5] gnu: Add nanovg Sughosha via Guix-patches via
2023-06-16 19:03 ` [bug#63254] [PATCH v4 3/5] gnu: Add rtosc Sughosha via Guix-patches via
2023-06-16 19:04 ` [bug#63254] [PATCH v4 4/5] gnu: Add mruby-zest Sughosha via Guix-patches via
2023-11-01  9:53 ` [bug#63254] [PATCH v5 1/4] gnu: Add nanovg Sughosha via Guix-patches via
2023-11-01  9:53   ` [bug#63254] [PATCH v5 2/4] gnu: Add rtosc Sughosha via Guix-patches via
2023-11-01  9:53   ` [bug#63254] [PATCH v5 3/4] gnu: Add mruby-zest Sughosha via Guix-patches via
2023-11-01  9:53   ` [bug#63254] [PATCH v5 4/4] gnu: zynaddsubfx: Switch to Zyn-Fusion interface Sughosha via Guix-patches via

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='4UQSmfkT8PD3IZFQBYvYwM_cjtjE7zZZ3pvjsbRTsOBm25G-XvEHHZrKG1Z46Ew_dfuhzEl3fvi3kYBnV4U-STg6mwezJv88PkPtIk3fdTc=@proton.me' \
    --to=guix-patches@gnu.org \
    --cc=63254@debbugs.gnu.org \
    --cc=Sughosha@proton.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).