Class: ICURecipe
- Inherits:
-
MiniPortile
- Object
- MiniPortile
- ICURecipe
- Defined in:
- ext/icu/extconf.rb
Overview
Checkout the source code of ICU. site.icu-project.org/download/ userguide.icu-project.org/howtouseicu Also check the readme of ICU release file.
Instance Method Summary collapse
- #configure ⇒ Object
- #cook ⇒ Object
-
#initialize(name, version, static_p) {|_self| ... } ⇒ ICURecipe
constructor
A new instance of ICURecipe.
- #work_path ⇒ Object
Constructor Details
#initialize(name, version, static_p) {|_self| ... } ⇒ ICURecipe
Returns a new instance of ICURecipe.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'ext/icu/extconf.rb', line 69 def initialize(name, version, static_p) super(name, version) self.target = File.join(ROOT, "ports") # Prefer host_alias over host in order to use i586-mingw32msvc as # correct compiler prefix for cross build, but use host if not set. self.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"] self.patch_files = Dir[File.join(ROOT, "patches", name, "*.patch")].sort self. << "--libdir=#{File.join(self.path, "lib")}" yield self env = Hash.new do |hash, key| hash[key] = ENV[key].dup.to_s rescue '' end self..flatten! self..delete_if do |option| case option when /\A(\w+)=(.*)\z/ env[$1] = $2 true else false end end if static_p self. += [ "--enable-static", "--enable-shared", "--disable-renaming" ] env['CFLAGS'] = "-fPIC #{env['CFLAGS']}" env['CPPFLAGS'] = "-DU_CHARSET_IS_UTF8=1 -DU_USING_ICU_NAMESPACE=0 -DU_STATIC_IMPLEMENTATION #{env['CPPFLAGS']}" env['CXXFLAGS'] = "-fPIC -fno-exceptions #{env['CXXFLAGS']}" env['LDFLAGS'] = "-static-libstdc++ #{env['CFLAGS']}" else self. += [ "--enable-shared", "--disable-static", ] end if RbConfig::CONFIG['target_cpu'] == 'universal' %w[CFLAGS LDFLAGS].each do |key| unless env[key].include?('-arch') env[key] += ' ' + RbConfig::CONFIG['ARCH_FLAG'] end end end @env = env end |
Instance Method Details
#configure ⇒ Object
157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'ext/icu/extconf.rb', line 157 def configure # run as recommend, basically set up compiler and flags platform = if RUBY_PLATFORM =~ /mingw|mswin/ 'MSYS/MSVC' elsif RUBY_PLATFORM =~ /darwin/ 'MacOSX' else 'Linux' end # double quotes are significant. execute('ICU Configure', [@env] + ['./runConfigureICU', platform] + ) super end |
#cook ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'ext/icu/extconf.rb', line 124 def cook <<-"EOS" ************************************************************************ IMPORTANT NOTICE: Building ICU with a packaged version of #{name}-#{version}#{'.' if self.patch_files.empty?} EOS unless self.patch_files.empty? "with the following patches applied:\n" self.patch_files.each do |patch| "\t- %s\n" % File.basename(patch) end end <<-"EOS" gem install icu -- --use-system-libraries If you are using Bundler, tell it to use the option: bundle config build.icu --use-system-libraries bundle install EOS <<-"EOS" ************************************************************************ EOS super end |
#work_path ⇒ Object
170 171 172 |
# File 'ext/icu/extconf.rb', line 170 def work_path File.join(Dir.glob("#{tmp_path}/*").find { |d| File.directory?(d) }, 'source') end |