libui 0.2.3-aarch64-linux → 0.3.0.pre-aarch64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -13
- data/lib/libui/ffi.rb +9 -0
- data/lib/libui/version.rb +1 -1
- data/lib/libui.rb +23 -3
- data/vendor/libui.aarch64.so +0 -0
- metadata +1 -2
- data/lib/libui/platform.rb +0 -164
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c574d66c9aed94a75cc4f6be9736d5dd7690a6cf2f782c0a4ef5f0da7e3665e7
|
|
4
|
+
data.tar.gz: fe67f24b496f5b5db00202e54a1414496a6f2997d9bbad250b686cb15a000b0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4440a926c29fc84608e413e9a4bc1ce12cd399c948f0b514af7f201e2b94586c83b4155a088dd4cba4307522a1969b28c98eec5a68700a630c1f70bf0a274cf0
|
|
7
|
+
data.tar.gz: 6781e13639949e951110884515fb88f0f3124e8a1744b8e737c38c9bf2d6bf5fde2daec0ceaf87456ef8014669882bb8f729d5185fca8a274aa1c89db6a90a45
|
data/README.md
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://github.com/kojix2/LibUI/actions/workflows/test.yml)
|
|
4
4
|
[](https://rubygems.org/gems/libui/versions)
|
|
5
|
-
[](https://tokei.kojix2.net/github/kojix2/LibUI)
|
|
6
5
|
<a href="https://github.com/AndyObtiva/glimmer-dsl-libui"><img alt="glimmer-dsl-libui" src="https://github.com/AndyObtiva/glimmer/blob/master/images/glimmer-logo-hi-res.svg" width="50" height="50" align="right"></a>
|
|
6
|
+
[](https://github.com/kojix2/libui-ng/actions/workflows/pre-build.yml)
|
|
7
|
+
[](https://tokei.kojix2.net/github/kojix2/LibUI)
|
|
7
8
|
|
|
8
9
|
LibUI is a Ruby wrapper for libui family.
|
|
9
10
|
|
|
@@ -185,18 +186,6 @@ bundle exec rake vendor:auto
|
|
|
185
186
|
bundle exec rake test
|
|
186
187
|
```
|
|
187
188
|
|
|
188
|
-
JRuby on macOS needs Java and AppKit must start on the first thread:
|
|
189
|
-
|
|
190
|
-
```sh
|
|
191
|
-
export JAVA_HOME=/path/to/openjdk
|
|
192
|
-
export JRUBY_OPTS=-J-XstartOnFirstThread
|
|
193
|
-
jruby -Ilib examples/basic_button.rb
|
|
194
|
-
jruby -S rake test
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
Take note that, as the above code shows, LibUI works via jruby as well, so you have an additional
|
|
198
|
-
GUI library (aside from jruby-swing by default) to test simple User Interfaces too.
|
|
199
|
-
|
|
200
189
|
### Pre-built shared libraries for libui-ng
|
|
201
190
|
|
|
202
191
|
Download pre-built libui-ng shared libraries (per your current platform):
|
data/lib/libui/ffi.rb
CHANGED
|
@@ -418,6 +418,7 @@ module LibUI
|
|
|
418
418
|
try_extern 'void uiDrawClip(uiDrawContext *c, uiDrawPath *path)'
|
|
419
419
|
try_extern 'void uiDrawSave(uiDrawContext *c)'
|
|
420
420
|
try_extern 'void uiDrawRestore(uiDrawContext *c)'
|
|
421
|
+
try_extern 'void uiDrawImage(uiDrawContext *c, uiImage *img, double x, double y, double width, double height)'
|
|
421
422
|
|
|
422
423
|
# uiAttribute
|
|
423
424
|
try_extern 'void uiFreeAttribute(uiAttribute *a)'
|
|
@@ -581,6 +582,14 @@ module LibUI
|
|
|
581
582
|
try_extern 'void uiFreeImage(uiImage *i)'
|
|
582
583
|
try_extern 'void uiImageAppend(uiImage *i, void *pixels, int pixelWidth, int pixelHeight, int byteStride)'
|
|
583
584
|
|
|
585
|
+
# uiImageView
|
|
586
|
+
try_extern 'uiImageView *uiNewImageView(void)'
|
|
587
|
+
try_extern 'void uiImageViewSetImage(uiImageView *iv, const uiImage *image)'
|
|
588
|
+
|
|
589
|
+
typealias 'uiImageViewContentMode', 'int'
|
|
590
|
+
|
|
591
|
+
try_extern 'void uiImageViewSetContentMode(uiImageView *iv, uiImageViewContentMode mode)'
|
|
592
|
+
|
|
584
593
|
# uiTable
|
|
585
594
|
try_extern 'void uiFreeTableValue(uiTableValue *v)'
|
|
586
595
|
|
data/lib/libui/version.rb
CHANGED
data/lib/libui.rb
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
1
|
require_relative 'libui/version'
|
|
2
2
|
require_relative 'libui/utils'
|
|
3
3
|
require_relative 'libui/error'
|
|
4
|
-
|
|
4
|
+
require 'rbconfig'
|
|
5
5
|
|
|
6
6
|
module LibUI
|
|
7
7
|
class << self
|
|
8
8
|
attr_accessor :ffi_lib
|
|
9
9
|
end
|
|
10
10
|
|
|
11
|
+
host_cpu = case RbConfig::CONFIG['host_cpu']
|
|
12
|
+
when /i\d86/
|
|
13
|
+
'x86'
|
|
14
|
+
else
|
|
15
|
+
RbConfig::CONFIG['host_cpu']
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
lib_name = [
|
|
19
|
+
# For libui-ng shared libraries compiled with (rake vendor:build)
|
|
20
|
+
"libui.#{RbConfig::CONFIG['host_cpu']}.#{RbConfig::CONFIG['SOEXT']}",
|
|
21
|
+
# For libui-ng shared library downloaded from RubyGems.org
|
|
22
|
+
"libui.#{host_cpu}.#{RbConfig::CONFIG['SOEXT']}",
|
|
23
|
+
# For backward compatibility or manual compilation of libui-ng
|
|
24
|
+
"libui.#{RbConfig::CONFIG['SOEXT']}"
|
|
25
|
+
]
|
|
26
|
+
|
|
11
27
|
self.ffi_lib = \
|
|
12
28
|
if ENV['LIBUIDIR'] && !ENV['LIBUIDIR'].empty?
|
|
13
|
-
|
|
29
|
+
lib_name.lazy
|
|
14
30
|
.map { |name| File.expand_path(name, ENV['LIBUIDIR']) }
|
|
15
31
|
.find { |path| File.exist?(path) }
|
|
16
32
|
else
|
|
17
|
-
|
|
33
|
+
lib_name.lazy
|
|
18
34
|
.map { |name| File.expand_path("../vendor/#{name}", __dir__) }
|
|
19
35
|
.find { |path| File.exist?(path) }
|
|
20
36
|
end
|
|
@@ -335,6 +351,10 @@ module LibUI
|
|
|
335
351
|
AtTrailing = 2
|
|
336
352
|
AtBottom = 3
|
|
337
353
|
|
|
354
|
+
# ImageViewContentMode
|
|
355
|
+
ImageViewContentCenter = 0
|
|
356
|
+
ImageViewContentFit = 1
|
|
357
|
+
|
|
338
358
|
# TableValueType
|
|
339
359
|
TableValueTypeString = 0
|
|
340
360
|
TableValueTypeImage = 1
|
data/vendor/libui.aarch64.so
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: libui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0.pre
|
|
5
5
|
platform: aarch64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- kojix2
|
|
@@ -36,7 +36,6 @@ files:
|
|
|
36
36
|
- lib/libui/ffi.rb
|
|
37
37
|
- lib/libui/fiddle_patch.rb
|
|
38
38
|
- lib/libui/libui_base.rb
|
|
39
|
-
- lib/libui/platform.rb
|
|
40
39
|
- lib/libui/utils.rb
|
|
41
40
|
- lib/libui/version.rb
|
|
42
41
|
- vendor/LICENSE.md
|
data/lib/libui/platform.rb
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
require 'rbconfig'
|
|
2
|
-
|
|
3
|
-
module LibUI
|
|
4
|
-
module Platform
|
|
5
|
-
CONFIG = {
|
|
6
|
-
'arm64-darwin' => {
|
|
7
|
-
vendor: 'vendor/libui.arm64.dylib',
|
|
8
|
-
lib_names: ['libui.arm64.dylib', 'libui.dylib'],
|
|
9
|
-
release_zip: 'macOS-arm64-shared-release.zip',
|
|
10
|
-
release_src: 'builddir/meson-out/libui.dylib'
|
|
11
|
-
},
|
|
12
|
-
'x86_64-darwin' => {
|
|
13
|
-
vendor: 'vendor/libui.x86_64.dylib',
|
|
14
|
-
lib_names: ['libui.x86_64.dylib', 'libui.dylib'],
|
|
15
|
-
release_zip: 'macOS-x64-shared-release.zip',
|
|
16
|
-
release_src: 'builddir/meson-out/libui.dylib'
|
|
17
|
-
},
|
|
18
|
-
'x86_64-linux' => {
|
|
19
|
-
vendor: 'vendor/libui.x86_64.so',
|
|
20
|
-
lib_names: ['libui.x86_64.so', 'libui.so'],
|
|
21
|
-
release_zip: 'Ubuntu-x64-shared-release.zip',
|
|
22
|
-
release_src: 'builddir/meson-out/libui.so'
|
|
23
|
-
},
|
|
24
|
-
'aarch64-linux' => {
|
|
25
|
-
vendor: 'vendor/libui.aarch64.so',
|
|
26
|
-
lib_names: ['libui.aarch64.so', 'libui.so'],
|
|
27
|
-
release_zip: 'Ubuntu-arm64-shared-release.zip',
|
|
28
|
-
release_src: 'builddir/meson-out/libui.so'
|
|
29
|
-
},
|
|
30
|
-
'x64-mingw32' => {
|
|
31
|
-
vendor: 'vendor/libui.x64.dll',
|
|
32
|
-
lib_names: ['libui.x64.dll', 'libui.dll'],
|
|
33
|
-
release_zip: 'Windows-x64-msvc-shared-release.zip',
|
|
34
|
-
release_src: 'builddir/meson-out/libui.dll'
|
|
35
|
-
},
|
|
36
|
-
'x86-mingw32' => {
|
|
37
|
-
vendor: 'vendor/libui.x86.dll',
|
|
38
|
-
lib_names: ['libui.x86.dll', 'libui.dll'],
|
|
39
|
-
release_zip: 'Windows-x86-msvc-shared-release.zip',
|
|
40
|
-
release_src: 'builddir/meson-out/libui.dll'
|
|
41
|
-
}
|
|
42
|
-
}.freeze
|
|
43
|
-
|
|
44
|
-
class << self
|
|
45
|
-
def config_keys
|
|
46
|
-
CONFIG.keys
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def config_for(platform_key)
|
|
50
|
-
CONFIG[normalize_platform_key(platform_key)]
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def current_config
|
|
54
|
-
config_for(detect_platform_key)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def detect_platform_key
|
|
58
|
-
native_platform_key || rubygems_platform_key
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def native_platform_key
|
|
62
|
-
platform_key = case host_os
|
|
63
|
-
when /darwin/
|
|
64
|
-
"#{normalized_cpu}-darwin"
|
|
65
|
-
when /linux/
|
|
66
|
-
# libc variants (glibc vs musl) are not supported as
|
|
67
|
-
# separate prebuilt targets yet; the shipped Linux
|
|
68
|
-
# binaries are built on Ubuntu. Supporting musl would
|
|
69
|
-
# require adding explicit *-linux-musl entries.
|
|
70
|
-
"#{normalized_cpu}-linux"
|
|
71
|
-
when /mingw|mswin/
|
|
72
|
-
windows_platform_key
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
CONFIG.key?(platform_key) ? platform_key : nil
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def rubygems_platform_key
|
|
79
|
-
current_platform = Gem::Platform.local
|
|
80
|
-
platform_key = normalize_platform_key(current_platform.to_s)
|
|
81
|
-
return platform_key if CONFIG.key?(platform_key)
|
|
82
|
-
|
|
83
|
-
CONFIG.keys.find do |config_key|
|
|
84
|
-
config_platform = Gem::Platform.new(config_key)
|
|
85
|
-
|
|
86
|
-
# NOTE: match_platforms? is a private RubyGems API. It is used to
|
|
87
|
-
# reuse RubyGems' own platform matching (including the libc wildcard
|
|
88
|
-
# behaviour), but it may change or disappear across RubyGems versions.
|
|
89
|
-
if Gem::Platform.send(:match_platforms?, current_platform, [config_platform])
|
|
90
|
-
true
|
|
91
|
-
elsif config_key == 'x64-mingw32' &&
|
|
92
|
-
current_platform.os.start_with?('mingw') &&
|
|
93
|
-
%w[x64 x86_64 amd64].include?(current_platform.cpu)
|
|
94
|
-
true
|
|
95
|
-
elsif config_key == 'x86-mingw32' &&
|
|
96
|
-
current_platform.os.start_with?('mingw') &&
|
|
97
|
-
%w[x86 i386 i686].include?(current_platform.cpu)
|
|
98
|
-
true
|
|
99
|
-
else
|
|
100
|
-
false
|
|
101
|
-
end
|
|
102
|
-
end
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
# Canonicalizes alternate platform spellings to the keys used in CONFIG.
|
|
106
|
-
# Linux libc suffixes (-gnu / -musl) are intentionally not stripped here;
|
|
107
|
-
# adding libc-specific artifacts should be an explicit CONFIG change.
|
|
108
|
-
def normalize_platform_key(platform_key)
|
|
109
|
-
platform_key.to_s
|
|
110
|
-
.sub(/\Aarm64-linux\z/, 'aarch64-linux')
|
|
111
|
-
.sub(/\Ax64-linux\z/, 'x86_64-linux')
|
|
112
|
-
.sub(/-mingw-ucrt\z/, '-mingw32')
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def vendor_file_for(platform_key)
|
|
116
|
-
config = config_for(platform_key)
|
|
117
|
-
config && config[:vendor]
|
|
118
|
-
end
|
|
119
|
-
|
|
120
|
-
def current_lib_names
|
|
121
|
-
# host_lib_name and the bare "libui.<soext>" are fallbacks for locally
|
|
122
|
-
# built or manually placed libraries (e.g. via LIBUIDIR or a source
|
|
123
|
-
# checkout) whose file names may not match the CONFIG lib_names.
|
|
124
|
-
host_lib_name = "libui.#{host_cpu}.#{RbConfig::CONFIG['SOEXT']}"
|
|
125
|
-
names = current_config ? current_config[:lib_names] : []
|
|
126
|
-
([host_lib_name] + names + ["libui.#{RbConfig::CONFIG['SOEXT']}"]).uniq
|
|
127
|
-
end
|
|
128
|
-
|
|
129
|
-
private
|
|
130
|
-
|
|
131
|
-
def host_cpu
|
|
132
|
-
RbConfig::CONFIG['host_cpu']
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
def host_os
|
|
136
|
-
RbConfig::CONFIG['host_os']
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
def normalized_cpu
|
|
140
|
-
case host_cpu
|
|
141
|
-
when /i\d86/
|
|
142
|
-
'x86'
|
|
143
|
-
when 'amd64', 'x64'
|
|
144
|
-
'x86_64'
|
|
145
|
-
when 'aarch64'
|
|
146
|
-
host_os =~ /darwin/ ? 'arm64' : host_cpu
|
|
147
|
-
when 'arm64'
|
|
148
|
-
host_os =~ /linux/ ? 'aarch64' : host_cpu
|
|
149
|
-
else
|
|
150
|
-
host_cpu
|
|
151
|
-
end
|
|
152
|
-
end
|
|
153
|
-
|
|
154
|
-
def windows_platform_key
|
|
155
|
-
case normalized_cpu
|
|
156
|
-
when 'x86_64'
|
|
157
|
-
'x64-mingw32'
|
|
158
|
-
when 'x86'
|
|
159
|
-
'x86-mingw32'
|
|
160
|
-
end
|
|
161
|
-
end
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
end
|