icu 0.10.1 → 0.10.2
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 +21 -0
- data/ext/icu/extconf.rb +24 -8
- data/ext/icu/icu_spoof_checker.c +12 -10
- data/lib/icu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52bd5b4ff7de493e861afcde8e5b8d0d166e1978
|
4
|
+
data.tar.gz: 4a38c359cc8ed339e2a328a221c29a22c0db405c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d22f947f3b513b9a4abb8e5c2a0eab570bb4ad28ea2ea0f0ffeaacf56924a51fd0ea224f2bca48e9777fc785c1feecc0ea7e6aaee6bf0b4a989d2e650a34049
|
7
|
+
data.tar.gz: 687fde4436ca2b756ebdda7502f40d3b0433ae8ecafe236dbc0a7e946bd957eb1752c74ae741a98a0e6cdbd25f3147d4459fbe2ce454e72f9774bd30f6cab8a9
|
data/README.md
CHANGED
@@ -6,6 +6,27 @@ Ruby required 2.3.1.
|
|
6
6
|
|
7
7
|
[](https://travis-ci.org/fantasticfears/icu4r)
|
8
8
|
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
If you use OS X,
|
12
|
+
|
13
|
+
```
|
14
|
+
brew install icu4c
|
15
|
+
gem install icu -- --use-system-libraries
|
16
|
+
```
|
17
|
+
|
18
|
+
else,
|
19
|
+
|
20
|
+
```
|
21
|
+
gem install icu
|
22
|
+
```
|
23
|
+
|
24
|
+
For usage:
|
25
|
+
|
26
|
+
```
|
27
|
+
require 'icu'
|
28
|
+
```
|
29
|
+
|
9
30
|
## Design
|
10
31
|
|
11
32
|
Almost all arguments passed should be expected as Ruby `String` with various encodings.
|
data/ext/icu/extconf.rb
CHANGED
@@ -6,15 +6,25 @@ 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?
|
@@ -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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erick Guan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-08-
|
11
|
+
date: 2017-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|