From 70ce3a298df53ad2e5ec404d753c4d6f8450590d Mon Sep 17 00:00:00 2001 From: Jens Wille Date: Sat, 12 Jan 2013 11:29:34 +0100 Subject: [PATCH] Move extension files into separate subdirectory (and sync with windows branch). (Release as 0.4.3.1) (Closes #4) --- MANIFEST | 14 -------------- Rakefile | 23 +++++++++++++++++++++++ ext/unicode/extconf.rb | 3 +++ unicode.c => ext/unicode/unicode.c | 2 +- unidata.map => ext/unicode/unidata.map | 0 ustring.c => ext/unicode/ustring.c | 0 ustring.h => ext/unicode/ustring.h | 0 wstring.c => ext/unicode/wstring.c | 0 wstring.h => ext/unicode/wstring.h | 0 extconf.rb | 3 --- lib/unicode.rb | 6 ++++++ test.rb => test/test.rb | 0 unicode.gemspec | 15 ++++++++++----- 13 files changed, 43 insertions(+), 23 deletions(-) delete mode 100644 MANIFEST create mode 100644 Rakefile create mode 100644 ext/unicode/extconf.rb rename unicode.c => ext/unicode/unicode.c (99%) rename unidata.map => ext/unicode/unidata.map (100%) rename ustring.c => ext/unicode/ustring.c (100%) rename ustring.h => ext/unicode/ustring.h (100%) rename wstring.c => ext/unicode/wstring.c (100%) rename wstring.h => ext/unicode/wstring.h (100%) delete mode 100644 extconf.rb create mode 100644 lib/unicode.rb rename test.rb => test/test.rb (100%) diff --git a/MANIFEST b/MANIFEST deleted file mode 100644 index dfa8b46..0000000 --- a/MANIFEST +++ /dev/null @@ -1,14 +0,0 @@ -unidata.map -extconf.rb -unicode.c -MANIFEST -tools/mkunidata.rb -tools/normtest.rb -tools/README -wstring.c -README -ustring.h -wstring.h -ustring.c -test.rb -unicode.gemspec diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..ee13523 --- /dev/null +++ b/Rakefile @@ -0,0 +1,23 @@ +require "rake/clean" +require "rake/extensiontask" +require "rubygems/package_task" + +CLEAN << "pkg" << "tmp" << "lib/unicode" + +gem_spec = eval(File.read(File.expand_path("../unicode.gemspec", __FILE__))) + +Gem::PackageTask.new(gem_spec) {|pkg|} + +Rake::ExtensionTask.new('unicode_native', gem_spec) do |ext| + ext.cross_compile = true + ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60'] + ext.ext_dir = "ext/unicode" + ext.lib_dir = "lib/unicode" +end + +desc "Build native gems for Windows" +task :windows_gem => :clean do + ENV["RUBY_CC_VERSION"] = "1.8.7:1.9.3" + sh "rake cross compile" + sh "rake cross native gem" +end diff --git a/ext/unicode/extconf.rb b/ext/unicode/extconf.rb new file mode 100644 index 0000000..52f2a82 --- /dev/null +++ b/ext/unicode/extconf.rb @@ -0,0 +1,3 @@ +require 'mkmf' + +create_makefile("unicode/unicode_native") diff --git a/unicode.c b/ext/unicode/unicode.c similarity index 99% rename from unicode.c rename to ext/unicode/unicode.c index ee1cfd1..e353633 100644 --- a/unicode.c +++ b/ext/unicode/unicode.c @@ -1230,7 +1230,7 @@ unicode_get_text_elements(VALUE obj, VALUE str) } void -Init_unicode() +Init_unicode_native() { int i; diff --git a/unidata.map b/ext/unicode/unidata.map similarity index 100% rename from unidata.map rename to ext/unicode/unidata.map diff --git a/ustring.c b/ext/unicode/ustring.c similarity index 100% rename from ustring.c rename to ext/unicode/ustring.c diff --git a/ustring.h b/ext/unicode/ustring.h similarity index 100% rename from ustring.h rename to ext/unicode/ustring.h diff --git a/wstring.c b/ext/unicode/wstring.c similarity index 100% rename from wstring.c rename to ext/unicode/wstring.c diff --git a/wstring.h b/ext/unicode/wstring.h similarity index 100% rename from wstring.h rename to ext/unicode/wstring.h diff --git a/extconf.rb b/extconf.rb deleted file mode 100644 index d06138b..0000000 --- a/extconf.rb +++ /dev/null @@ -1,3 +0,0 @@ -require 'mkmf' - -create_makefile("unicode") diff --git a/lib/unicode.rb b/lib/unicode.rb new file mode 100644 index 0000000..c648337 --- /dev/null +++ b/lib/unicode.rb @@ -0,0 +1,6 @@ +begin + RUBY_VERSION =~ /(\d+.\d+)/ + require "unicode/#{$1}/unicode_native" +rescue LoadError + require 'unicode/unicode_native' +end diff --git a/test.rb b/test/test.rb similarity index 100% rename from test.rb rename to test/test.rb diff --git a/unicode.gemspec b/unicode.gemspec index 900ef90..7c1c4ea 100644 --- a/unicode.gemspec +++ b/unicode.gemspec @@ -2,17 +2,22 @@ Gem::Specification.new do |s| s.name = %q{unicode} - s.version = "0.4.3" + s.version = "0.4.3.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = [%q{Yoshida Masato}] s.date = %q{2012-08-07} s.email = %q{yoshidam@yoshidam.net} - s.extensions = [%q{extconf.rb}] - s.extra_rdoc_files = [%q{README}] - s.files = [%q{extconf.rb}, %q{unicode.c}, %q{ustring.c}, %q{ustring.h}, %q{wstring.c}, %q{wstring.h}, %q{README}, %q{tools/mkunidata.rb}, %q{tools/normtest.rb}, %q{tools/README}, %q{unidata.map}] + s.extensions = %w[ext/unicode/extconf.rb] + s.extra_rdoc_files = %w[README] + s.files = %w[ + README Rakefile unicode.gemspec lib/unicode.rb + test/test.rb tools/README tools/mkunidata.rb tools/normtest.rb + ext/unicode/extconf.rb ext/unicode/unicode.c ext/unicode/unidata.map + ext/unicode/ustring.c ext/unicode/ustring.h ext/unicode/wstring.c ext/unicode/wstring.h + ] s.homepage = %q{http://www.yoshidam.net/Ruby.html#unicode} - s.require_paths = [%q{.}] + s.require_paths = %w[lib] s.rubygems_version = %q{1.8.6} s.summary = %q{Unicode normalization library.} s.description = %q{Unicode normalization library.}