summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-30 07:39:51 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-10-30 07:39:51 +0000
commit39713bd9277303d406ea43975b2f4d096a537dc4 (patch)
treede6d3f761ba6fd00097a061494ef4cc504dc5254
parent40cc9231a9b37bfb22571a68fa0493e0ba532405 (diff)
common.mk: separate Unicode files directory
* common.mk: download Unicode files into separate directory for the version. * tool/downloader.rb (Downloader::Unicode.download): strip version directory. * tool/downloader.rb (Downloader.download): strip directory name if download directory is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--common.mk29
-rw-r--r--tool/downloader.rb6
2 files changed, 21 insertions, 14 deletions
diff --git a/common.mk b/common.mk
index 4a8aa394d6..1a54f2e218 100644
--- a/common.mk
+++ b/common.mk
@@ -10,6 +10,8 @@ Q1 = $(V:1=)
Q = $(Q1:0=@)
ECHO = $(ECHO1:0=@echo)
+UNICODE_VERSION = 7.0.0
+
RUBYLIB = $(PATH_SEPARATOR)
RUBYOPT = -
RUN_OPTS = --disable-gems
@@ -1103,21 +1105,25 @@ update-gems: PHONY
### the Unicode data files are updated every minute.
# ALWAYS_UPDATE_UNICODE = yes
-UNICODE_FILES = $(srcdir)/enc/unicode/data/UnicodeData.txt \
- $(srcdir)/enc/unicode/data/CompositionExclusions.txt \
- $(srcdir)/enc/unicode/data/NormalizationTest.txt
+UNICODE_FILES = $(srcdir)/enc/unicode/data/$(UNICODE_VERSION)/UnicodeData.txt \
+ $(srcdir)/enc/unicode/data/$(UNICODE_VERSION)/CompositionExclusions.txt \
+ $(srcdir)/enc/unicode/data/$(UNICODE_VERSION)/NormalizationTest.txt
update-unicode: $(UNICODE_FILES) PHONY
-$(UNICODE_FILES): ./.update-unicode.time
+$(UNICODE_FILES): ./.unicode-$(UNICODE_VERSION).time
UPDATE_UNICODE_FILES_DEPS = $(ALWAYS_UPDATE_UNICODE:yes=PHONY)
-./.update-unicode.time: $(UPDATE_UNICODE_FILES_DEPS:no=)
- $(ECHO) Downloading Unicode data files...
- $(Q) $(MAKEDIRS) "$(srcdir)/enc/unicode/data"
- $(Q) $(BASERUBY) -C "$(srcdir)/enc/unicode/data" \
- ../../../tool/downloader.rb -e $(ALWAYS_UPDATE_UNICODE:yes=-a) unicode \
- UnicodeData.txt CompositionExclusions.txt NormalizationTest.txt
+./.unicode-tables.time: ./.unicode-$(UNICODE_VERSION).time
+./.unicode-$(UNICODE_VERSION).time: $(UPDATE_UNICODE_FILES_DEPS:no=)
+ $(ECHO) Downloading Unicode $(UNICODE_VERSION) data files...
+ $(Q) $(MAKEDIRS) "$(srcdir)/enc/unicode/data/$(UNICODE_VERSION)"
+ $(Q) $(BASERUBY) -C "$(srcdir)" tool/downloader.rb \
+ -d enc/unicode/data/$(UNICODE_VERSION) \
+ -e $(ALWAYS_UPDATE_UNICODE:yes=-a) unicode \
+ $(UNICODE_VERSION)/ucd/UnicodeData.txt \
+ $(UNICODE_VERSION)/ucd/CompositionExclusions.txt \
+ $(UNICODE_VERSION)/ucd/NormalizationTest.txt
@exit > .update-unicode.time
$(srcdir)/lib/unicode_normalize/tables.rb: ./.unicode-tables.time
@@ -1127,7 +1133,8 @@ $(srcdir)/lib/unicode_normalize/tables.rb: ./.unicode-tables.time
$(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb \
-c -t$@ -o $(srcdir)/lib/unicode_normalize/tables.rb \
-I $(srcdir) \
- $(srcdir)/template/unicode_norm_gen.tmpl enc/unicode/data lib/unicode_normalize
+ $(srcdir)/template/unicode_norm_gen.tmpl \
+ enc/unicode/data/$(UNICODE_VERSION) lib/unicode_normalize
info: info-program info-libruby_a info-libruby_so info-arch
info-program: PHONY
diff --git a/tool/downloader.rb b/tool/downloader.rb
index 27c706d9ae..3b39f45ed0 100644
--- a/tool/downloader.rb
+++ b/tool/downloader.rb
@@ -17,7 +17,7 @@ class Downloader
class Unicode < self
def self.download(name, *rest)
- super("http://www.unicode.org/Public/7.0.0/ucd/#{name}", name, *rest)
+ super("http://www.unicode.org/Public/#{name}", name, *rest)
end
end
@@ -53,7 +53,7 @@ class Downloader
# download 'http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt',
# 'UnicodeData.txt', 'enc/unicode/data'
def self.download(url, name, dir = nil, ims = true)
- file = dir ? File.join(dir, name) : name
+ file = dir ? File.join(dir, File.basename(name)) : name
return true if ims.nil? and File.exist?(file)
url = URI(url)
if $VERBOSE
@@ -124,7 +124,7 @@ if $0 == __FILE__
end
dl = Downloader.constants.find do |name|
ARGV[0].casecmp(name.to_s) == 0
- end
+ end unless ARGV.empty?
$VERBOSE = true
if dl
dl = Downloader.const_get(dl)