From af2d3c98664d83519a3334d560fad3ecdc6990ee Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 17 Jul 2016 11:59:26 +0000 Subject: [PATCH] Move generated headers to unicode data directory * common.mk, enc/depend (casefold.h, name2ctype.h): move to unicode data directory per version. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 ++ common.mk | 56 ++++++++++++----------- enc/depend | 4 +- enc/unicode.c | 22 ++++++++- enc/unicode/{ => data/8.0.0}/casefold.h | 0 enc/unicode/{ => data/8.0.0}/name2ctype.h | 0 6 files changed, 57 insertions(+), 30 deletions(-) rename enc/unicode/{ => data/8.0.0}/casefold.h (100%) rename enc/unicode/{ => data/8.0.0}/name2ctype.h (100%) diff --git a/ChangeLog b/ChangeLog index fa61269d99..e3ba23cdbf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Jul 17 20:59:24 2016 Nobuyoshi Nakada + + * common.mk, enc/depend (casefold.h, name2ctype.h): move to + unicode data directory per version. + Sat Jul 16 06:26:00 2016 Nobuyoshi Nakada * common.mk, enc/Makefile.in: moved timestamp files for diff --git a/common.mk b/common.mk index 90208344ac..f76413c10c 100644 --- a/common.mk +++ b/common.mk @@ -13,12 +13,22 @@ ECHO = @$(ECHO0) UNICODE_VERSION = 8.0.0 +### set the following environment variable or uncomment the line if +### the Unicode data files should be updated completely on every update ('make up',...). +# ALWAYS_UPDATE_UNICODE = yes +UNICODE_DATA_DIR = enc/unicode/data/$(UNICODE_VERSION) +UNICODE_SRC_DATA_DIR = $(srcdir)/$(UNICODE_DATA_DIR) +UNICODE_DATA_HEADERS = \ + $(UNICODE_SRC_DATA_DIR)/casefold.h \ + $(UNICODE_SRC_DATA_DIR)/name2ctype.h \ + $(empty) + RUBY_RELEASE_DATE = $(RUBY_RELEASE_YEAR)-$(RUBY_RELEASE_MONTH)-$(RUBY_RELEASE_DAY) RUBYLIB = $(PATH_SEPARATOR) RUBYOPT = - RUN_OPTS = --disable-gems -INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir) +INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir) -I$(srcdir)/enc/unicode/data/$(UNICODE_VERSION) GEM_HOME = GEM_PATH = @@ -628,10 +638,10 @@ extconf: $(PREP) $(RBCONFIG): $(srcdir)/tool/mkconfig.rb config.status $(srcdir)/version.h $(Q)$(BOOTSTRAPRUBY) -n \ - -e 'BEGIN{version=ARGV.shift;ok=false}' \ - -e 'END{abort "UNICODE version mismatch" unless ok}' \ - -e '(ARGF.close; ok = true) if /ONIG_UNICODE_VERSION_STRING +"#{Regexp.quote(version)}"/o' \ - $(UNICODE_VERSION) $(srcdir)/enc/unicode/casefold.h + -e 'BEGIN{version=ARGV.shift;mis=ARGV.dup}' \ + -e 'END{abort "UNICODE version mismatch: #{mis}" unless mis.empty?}' \ + -e '(mis.delete(ARGF.path); ARGF.close) if /ONIG_UNICODE_VERSION_STRING +"#{Regexp.quote(version)}"/o' \ + $(UNICODE_VERSION) $(UNICODE_DATA_HEADERS) $(Q)$(BOOTSTRAPRUBY) $(srcdir)/tool/mkconfig.rb \ -cross_compiling=$(CROSS_COMPILING) \ -arch=$(arch) -version=$(RUBY_PROGRAM_VERSION) \ @@ -655,7 +665,7 @@ encs: enc trans libencs: libenc libtrans encs enc trans libencs libenc libtrans: $(SHOWFLAGS) $(ENC_MK) $(LIBRUBY) $(PREP) PHONY $(ECHO) making $@ - $(Q) $(MAKE) -f $(ENC_MK) V="$(V)" \ + $(Q) $(MAKE) -f $(ENC_MK) V="$(V)" UNICODE_VERSION=$(UNICODE_VERSION) \ RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" \ $(MFLAGS) $@ @@ -809,14 +819,14 @@ srcs-lib: $(LIB_SRCS) srcs-enc: $(ENC_MK) $(ECHO) making srcs under enc - $(Q) $(MAKE) -f $(ENC_MK) RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" $(MFLAGS) srcs + $(Q) $(MAKE) -f $(ENC_MK) UNICODE_VERSION=$(UNICODE_VERSION) \ + RUBY="$(MINIRUBY)" MINIRUBY="$(MINIRUBY)" $(MFLAGS) srcs all-incs: incs {$(VPATH)}encdb.h {$(VPATH)}transdb.h incs: $(INSNS) {$(VPATH)}node_name.inc {$(VPATH)}known_errors.inc \ {$(VPATH)}vm_call_iseq_optimized.inc $(srcdir)/revision.h \ $(REVISION_H) \ - $(srcdir)/enc/unicode/name2ctype.h $(srcdir)/enc/jis/props.h \ - $(srcdir)/enc/unicode/casefold.h \ + $(UNICODE_DATA_HEADERS) $(srcdir)/enc/jis/props.h \ {$(VPATH)}id.h {$(VPATH)}probes.dmyh insns: $(INSNS) @@ -1034,12 +1044,6 @@ update-bundled_gems: PHONY "$(srcdir)/gems/bundled_gems" | \ "$(IFCHANGE)" "$(srcdir)/gems/bundled_gems" - -### set the following environment variable or uncomment the line if -### the Unicode data files should be updated completely on every update ('make up',...). -# ALWAYS_UPDATE_UNICODE = yes -UNICODE_DATA_DIR = enc/unicode/data/$(UNICODE_VERSION) -UNICODE_SRC_DATA_DIR = $(srcdir)/$(UNICODE_DATA_DIR) - UNICODE_FILES = $(UNICODE_SRC_DATA_DIR)/UnicodeData.txt \ $(UNICODE_SRC_DATA_DIR)/CompositionExclusions.txt \ $(UNICODE_SRC_DATA_DIR)/NormalizationTest.txt \ @@ -1082,7 +1086,7 @@ $(UNICODE_SRC_DATA_DIR)/$(ALWAYS_UPDATE_UNICODE:yes=.unicode-tables.time): $(UNI $(UNICODE_SRC_DATA_DIR)/.unicode-tables.time: $(srcdir)/tool/generic_erb.rb \ $(srcdir)/template/unicode_norm_gen.tmpl - $(Q) $(ALWAYS_UPDATE_UNICODE:yes=exit &&) $(MAKE) $(MFLAGS) Q=$(Q) update-unicode + $(Q) $(ALWAYS_UPDATE_UNICODE:yes=exit &&) $(MAKE) $(MFLAGS) Q=$(Q) UNICODE_VERSION=$(UNICODE_VERSION) update-unicode $(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb \ -c -t$@ -o $(srcdir)/lib/unicode_normalize/tables.rb \ -I $(srcdir) \ @@ -1091,27 +1095,27 @@ $(UNICODE_SRC_DATA_DIR)/.unicode-tables.time: $(srcdir)/tool/generic_erb.rb \ # UPDATE_NAME2CTYPE= : toplevel # UPDATE_NAME2CTYPE=yes : sub-make to update name2ctype.h -$(srcdir)/enc/unicode/$(UPDATE_NAME2CTYPE:yes=.ignore.)name2ctype.h: - $(MAKE) UPDATE_NAME2CTYPE=yes $@ +$(UNICODE_SRC_DATA_DIR)/$(UPDATE_NAME2CTYPE:yes=.ignore.)name2ctype.h: + $(Q) $(MAKE) $(MFLAGS) Q=$(Q) UPDATE_NAME2CTYPE=yes UNICODE_VERSION=$(UNICODE_VERSION) $@ -$(srcdir)/enc/unicode/$(UPDATE_NAME2CTYPE:yes=name2ctype.h): \ +$(UNICODE_SRC_DATA_DIR)/$(UPDATE_NAME2CTYPE:yes=name2ctype.h): \ $(UNICODE_SRC_DATA_DIR)/UnicodeData.txt \ $(UNICODE_PROPERTY_FILES) $(MAKEDIRS) $(@D) $(BOOTSTRAPRUBY) $(srcdir)/tool/enc-unicode.rb --header $(UNICODE_SRC_DATA_DIR) > $@ # the next non-comment line was: -# $(srcdir)/enc/unicode/casefold.h: $(srcdir)/enc/unicode/case-folding.rb \ +# $(UNICODE_SRC_DATA_DIR)/casefold.h: $(UNICODE_SRC_DATA_DIR)/case-folding.rb \ # but was changed to make sure CI works on systems that don't have gperf -unicode-up: $(srcdir)/enc/unicode/casefold.h +unicode-up: $(UNICODE_DATA_HEADERS) -$(srcdir)/$(ALWAYS_UPDATE_UNICODE:yes=enc/unicode/casefold.h): \ +$(UNICODE_SRC_DATA_DIR)/$(ALWAYS_UPDATE_UNICODE:yes=casefold.h): \ $(UNICODE_SRC_DATA_DIR)/UnicodeData.txt \ $(UNICODE_SRC_DATA_DIR)/SpecialCasing.txt \ $(UNICODE_SRC_DATA_DIR)/CaseFolding.txt -$(srcdir)/enc/unicode/casefold.h: $(srcdir)/enc/unicode/case-folding.rb - $(Q) $(ALWAYS_UPDATE_UNICODE:yes=exit &&) $(MAKE) $(MFLAGS) Q=$(Q) update-unicode +$(UNICODE_SRC_DATA_DIR)/casefold.h: $(srcdir)/enc/unicode/case-folding.rb + $(Q) $(ALWAYS_UPDATE_UNICODE:yes=exit &&) $(MAKE) $(MFLAGS) Q=$(Q) UNICODE_VERSION=$(UNICODE_VERSION) update-unicode $(Q) $(BASERUBY) $(srcdir)/enc/unicode/case-folding.rb \ --output-file=$@ \ --mapping-data-directory=$(UNICODE_SRC_DATA_DIR) @@ -1442,11 +1446,11 @@ enc/trans/newline.$(OBJEXT): {$(VPATH)}st.h enc/trans/newline.$(OBJEXT): {$(VPATH)}subst.h enc/trans/newline.$(OBJEXT): {$(VPATH)}transcode_data.h enc/unicode.$(OBJEXT): $(hdrdir)/ruby/ruby.h +enc/unicode.$(OBJEXT): $(UNICODE_SRC_DATA_DIR)/casefold.h +enc/unicode.$(OBJEXT): $(UNICODE_SRC_DATA_DIR)/name2ctype.h enc/unicode.$(OBJEXT): {$(VPATH)}config.h enc/unicode.$(OBJEXT): {$(VPATH)}defines.h enc/unicode.$(OBJEXT): {$(VPATH)}enc/unicode.c -enc/unicode.$(OBJEXT): {$(VPATH)}enc/unicode/casefold.h -enc/unicode.$(OBJEXT): {$(VPATH)}enc/unicode/name2ctype.h enc/unicode.$(OBJEXT): {$(VPATH)}intern.h enc/unicode.$(OBJEXT): {$(VPATH)}missing.h enc/unicode.$(OBJEXT): {$(VPATH)}oniguruma.h diff --git a/enc/depend b/enc/depend index 48a7cb0128..d2ee791c31 100644 --- a/enc/depend +++ b/enc/depend @@ -602,8 +602,8 @@ enc/unicode.$(OBJEXT): $(top_srcdir)/regint.h enc/unicode.$(OBJEXT): config.h enc/unicode.$(OBJEXT): defines.h enc/unicode.$(OBJEXT): enc/unicode.c -enc/unicode.$(OBJEXT): enc/unicode/casefold.h -enc/unicode.$(OBJEXT): enc/unicode/name2ctype.h +enc/unicode.$(OBJEXT): enc/unicode/data/$(UNICODE_VERSION)/casefold.h +enc/unicode.$(OBJEXT): enc/unicode/data/$(UNICODE_VERSION)/name2ctype.h enc/unicode.$(OBJEXT): intern.h enc/unicode.$(OBJEXT): missing.h enc/unicode.$(OBJEXT): oniguruma.h diff --git a/enc/unicode.c b/enc/unicode.c index 39d1e7a31f..ab91bca829 100644 --- a/enc/unicode.c +++ b/enc/unicode.c @@ -164,7 +164,7 @@ code3_equal(const OnigCodePoint *x, const OnigCodePoint *y) #define L(n) SpecialsLengthEncode(n) #endif /* ONIG_CASE_MAPPING */ -#include "enc/unicode/casefold.h" +#include "casefold.h" #ifdef ONIG_CASE_MAPPING #undef U @@ -178,7 +178,7 @@ code3_equal(const OnigCodePoint *x, const OnigCodePoint *y) #undef L #endif /* ONIG_CASE_MAPPING */ -#include "enc/unicode/name2ctype.h" +#include "name2ctype.h" #define CODE_RANGES_NUM numberof(CodeRanges) @@ -800,3 +800,21 @@ onigenc_unicode_case_map(OnigCaseFoldType* flagP, } #endif /* ONIG_CASE_MAPPING */ + +#if 0 +const char onigenc_unicode_version_string[] = +#ifdef ONIG_UNICODE_VERSION_STRING + ONIG_UNICODE_VERSION_STRING +#endif + ""; + +const int onigenc_unicode_version_number[3] = { +#ifdef ONIG_UNICODE_VERSION_MAJOR + ONIG_UNICODE_VERSION_MAJOR, + ONIG_UNICODE_VERSION_MINOR, + ONIG_UNICODE_VERSION_TEENY, +#else + 0 +#endif +}; +#endif diff --git a/enc/unicode/casefold.h b/enc/unicode/data/8.0.0/casefold.h similarity index 100% rename from enc/unicode/casefold.h rename to enc/unicode/data/8.0.0/casefold.h diff --git a/enc/unicode/name2ctype.h b/enc/unicode/data/8.0.0/name2ctype.h similarity index 100% rename from enc/unicode/name2ctype.h rename to enc/unicode/data/8.0.0/name2ctype.h