1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
| | ;;; 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 ((revision "0")
(commit "b83cf926525e7cea8d2483da2a75852b8c7b6d28"))
(package (inherit nanovg)
(version (git-version (package-version nanovg) 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))))
|