icu 0.10.1 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +23 -1
- data/ext/icu/extconf.rb +25 -9
- data/ext/icu/icu_spoof_checker.c +12 -10
- data/lib/icu/version.rb +1 -1
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5acdb8b2e1a0ec57eba318d0fad3cd013f0979162553dca648dce75e57fc0586
|
4
|
+
data.tar.gz: af41368b37083e79a39d100a5b3d805996ffe75030c4f4de25dad0e931741cfc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1bb00122744500e3400a912540d8cdabdef3f59ceca771a0ee9c828e5efd92c5baf8c30c8fee036758f7a69445f6392494d72da808c9a9495f1ddc6772cbb4e
|
7
|
+
data.tar.gz: 69c89cc02c8cf77903660d52e0fbc20feff461a88c941a4c1e2f5b5216320e42b2456dbde7b6d45924d2cb761c6a5827e17e83a21a53f10ae8f40eeb1f975e87
|
data/README.md
CHANGED
@@ -1,11 +1,33 @@
|
|
1
1
|
ICU - A Unicode processing functions ruby gem - binding to ICU
|
2
2
|
|
3
|
-
Beta stage.
|
3
|
+
Beta stage. I'm sure ffi-icu can also do the same thing once you understand the internal C module for transcoding.
|
4
4
|
|
5
5
|
Ruby required 2.3.1.
|
6
6
|
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/icu.svg)](https://badge.fury.io/rb/icu)
|
7
8
|
[![Build Status](https://travis-ci.org/fantasticfears/icu4r.svg?branch=master)](https://travis-ci.org/fantasticfears/icu4r)
|
8
9
|
|
10
|
+
## Usage
|
11
|
+
|
12
|
+
If you use OS X,
|
13
|
+
|
14
|
+
```
|
15
|
+
brew install icu4c
|
16
|
+
gem install icu -- --use-system-libraries
|
17
|
+
```
|
18
|
+
|
19
|
+
else,
|
20
|
+
|
21
|
+
```
|
22
|
+
gem install icu
|
23
|
+
```
|
24
|
+
|
25
|
+
For usage:
|
26
|
+
|
27
|
+
```
|
28
|
+
require 'icu'
|
29
|
+
```
|
30
|
+
|
9
31
|
## Design
|
10
32
|
|
11
33
|
Almost all arguments passed should be expected as Ruby `String` with various encodings.
|
data/ext/icu/extconf.rb
CHANGED
@@ -6,20 +6,30 @@ ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
|
|
6
6
|
|
7
7
|
# Utility functions
|
8
8
|
|
9
|
+
def asplode(lib)
|
10
|
+
abort "-----\n#{lib} is missing. Please locate mkmf.log to investigate how it is failing.\n-----"
|
11
|
+
end
|
12
|
+
|
9
13
|
def using_system_libraries?
|
10
14
|
arg_config('--use-system-libraries', !!ENV['ICU_USE_SYSTEM_LIBRARIES'])
|
11
15
|
end
|
12
16
|
|
17
|
+
def lib_a(ldflag)
|
18
|
+
case ldflag
|
19
|
+
when /\A-l(.+)/
|
20
|
+
"lib#{$1}.#{$LIBEXT}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
13
24
|
# Building with system ICU
|
14
25
|
|
15
26
|
if using_system_libraries?
|
16
|
-
message "Building ICU using system libraries.\n
|
17
|
-
exit 1
|
27
|
+
message "Building ICU using system libraries.\n"
|
18
28
|
|
19
29
|
unless dir_config('icu').any?
|
20
30
|
base = if !`which brew`.empty?
|
21
31
|
`brew --prefix`.strip
|
22
|
-
elsif File.
|
32
|
+
elsif File.exist?("/usr/local/Cellar/icu4c")
|
23
33
|
'/usr/local/Cellar'
|
24
34
|
end
|
25
35
|
|
@@ -43,7 +53,7 @@ install by brew install icu4c or apt-get install libicu-dev)
|
|
43
53
|
have_library 'icuuc' or abort 'libicuuc missing'
|
44
54
|
have_library 'icudata' or abort 'libicudata missing'
|
45
55
|
else
|
46
|
-
message "Building ICU from source.\n"
|
56
|
+
message "Building ICU from source. TODO: Loading in OS X. Use brew icu4c instead.\n"
|
47
57
|
|
48
58
|
# The gem version constraint in the Rakefile is not respected at install time.
|
49
59
|
# Keep this version in sync with the one in the Rakefile !
|
@@ -225,14 +235,20 @@ If you are using Bundler, tell it to use the option:
|
|
225
235
|
$CPPFLAGS = '-DU_DISABLE_RENAMING=1 -DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=0 -DU_STATIC_IMPLEMENTATION' << ' ' << $CPPFLAGS
|
226
236
|
$CFLAGS = `sh #{config} --cflags`.strip << $CFLAGS
|
227
237
|
end
|
238
|
+
|
239
|
+
$LIBPATH = ["#{libicu_recipe.path}/lib"] | $LIBPATH if libicu_recipe
|
240
|
+
$libs = ["-licui18n", "-licuuc", "-licudata"].map do |arg|
|
241
|
+
File.join(libicu_recipe.path, 'lib', lib_a(arg))
|
242
|
+
end.shelljoin
|
228
243
|
end
|
229
244
|
|
230
245
|
$CFLAGS << ' -O3 -funroll-loops -std=c99'
|
231
246
|
$CFLAGS << ' -Wextra -O0 -ggdb3' if ENV['DEBUG']
|
232
247
|
|
233
|
-
|
234
|
-
have_library('
|
235
|
-
|
236
|
-
|
237
|
-
|
248
|
+
have_func('u_init', 'unicode/uclean.h') ||
|
249
|
+
have_library('icui18n', 'u_init', 'unicode/uclean.h') ||
|
250
|
+
have_library('libicui18n', 'u_init', 'unicode/uclean.h') or
|
251
|
+
asplode('libicui18n')
|
252
|
+
have_func('u_errorName')
|
253
|
+
|
238
254
|
create_makefile('icu/icu')
|
data/ext/icu/icu_spoof_checker.c
CHANGED
@@ -156,19 +156,21 @@ VALUE spoof_checker_check(VALUE self, VALUE rb_str)
|
|
156
156
|
UErrorCode status = U_ZERO_ERROR;
|
157
157
|
int32_t result = 0;
|
158
158
|
|
159
|
+
// TODO: Migrate to uspoof_check2UTF8 once it's not draft
|
159
160
|
if (icu_is_rb_str_as_utf_8(rb_str)) {
|
160
|
-
result =
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
161
|
+
result = uspoof_checkUTF8(this->service,
|
162
|
+
RSTRING_PTR(rb_str),
|
163
|
+
RSTRING_LENINT(rb_str),
|
164
|
+
NULL,
|
165
|
+
&status);
|
165
166
|
} else {
|
166
167
|
VALUE in = icu_ustring_from_rb_str(rb_str);
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
168
|
+
// TODO: Migrate to uspoof_check once it's not draft
|
169
|
+
result = uspoof_check(this->service,
|
170
|
+
icu_ustring_ptr(in),
|
171
|
+
icu_ustring_len(in),
|
172
|
+
NULL,
|
173
|
+
&status);
|
172
174
|
}
|
173
175
|
if (U_FAILURE(status)) {
|
174
176
|
icu_rb_raise_icu_error(status);
|
data/lib/icu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erick Guan
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-09-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 2.2.0
|
69
|
-
description:
|
69
|
+
description:
|
70
70
|
email:
|
71
71
|
- fantasticfears@gmail.com
|
72
72
|
executables: []
|
@@ -116,7 +116,7 @@ homepage: https://github.com/fantasticfears/icu4r
|
|
116
116
|
licenses:
|
117
117
|
- MIT
|
118
118
|
metadata: {}
|
119
|
-
post_install_message:
|
119
|
+
post_install_message:
|
120
120
|
rdoc_options: []
|
121
121
|
require_paths:
|
122
122
|
- lib
|
@@ -131,9 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
|
-
|
135
|
-
|
136
|
-
signing_key:
|
134
|
+
rubygems_version: 3.4.10
|
135
|
+
signing_key:
|
137
136
|
specification_version: 4
|
138
137
|
summary: A Unicode processing functions ruby gem, binding to ICU
|
139
138
|
test_files:
|