icu 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0d1207d28f79754afd8b68f7ecf9d298d62f4aab
4
- data.tar.gz: ce0b6e3e1fcc8ca6bdac3091ddbda9111f3cb99b
3
+ metadata.gz: 52bd5b4ff7de493e861afcde8e5b8d0d166e1978
4
+ data.tar.gz: 4a38c359cc8ed339e2a328a221c29a22c0db405c
5
5
  SHA512:
6
- metadata.gz: 9acb80e891bd190cfde5b4a877723d97c31c25ea30004c70f5cb8232c93ffd9c3d413d57ef08d01713068352c2163906cd79bbc2efea4f572ac558b1b09763a8
7
- data.tar.gz: f3e384258d81c4e2435797cb58754b471535ae90bd6b7bcaee67177023ea8a20fa1e4eab21b24c687e0b910a93a41ceed902a9d43a4b59c0ceea114cd9980fad
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
  [![Build Status](https://travis-ci.org/fantasticfears/icu4r.svg?branch=master)](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.
@@ -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 Not supported yet, PR welcome!"
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
- unless have_library('icui18n', 'u_errorName') or
234
- have_library('libicui18n', 'u_errorName') or
235
- find_library('icui18n', 'u_errorName', *$LIBPATH)
236
- crash("ICU build not found.")
237
- end
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')
@@ -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 = uspoof_check2UTF8(this->service,
161
- RSTRING_PTR(rb_str),
162
- RSTRING_LENINT(rb_str),
163
- NULL,
164
- &status);
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
- result = uspoof_check2(this->service,
168
- icu_ustring_ptr(in),
169
- icu_ustring_len(in),
170
- NULL,
171
- &status);
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);
@@ -1,3 +1,3 @@
1
1
  module ICU
2
- VERSION = "0.10.1"
2
+ VERSION = "0.10.2"
3
3
  end
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.1
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-15 00:00:00.000000000 Z
11
+ date: 2017-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler