cld3 3.2.2 → 3.2.3

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
- SHA1:
3
- metadata.gz: b56fea25a97cf6a197b72c514454008e4c04d0a8
4
- data.tar.gz: a327ab423e7c93d99da7dc29c03a7510373766d0
2
+ SHA256:
3
+ metadata.gz: 389180f0a98e928e859bcbee406f697519ea039aac3da46626231fd9edd70289
4
+ data.tar.gz: 641eff841e515ae8ce8d3d25a90bbc35312e6ba3a9ccbd5d9c650cb86b019f8e
5
5
  SHA512:
6
- metadata.gz: 4162920fc33fe306c8f0b230fea912f5149bbb19099a47233267fd1eefaf1efd7a4d0436f89618d1b5673a30f83f7487b494ed12b7b758ce7f041222a6d1c11c
7
- data.tar.gz: baa2e35f7d528da66ff3d4265c193bb00c81c616b41af0a67df9f2865b29c4f27d891fdb65e502d93498e604bb4b36f46137752add1f8cd7ecc74d793bcd2d33
6
+ metadata.gz: 5e9eebfb2f658e339ebcbc085b8b12e96fc078a59de021945ee00cdfc4769fcfd46a28ff42d93b7ace9b4219fe52a6729331e54d0e2e4576030080e659464896
7
+ data.tar.gz: 9020797a262a45f5eccdd48ecf215230ab5b288ef9a48e9185e0dc6669cabfa250e15defe6883432b49d0a0473c0969cc824f8d135eff569fa2db2b628b07ec1
data/README.md CHANGED
@@ -24,12 +24,42 @@ cld3.find_language("здравствуйте") # => #<struct Struct::Result lang
24
24
  * [RubyGems](https://rubygems.org/)
25
25
 
26
26
  ### Instructions
27
- `Rakefile` includes a Rake task to put this code into files buildable as a gem.
28
- Build a gem with `rake` command.
29
-
30
- ## Troubleshooting Setup Problems
31
27
  I (Akihiko Odaki) recommend to setup this library installing via `gem`.
32
28
 
29
+ You can also build this library by yourself. `Rakefile` includes a Rake task to
30
+ put this code into files buildable as a gem. Build a gem with `rake` command.
31
+
32
+ ### Platform-specific information
33
+
34
+ #### FreeBSD
35
+ FreeBSD port is available as `rubygem-cld3` in `textproc` category.
36
+
37
+ https://svnweb.freebsd.org/ports/head/textproc/rubygem-cld3/
38
+
39
+ #### JRuby
40
+ JRuby has a bug which prevents the feature detection. Apply the following
41
+ change:
42
+ https://github.com/jruby/jruby/pull/4118/commits/edad375ef4dcf195b19ce0afe4befac66468c736
43
+
44
+ #### OpenBSD
45
+ Ruby has a bug which recognizes non-fatal linker warnings as fatal. Apply the
46
+ following patch to Ruby to workaround the bug.
47
+
48
+ ```diff
49
+ --- a/lib/mkmf.rb
50
+ +++ b/lib/mkmf.rb
51
+ @@ -657,7 +657,7 @@ def with_ldflags(flags)
52
+ end
53
+
54
+ def try_ldflags(flags, opts = {})
55
+ - try_link(MAIN_DOES_NOTHING, flags, {:werror => true}.update(opts))
56
+ + try_link(MAIN_DOES_NOTHING, flags, {:werror => false}.update(opts))
57
+ end
58
+
59
+ def append_ldflags(flags, *opts)
60
+ ```
61
+
62
+ ### Troubleshooting
33
63
  `gem install cld3` triggers native library building. If it fails, you are likely
34
64
  to missing required facilities. Make sure C++ compiler and protocol buffers
35
65
  is installed. I recommend [GCC](https://gcc.gnu.org/) as a C++ compiler. Ruby is
@@ -63,7 +93,7 @@ The increment of the major version and the minor version indicates it can involv
63
93
  any change.
64
94
 
65
95
  The increment of the patch version indicates there is no change of the supported
66
- languages and no change of the existing APIs except `CLD3::Unstable`.
96
+ languages and no change of the existing APIs.
67
97
 
68
98
  ## Contact
69
99
 
@@ -72,4 +102,5 @@ https://github.com/akihikodaki/cld3-ruby/issues.
72
102
 
73
103
  ## Credits
74
104
 
75
- This program was written by Akihiko Odaki. CLD3 was written by its own authors.
105
+ This program was written by Akihiko Odaki and other contributors. CLD3 was
106
+ written by its own authors.
@@ -16,16 +16,16 @@
16
16
 
17
17
  Gem::Specification.new do |gem|
18
18
  gem.name = "cld3"
19
- gem.version = "3.2.2"
19
+ gem.version = "3.2.3"
20
20
  gem.summary = "Compact Language Detector v3 (CLD3)"
21
21
  gem.description = "Compact Language Detector v3 (CLD3) is a neural network model for language identification."
22
22
  gem.license = "Apache-2.0"
23
23
  gem.homepage = "https://github.com/akihikodaki/cld3-ruby"
24
24
  gem.author = "Akihiko Odaki"
25
25
  gem.email = "akihiko.odaki.4i@stu.hosei.ac.jp"
26
- gem.required_ruby_version = [ ">= 2.3.0", "< 2.6.0" ]
26
+ gem.required_ruby_version = [ ">= 2.3.0", "< 2.7.0" ]
27
27
  gem.add_dependency "ffi", [ ">= 1.1.0", "< 1.10.0" ]
28
- gem.add_development_dependency "rspec", [ ">=3.0.0", "< 3.8.0" ]
28
+ gem.add_development_dependency "rspec", [ ">=3.0.0", "< 3.9.0" ]
29
29
  gem.files = Dir[
30
30
  "Gemfile", "LICENSE", "LICENSE_CLD3", "README.md",
31
31
  "cld3.gemspec", "ext/**/*", "lib/**/*"
@@ -14,7 +14,10 @@ See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  ==============================================================================*/
16
16
 
17
+ #include <cstddef>
17
18
  #include <iostream>
19
+ #include <string>
20
+ #include <utility>
18
21
  #include "nnet_language_identifier.h"
19
22
 
20
23
  #if defined _WIN32 || defined __CYGWIN__
@@ -28,36 +31,34 @@ struct NNetLanguageIdentifier {
28
31
  std::string language;
29
32
  };
30
33
 
31
- extern "C" {
32
- #include <stddef.h>
33
-
34
- typedef struct {
35
- struct {
36
- const char *data;
37
- size_t size;
38
- } language;
39
- float probability;
40
- float proportion;
41
- bool is_reliable;
42
- } Result;
34
+ struct Result {
35
+ struct {
36
+ const char *data;
37
+ std::size_t size;
38
+ } language;
39
+ float probability;
40
+ float proportion;
41
+ bool is_reliable;
42
+ };
43
43
 
44
+ extern "C" {
44
45
  EXPORT Result NNetLanguageIdentifier_find_language(void *pointer,
45
46
  const char *data,
46
- size_t size) {
47
- auto instance = reinterpret_cast<NNetLanguageIdentifier *>(pointer);
47
+ std::size_t size) {
48
+ auto instance = static_cast<NNetLanguageIdentifier *>(pointer);
48
49
  auto result = instance->context.FindLanguage(std::string(data, size));
49
50
  instance->language = std::move(result.language);
50
51
 
51
52
  return Result {
52
53
  { instance->language.data(), instance->language.size() },
53
- std::move(result.probability),
54
- std::move(result.proportion),
55
- std::move(result.is_reliable)
54
+ result.probability,
55
+ result.proportion,
56
+ result.is_reliable
56
57
  };
57
58
  }
58
59
 
59
60
  EXPORT void delete_NNetLanguageIdentifier(void *pointer) {
60
- delete reinterpret_cast<NNetLanguageIdentifier *>(pointer);
61
+ delete static_cast<NNetLanguageIdentifier *>(pointer);
61
62
  }
62
63
 
63
64
  EXPORT void *new_NNetLanguageIdentifier(int min_num_bytes, int max_num_bytes) {
@@ -158,6 +158,20 @@ static const int kHtmlPlaintextFlag = 0x80; // Bit in add byte to distinguish
158
158
  *
159
159
  **/
160
160
 
161
+ // All intentional fallthroughs in breakpad are in this file, so define
162
+ // this macro locally.
163
+ // If you ever move this to a .h file, make sure it's defined in a
164
+ // private header file: clang suggests the first macro expanding to
165
+ // [[clang::fallthrough]] in its diagnostics, so if BP_FALLTHROUGH
166
+ // is visible in code depending on breakpad, clang would suggest
167
+ // BP_FALLTHROUGH for code depending on breakpad, instead of the
168
+ // client code's own fallthrough macro.
169
+ #if defined(__clang__)
170
+ #define CLD_FALLTHROUGH [[clang::fallthrough]]
171
+ #else
172
+ #define CLD_FALLTHROUGH
173
+ #endif
174
+
161
175
  // Return true if current Tbl pointer is within state0 range
162
176
  // Note that unsigned compare checks both ends of range simultaneously
163
177
  static inline bool InStateZero(const UTF8ScanObj* st, const uint8* Tbl) {
@@ -715,10 +729,10 @@ static int UTF8GenericReplaceInternal(const UTF8ReplaceObj* st,
715
729
  goto Do_state_table;
716
730
  case kExitReplace3: // update 3 bytes to change
717
731
  dst[-3] = (unsigned char)Tbl[c + (nEntries * 3)];
718
- // Fall into next case
732
+ CLD_FALLTHROUGH;
719
733
  case kExitReplace2: // update 2 bytes to change
720
734
  dst[-2] = (unsigned char)Tbl[c + (nEntries * 2)];
721
- // Fall into next case
735
+ CLD_FALLTHROUGH;
722
736
  case kExitReplace1: // update 1 byte to change
723
737
  dst[-1] = (unsigned char)Tbl[c + (nEntries * 1)];
724
738
  total_changed++;
@@ -736,7 +750,7 @@ static int UTF8GenericReplaceInternal(const UTF8ReplaceObj* st,
736
750
  } else {
737
751
  offset += ((unsigned char)Tbl[c + (nEntries * 2)] << 8);
738
752
  }
739
- // Fall into next case
753
+ CLD_FALLTHROUGH;
740
754
  case kExitSpecial: // Apply special fixups [read: hacks]
741
755
  case kExitReplaceOffset1:
742
756
  if ((nEntries != 256) && InStateZero(st, Tbl)) {
@@ -986,10 +1000,10 @@ static int UTF8GenericReplaceInternalTwoByte(const UTF8ReplaceObj_2* st,
986
1000
  goto Do_state_table_2;
987
1001
  case kExitReplace3_2: // update 3 bytes to change
988
1002
  dst[-3] = (unsigned char)(Tbl[c + (nEntries * 2)] & 0xff);
989
- // Fall into next case
1003
+ CLD_FALLTHROUGH;
990
1004
  case kExitReplace2_2: // update 2 bytes to change
991
1005
  dst[-2] = (unsigned char)(Tbl[c + (nEntries * 1)] >> 8 & 0xff);
992
- // Fall into next case
1006
+ CLD_FALLTHROUGH;
993
1007
  case kExitReplace1_2: // update 1 byte to change
994
1008
  dst[-1] = (unsigned char)(Tbl[c + (nEntries * 1)] & 0xff);
995
1009
  total_changed++;
@@ -1007,7 +1021,7 @@ static int UTF8GenericReplaceInternalTwoByte(const UTF8ReplaceObj_2* st,
1007
1021
  } else {
1008
1022
  offset += ((unsigned char)(Tbl[c + (nEntries * 1)] >> 8 & 0xff) << 8);
1009
1023
  }
1010
- // Fall into next case
1024
+ CLD_FALLTHROUGH;
1011
1025
  case kExitReplaceOffset1_2:
1012
1026
  if ((nEntries != 256) && InStateZero_2(st, Tbl)) {
1013
1027
  // For space-optimized table, we need multiples of 256 bytes
@@ -65,7 +65,7 @@ module CLD3
65
65
 
66
66
  # The arguments are two String objects.
67
67
  def initialize(minNumBytes = MIN_NUM_BYTES_TO_CONSIDER, maxNumBytes = MAX_NUM_BYTES_TO_CONSIDER)
68
- @cc = CLD3::Unstable::NNetLanguageIdentifier::Pointer.new(CLD3::Unstable.new_NNetLanguageIdentifier(minNumBytes, maxNumBytes))
68
+ @cc = Unstable::NNetLanguageIdentifier::Pointer.new(Unstable.new_NNetLanguageIdentifier(minNumBytes, maxNumBytes))
69
69
  end
70
70
 
71
71
  # Finds the most likely language for the given text, along with additional
@@ -80,7 +80,7 @@ module CLD3
80
80
  pointer = FFI::MemoryPointer.new(:char, text_utf8.bytesize)
81
81
  pointer.put_bytes(0, text_utf8)
82
82
 
83
- cc_result = CLD3::Unstable.NNetLanguageIdentifier_find_language(@cc, pointer, text_utf8.bytesize)
83
+ cc_result = Unstable.NNetLanguageIdentifier_find_language(@cc, pointer, text_utf8.bytesize)
84
84
  language = cc_result[:language_data].read_bytes(cc_result[:language_size])
85
85
 
86
86
  Result.new(
@@ -109,8 +109,6 @@ module CLD3
109
109
  ].freeze
110
110
  end
111
111
 
112
- # :nodoc: all
113
- # Do NOT use this module from outside.
114
112
  module Unstable
115
113
  extend FFI::Library
116
114
 
@@ -119,7 +117,7 @@ module CLD3
119
117
  module NNetLanguageIdentifier
120
118
  class Pointer < FFI::AutoPointer
121
119
  def self.release(pointer)
122
- CLD3::Unstable.delete_NNetLanguageIdentifier(pointer)
120
+ Unstable.delete_NNetLanguageIdentifier(pointer)
123
121
  end
124
122
  end
125
123
 
@@ -135,4 +133,6 @@ module CLD3
135
133
  attach_function :NNetLanguageIdentifier_find_language,
136
134
  [ :pointer, :buffer_in, :size_t ], NNetLanguageIdentifier::Result.by_value
137
135
  end
136
+
137
+ private_constant :Unstable
138
138
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cld3
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.2
4
+ version: 3.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akihiko Odaki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-25 00:00:00.000000000 Z
11
+ date: 2018-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -39,7 +39,7 @@ dependencies:
39
39
  version: 3.0.0
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: 3.8.0
42
+ version: 3.9.0
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
@@ -49,7 +49,7 @@ dependencies:
49
49
  version: 3.0.0
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: 3.8.0
52
+ version: 3.9.0
53
53
  description: Compact Language Detector v3 (CLD3) is a neural network model for language
54
54
  identification.
55
55
  email: akihiko.odaki.4i@stu.hosei.ac.jp
@@ -63,101 +63,70 @@ files:
63
63
  - LICENSE_CLD3
64
64
  - README.md
65
65
  - cld3.gemspec
66
- - ext/cld3/Makefile
67
66
  - ext/cld3/base.cc
68
67
  - ext/cld3/base.h
69
- - ext/cld3/base.o
70
68
  - ext/cld3/casts.h
71
69
  - ext/cld3/embedding_feature_extractor.cc
72
70
  - ext/cld3/embedding_feature_extractor.h
73
- - ext/cld3/embedding_feature_extractor.o
74
71
  - ext/cld3/embedding_network.cc
75
72
  - ext/cld3/embedding_network.h
76
- - ext/cld3/embedding_network.o
77
73
  - ext/cld3/embedding_network_params.h
78
74
  - ext/cld3/extconf.rb
79
75
  - ext/cld3/feature_extractor.cc
80
76
  - ext/cld3/feature_extractor.h
81
- - ext/cld3/feature_extractor.o
82
- - ext/cld3/feature_extractor.pb.o
83
77
  - ext/cld3/feature_extractor.proto
84
78
  - ext/cld3/feature_types.cc
85
79
  - ext/cld3/feature_types.h
86
- - ext/cld3/feature_types.o
87
80
  - ext/cld3/fixunicodevalue.cc
88
81
  - ext/cld3/fixunicodevalue.h
89
- - ext/cld3/fixunicodevalue.o
90
82
  - ext/cld3/float16.h
91
83
  - ext/cld3/fml_parser.cc
92
84
  - ext/cld3/fml_parser.h
93
- - ext/cld3/fml_parser.o
94
85
  - ext/cld3/generated_entities.cc
95
- - ext/cld3/generated_entities.o
96
86
  - ext/cld3/generated_ulscript.cc
97
87
  - ext/cld3/generated_ulscript.h
98
- - ext/cld3/generated_ulscript.o
99
88
  - ext/cld3/getonescriptspan.cc
100
89
  - ext/cld3/getonescriptspan.h
101
- - ext/cld3/getonescriptspan.o
102
90
  - ext/cld3/integral_types.h
103
91
  - ext/cld3/lang_id_nn_params.cc
104
92
  - ext/cld3/lang_id_nn_params.h
105
- - ext/cld3/lang_id_nn_params.o
106
93
  - ext/cld3/language_identifier_features.cc
107
94
  - ext/cld3/language_identifier_features.h
108
- - ext/cld3/language_identifier_features.o
109
- - ext/cld3/libcld3.so
110
- - ext/cld3/mkmf.log
111
95
  - ext/cld3/nnet_language_identifier.cc
112
96
  - ext/cld3/nnet_language_identifier.h
113
- - ext/cld3/nnet_language_identifier.o
114
97
  - ext/cld3/nnet_language_identifier_c.cc
115
- - ext/cld3/nnet_language_identifier_c.o
116
98
  - ext/cld3/offsetmap.cc
117
99
  - ext/cld3/offsetmap.h
118
- - ext/cld3/offsetmap.o
119
100
  - ext/cld3/port.h
120
101
  - ext/cld3/registry.cc
121
102
  - ext/cld3/registry.h
122
- - ext/cld3/registry.o
123
103
  - ext/cld3/relevant_script_feature.cc
124
104
  - ext/cld3/relevant_script_feature.h
125
- - ext/cld3/relevant_script_feature.o
126
105
  - ext/cld3/script_detector.h
127
- - ext/cld3/sentence.pb.o
128
106
  - ext/cld3/sentence.proto
129
107
  - ext/cld3/sentence_features.cc
130
108
  - ext/cld3/sentence_features.h
131
- - ext/cld3/sentence_features.o
132
109
  - ext/cld3/simple_adder.h
133
110
  - ext/cld3/stringpiece.h
134
111
  - ext/cld3/task_context.cc
135
112
  - ext/cld3/task_context.h
136
- - ext/cld3/task_context.o
137
113
  - ext/cld3/task_context_params.cc
138
114
  - ext/cld3/task_context_params.h
139
- - ext/cld3/task_context_params.o
140
- - ext/cld3/task_spec.pb.o
141
115
  - ext/cld3/task_spec.proto
142
116
  - ext/cld3/text_processing.cc
143
117
  - ext/cld3/text_processing.h
144
- - ext/cld3/text_processing.o
145
118
  - ext/cld3/unicodetext.cc
146
119
  - ext/cld3/unicodetext.h
147
- - ext/cld3/unicodetext.o
148
120
  - ext/cld3/utf8acceptinterchange.h
149
121
  - ext/cld3/utf8prop_lettermarkscriptnum.h
150
122
  - ext/cld3/utf8repl_lettermarklower.h
151
123
  - ext/cld3/utf8scannot_lettermarkspecial.h
152
124
  - ext/cld3/utf8statetable.cc
153
125
  - ext/cld3/utf8statetable.h
154
- - ext/cld3/utf8statetable.o
155
126
  - ext/cld3/utils.cc
156
127
  - ext/cld3/utils.h
157
- - ext/cld3/utils.o
158
128
  - ext/cld3/workspace.cc
159
129
  - ext/cld3/workspace.h
160
- - ext/cld3/workspace.o
161
130
  - lib/cld3.rb
162
131
  homepage: https://github.com/akihikodaki/cld3-ruby
163
132
  licenses:
@@ -174,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
174
143
  version: 2.3.0
175
144
  - - "<"
176
145
  - !ruby/object:Gem::Version
177
- version: 2.6.0
146
+ version: 2.7.0
178
147
  required_rubygems_version: !ruby/object:Gem::Requirement
179
148
  requirements:
180
149
  - - ">="
@@ -182,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
151
  version: '0'
183
152
  requirements: []
184
153
  rubyforge_project:
185
- rubygems_version: 2.6.14
154
+ rubygems_version: 2.7.7
186
155
  signing_key:
187
156
  specification_version: 4
188
157
  summary: Compact Language Detector v3 (CLD3)
@@ -1,263 +0,0 @@
1
-
2
- SHELL = /bin/sh
3
-
4
- # V=0 quiet, V=1 verbose. other values don't work.
5
- V = 0
6
- Q1 = $(V:1=)
7
- Q = $(Q1:0=@)
8
- ECHO1 = $(V:1=@ :)
9
- ECHO = $(ECHO1:0=@ echo)
10
- NULLCMD = :
11
-
12
- #### Start of system configuration section. ####
13
-
14
- srcdir = .
15
- topdir = /usr/include/ruby-2.4.0
16
- hdrdir = $(topdir)
17
- arch_hdrdir = /usr/include/ruby-2.4.0/x86_64-linux
18
- PATH_SEPARATOR = :
19
- VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
20
- prefix = $(DESTDIR)/usr
21
- rubysitearchprefix = $(rubylibprefix)/$(sitearch)
22
- rubyarchprefix = $(rubylibprefix)/$(arch)
23
- rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
24
- exec_prefix = $(prefix)
25
- vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
26
- sitearchhdrdir = $(sitehdrdir)/$(sitearch)
27
- rubyarchhdrdir = $(rubyhdrdir)/$(arch)
28
- vendorhdrdir = $(rubyhdrdir)/vendor_ruby
29
- sitehdrdir = $(rubyhdrdir)/site_ruby
30
- rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
31
- vendorarchdir = $(vendorlibdir)/$(sitearch)
32
- vendorlibdir = $(vendordir)/$(ruby_version)
33
- vendordir = $(rubylibprefix)/vendor_ruby
34
- sitearchdir = $(sitelibdir)/$(sitearch)
35
- sitelibdir = $(sitedir)/$(ruby_version)
36
- sitedir = $(rubylibprefix)/site_ruby
37
- rubyarchdir = $(rubylibdir)/$(arch)
38
- rubylibdir = $(rubylibprefix)/$(ruby_version)
39
- sitearchincludedir = $(includedir)/$(sitearch)
40
- archincludedir = $(includedir)/$(arch)
41
- sitearchlibdir = $(libdir)/$(sitearch)
42
- archlibdir = $(libdir)/$(arch)
43
- ridir = $(datarootdir)/$(RI_BASE_NAME)
44
- mandir = $(datarootdir)/man
45
- localedir = $(datarootdir)/locale
46
- libdir = $(exec_prefix)/lib
47
- psdir = $(docdir)
48
- pdfdir = $(docdir)
49
- dvidir = $(docdir)
50
- htmldir = $(docdir)
51
- infodir = $(datarootdir)/info
52
- docdir = $(datarootdir)/doc/$(PACKAGE)
53
- oldincludedir = $(DESTDIR)/usr/include
54
- includedir = $(prefix)/include
55
- localstatedir = $(DESTDIR)/var
56
- sharedstatedir = $(DESTDIR)/var/lib
57
- sysconfdir = $(DESTDIR)/etc
58
- datadir = $(datarootdir)
59
- datarootdir = $(prefix)/share
60
- libexecdir = $(DESTDIR)/usr/lib/ruby
61
- sbindir = $(exec_prefix)/sbin
62
- bindir = $(exec_prefix)/bin
63
- archdir = $(rubyarchdir)
64
-
65
-
66
- CC = gcc
67
- CXX = g++
68
- LIBRUBY = $(LIBRUBY_SO)
69
- LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
70
- LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
71
- LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static
72
- empty =
73
- OUTFLAG = -o $(empty)
74
- COUTFLAG = -o $(empty)
75
- CSRCFLAG = $(empty)
76
-
77
- RUBY_EXTCONF_H =
78
- cflags = $(optflags) $(debugflags) $(warnflags)
79
- cxxflags = $(optflags) $(debugflags) $(warnflags)
80
- optflags = -O3 -fno-fast-math
81
- debugflags = -ggdb3
82
- warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wimplicit-fallthrough=0
83
- CCDLFLAGS = -fPIC
84
- CFLAGS = $(CCDLFLAGS) -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -fPIC -pthread $(ARCH_FLAG)
85
- INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir)
86
- DEFS =
87
- CPPFLAGS = -D_FORTIFY_SOURCE=2 $(DEFS) $(cppflags)
88
- CXXFLAGS = $(CCDLFLAGS) -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -pthread -fvisibility=hidden -std=c++11 $(ARCH_FLAG)
89
- ldflags = -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -pthread
90
- dldflags = -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -Wl,--compress-debug-sections=zlib
91
- ARCH_FLAG =
92
- DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
93
- LDSHARED = $(CC) -shared
94
- LDSHAREDXX = $(CXX) -shared
95
- AR = ar
96
- EXEEXT =
97
-
98
- RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
99
- RUBY_SO_NAME = ruby
100
- RUBYW_INSTALL_NAME =
101
- RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
102
- RUBYW_BASE_NAME = rubyw
103
- RUBY_BASE_NAME = ruby
104
-
105
- arch = x86_64-linux
106
- sitearch = $(arch)
107
- ruby_version = 2.4.0
108
- ruby = $(bindir)/$(RUBY_BASE_NAME)
109
- RUBY = $(ruby)
110
- ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/backward.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
111
-
112
- RM = rm -f
113
- RM_RF = $(RUBY) -run -e rm -- -rf
114
- RMDIRS = rmdir --ignore-fail-on-non-empty -p
115
- MAKEDIRS = /usr/bin/mkdir -p
116
- INSTALL = /usr/bin/install -c
117
- INSTALL_PROG = $(INSTALL) -m 0755
118
- INSTALL_DATA = $(INSTALL) -m 644
119
- COPY = cp
120
- TOUCH = exit >
121
-
122
- #### End of system configuration section. ####
123
-
124
- preload =
125
- libpath = . $(libdir)
126
- LIBPATH = -L. -L$(libdir)
127
- DEFFILE =
128
-
129
- CLEANFILES = mkmf.log
130
- DISTCLEANFILES =
131
- DISTCLEANDIRS =
132
-
133
- extout =
134
- extout_prefix =
135
- target_prefix =
136
- LOCAL_LIBS =
137
- LIBS = $(LIBRUBYARG_SHARED) -lprotobuf -lpthread -lpthread -lgmp -ldl -lcrypt -lm -lc
138
- ORIG_SRCS = base.cc embedding_feature_extractor.cc embedding_network.cc feature_extractor.cc feature_extractor.pb.cc feature_types.cc fixunicodevalue.cc fml_parser.cc generated_entities.cc generated_ulscript.cc getonescriptspan.cc lang_id_nn_params.cc language_identifier_features.cc nnet_language_identifier.cc nnet_language_identifier_c.cc offsetmap.cc registry.cc relevant_script_feature.cc sentence.pb.cc sentence_features.cc task_context.cc task_context_params.cc task_spec.pb.cc text_processing.cc unicodetext.cc utf8statetable.cc utils.cc workspace.cc
139
- SRCS = $(ORIG_SRCS)
140
- OBJS = base.o embedding_feature_extractor.o embedding_network.o feature_extractor.o feature_extractor.pb.o feature_types.o fixunicodevalue.o fml_parser.o generated_entities.o generated_ulscript.o getonescriptspan.o lang_id_nn_params.o language_identifier_features.o nnet_language_identifier.o nnet_language_identifier_c.o offsetmap.o registry.o relevant_script_feature.o sentence.pb.o sentence_features.o task_context.o task_context_params.o task_spec.pb.o text_processing.o unicodetext.o utf8statetable.o utils.o workspace.o
141
- HDRS = $(srcdir)/base.h $(srcdir)/casts.h $(srcdir)/embedding_feature_extractor.h $(srcdir)/embedding_network.h $(srcdir)/embedding_network_params.h $(srcdir)/feature_extractor.h $(srcdir)/feature_types.h $(srcdir)/float16.h $(srcdir)/fml_parser.h $(srcdir)/language_identifier_features.h $(srcdir)/lang_id_nn_params.h $(srcdir)/nnet_language_identifier.h $(srcdir)/registry.h $(srcdir)/relevant_script_feature.h $(srcdir)/script_detector.h $(srcdir)/sentence_features.h $(srcdir)/simple_adder.h $(srcdir)/fixunicodevalue.h $(srcdir)/generated_ulscript.h $(srcdir)/getonescriptspan.h $(srcdir)/integral_types.h $(srcdir)/offsetmap.h $(srcdir)/port.h $(srcdir)/stringpiece.h $(srcdir)/text_processing.h $(srcdir)/utf8acceptinterchange.h $(srcdir)/utf8prop_lettermarkscriptnum.h $(srcdir)/utf8repl_lettermarklower.h $(srcdir)/utf8scannot_lettermarkspecial.h $(srcdir)/utf8statetable.h $(srcdir)/task_context.h $(srcdir)/task_context_params.h $(srcdir)/unicodetext.h $(srcdir)/utils.h $(srcdir)/workspace.h $(srcdir)/feature_extractor.pb.h $(srcdir)/sentence.pb.h $(srcdir)/task_spec.pb.h
142
- LOCAL_HDRS =
143
- TARGET = libcld3
144
- TARGET_NAME = libcld3
145
- TARGET_ENTRY = Init_$(TARGET_NAME)
146
- DLLIB = $(TARGET).so
147
- EXTSTATIC =
148
- STATIC_LIB =
149
-
150
- TIMESTAMP_DIR = .
151
- BINDIR = $(bindir)
152
- RUBYCOMMONDIR = $(sitedir)$(target_prefix)
153
- RUBYLIBDIR = $(sitelibdir)$(target_prefix)
154
- RUBYARCHDIR = $(sitearchdir)$(target_prefix)
155
- HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
156
- ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
157
- TARGET_SO_DIR =
158
- TARGET_SO = $(TARGET_SO_DIR)$(DLLIB)
159
- CLEANLIBS = $(TARGET_SO)
160
- CLEANOBJS = *.o *.bak
161
-
162
- all: $(DLLIB)
163
- static: $(STATIC_LIB)
164
- .PHONY: all install static install-so install-rb
165
- .PHONY: clean clean-so clean-static clean-rb
166
-
167
- clean-static::
168
- clean-rb-default::
169
- clean-rb::
170
- clean-so::
171
- clean: clean-so clean-static clean-rb-default clean-rb
172
- -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
173
-
174
- distclean-rb-default::
175
- distclean-rb::
176
- distclean-so::
177
- distclean-static::
178
- distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
179
- -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
180
- -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
181
- -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
182
-
183
- realclean: distclean
184
- install: install-so install-rb
185
-
186
- install-so: $(DLLIB) $(TIMESTAMP_DIR)/.sitearchdir.time
187
- $(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
188
- clean-static::
189
- -$(Q)$(RM) $(STATIC_LIB)
190
- install-rb: pre-install-rb do-install-rb install-rb-default
191
- install-rb-default: pre-install-rb-default do-install-rb-default
192
- pre-install-rb: Makefile
193
- pre-install-rb-default: Makefile
194
- do-install-rb:
195
- do-install-rb-default:
196
- pre-install-rb-default:
197
- @$(NULLCMD)
198
- $(TIMESTAMP_DIR)/.sitearchdir.time:
199
- $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
200
- $(Q) $(TOUCH) $@
201
-
202
- site-install: site-install-so site-install-rb
203
- site-install-so: install-so
204
- site-install-rb: install-rb
205
-
206
- .SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
207
-
208
- .cc.o:
209
- $(ECHO) compiling $(<)
210
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
211
-
212
- .cc.S:
213
- $(ECHO) translating $(<)
214
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
215
-
216
- .mm.o:
217
- $(ECHO) compiling $(<)
218
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
219
-
220
- .mm.S:
221
- $(ECHO) translating $(<)
222
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
223
-
224
- .cxx.o:
225
- $(ECHO) compiling $(<)
226
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
227
-
228
- .cxx.S:
229
- $(ECHO) translating $(<)
230
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
231
-
232
- .cpp.o:
233
- $(ECHO) compiling $(<)
234
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
235
-
236
- .cpp.S:
237
- $(ECHO) translating $(<)
238
- $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
239
-
240
- .c.o:
241
- $(ECHO) compiling $(<)
242
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
243
-
244
- .c.S:
245
- $(ECHO) translating $(<)
246
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
247
-
248
- .m.o:
249
- $(ECHO) compiling $(<)
250
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$<
251
-
252
- .m.S:
253
- $(ECHO) translating $(<)
254
- $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $(CSRCFLAG)$<
255
-
256
- $(TARGET_SO): $(OBJS) Makefile
257
- $(ECHO) linking shared-object $(DLLIB)
258
- -$(Q)$(RM) $(@)
259
- $(Q) $(LDSHAREDXX) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
260
-
261
-
262
-
263
- $(OBJS): $(HDRS) $(ruby_headers)
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,36 +0,0 @@
1
- "pkg-config --exists protobuf"
2
- | pkg-config --libs protobuf
3
- => "-lprotobuf -pthread -lpthread\n"
4
- "gcc -o conftest -I/usr/include/ruby-2.4.0/x86_64-linux -I/usr/include/ruby-2.4.0/ruby/backward -I/usr/include/ruby-2.4.0 -I. -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby -lpthread -lgmp -ldl -lcrypt -lm -lc"
5
- checked program was:
6
- /* begin */
7
- 1: #include "ruby.h"
8
- 2:
9
- 3: int main(int argc, char **argv)
10
- 4: {
11
- 5: return 0;
12
- 6: }
13
- /* end */
14
-
15
- "gcc -o conftest -I/usr/include/ruby-2.4.0/x86_64-linux -I/usr/include/ruby-2.4.0/ruby/backward -I/usr/include/ruby-2.4.0 -I. -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -fPIC conftest.c -L. -L/usr/lib -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector -rdynamic -Wl,-export-dynamic -lruby -lprotobuf -pthread -lpthread -lpthread -lgmp -ldl -lcrypt -lm -lc"
16
- checked program was:
17
- /* begin */
18
- 1: #include "ruby.h"
19
- 2:
20
- 3: int main(int argc, char **argv)
21
- 4: {
22
- 5: return 0;
23
- 6: }
24
- /* end */
25
-
26
- | pkg-config --cflags-only-I protobuf
27
- => "\n"
28
- | pkg-config --cflags-only-other protobuf
29
- => "-pthread\n"
30
- | pkg-config --libs-only-l protobuf
31
- => "-lprotobuf -lpthread\n"
32
- package configuration for protobuf
33
- cflags: -pthread
34
- ldflags: -pthread
35
- libs: -lprotobuf -lpthread
36
-
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file