[macruby-changes] [5001] MacRuby/branches/icu-embedded

source_changes at macosforge.org source_changes at macosforge.org
Wed Dec 8 19:26:09 PST 2010


Revision: 5001
          http://trac.macosforge.org/projects/ruby/changeset/5001
Author:   lsansonetti at apple.com
Date:     2010-12-08 19:26:05 -0800 (Wed, 08 Dec 2010)
Log Message:
-----------
build/link ICU statically (doesn't work yet, alas...) - make sure you download icu4c-4_4_2-src.tgz into the main directory

Modified Paths:
--------------
    MacRuby/branches/icu-embedded/rakelib/builder/options.rb
    MacRuby/branches/icu-embedded/rakelib/builder.rake

Removed Paths:
-------------
    MacRuby/branches/icu-embedded/icu-1060/

Modified: MacRuby/branches/icu-embedded/rakelib/builder/options.rb
===================================================================
--- MacRuby/branches/icu-embedded/rakelib/builder/options.rb	2010-12-09 03:15:43 UTC (rev 5000)
+++ MacRuby/branches/icu-embedded/rakelib/builder/options.rb	2010-12-09 03:26:05 UTC (rev 5001)
@@ -154,7 +154,7 @@
     archflags = archs.map { |x| "-arch #{x}" }.join(' ')
     @cflags = "-std=c99 -I. -I./include -fno-common -pipe -g -Wall -fexceptions -O#{OPTZ_LEVEL} -Wno-deprecated-declarations -Werror #{archflags}"
     @cxxflags = "-I. -I./include -g -Wall -Wno-deprecated-declarations -Werror #{archflags}"
-    @ldflags = '-lpthread -ldl -lxml2 -lobjc -licucore -framework Foundation'
+    @ldflags = '-lpthread -ldl -lxml2 -lobjc -framework Foundation'
     @ldflags << " -lauto" if has_libauto
     if opt.delete(:static)
       @cflags << ' -DMACRUBY_STATIC'
@@ -171,9 +171,11 @@
     end
     @cxxflags << " -fno-rtti" unless @cxxflags.index("-fno-rtti")
     @dldflags = "-dynamiclib -undefined suppress -flat_namespace -install_name #{INSTALL_NAME} -current_version #{MACRUBY_VERSION} -compatibility_version #{MACRUBY_VERSION} -exported_symbols_list #{EXPORTED_SYMBOLS_LIST}"
-    if `sw_vers -productVersion`.to_f <= 10.6
-      @cflags << ' -I./icu-1060'
-      @cxxflags << ' -I./icu-1060'
+    unless opt.delete(:system_icu)
+      @ldflags << " -L./icu/source/lib -licudata -licui18n -licuio -licutu -licuuc"
+      icu_headers = ' -I./icu/source/common -I./icu/source/i18n'
+      @cflags << icu_headers
+      @cxxflags << icu_headers
     end
     if sdk
       sdk_flags = "--sysroot=#{sdk}"

Modified: MacRuby/branches/icu-embedded/rakelib/builder.rake
===================================================================
--- MacRuby/branches/icu-embedded/rakelib/builder.rake	2010-12-09 03:15:43 UTC (rev 5000)
+++ MacRuby/branches/icu-embedded/rakelib/builder.rake	2010-12-09 03:26:05 UTC (rev 5001)
@@ -70,7 +70,7 @@
 end
 
 desc "Create miniruby"
-task :miniruby => :files do
+task :miniruby => ['icu:build', :files] do
   $builder.config = FULL_CONFIG
   build_objects
   $builder.link_executable('miniruby', OBJS)
@@ -82,9 +82,35 @@
   Builder.create_rbconfig
 end
 
+namespace :icu do
+  ICU_PKG = 'icu4c-4_4_2-src.tgz'
+
+  desc "Build ICU static libs"
+  task :build do
+    unless File.exists?('icu')
+      sh "/usr/bin/tar -xzf #{ICU_PKG}"
+#      Dir.chdir('icu/source') do
+#        sh "/usr/bin/patch -p0 <../../icu-patch.diff"
+#      end
+    end
+    Dir.chdir('icu/source') do
+      unless File.exist?('Makefile')
+        archf = ARCHS.map { |x| "-arch #{x}" }.join(' ')
+        sh "CC=\"#{CC}\" CXX=\"#{CXX}\" CFLAGS=\"#{archf}\" CXXFLAGS=\"#{archf}\" LDFLAGS=\"#{archf}\" ./runConfigureICU MacOSX --enable-static --disable-shared --disable-renaming --disable-extras --disable-layout --disable-samples"
+      end
+      sh "/usr/bin/make -j#{SIMULTANEOUS_JOBS}"
+    end
+  end
+
+  desc "Clean up ICU"
+  task :clean do
+    rm_rf 'icu'
+  end
+end
+
 namespace :macruby do
   desc "Build dynamic library"
-  task :dylib => [:rbconfig, :files] do
+  task :dylib => ['icu:build', :rbconfig, :files] do
     $builder.config = FULL_CONFIG
     build_objects
     dylib = "lib#{RUBY_SO_NAME}.#{NEW_RUBY_VERSION}.dylib"
@@ -99,7 +125,7 @@
   end
 
   desc "Build static library"
-  task :static => :files do
+  task :static => ['icu:build', :files] do
     $builder.config = STATIC_CONFIG
     build_objects
     $builder.link_archive("lib#{RUBY_SO_NAME}-static.a", $builder.objs - ['main', 'gc-stub'])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101208/3c73f7e1/attachment-0001.html>


More information about the macruby-changes mailing list