-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New data file generator with support for UCD 13 & 14 #228
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,57 @@ | ||
# Unicode data generation rules. Except for the test data files, most | ||
# users will not use these Makefile rules, which are primarily to re-generate | ||
# unicode_data.c when we get a new Unicode version or charwidth data; they | ||
# require ruby and julia to be installed. | ||
# unicode_data.c when we get a new Unicode version or charwidth data. | ||
# Requires python 3.7+, curl & sed to be installed. | ||
|
||
# programs | ||
CURL=curl | ||
RUBY=ruby | ||
PERL=perl | ||
MAKE=make | ||
JULIA=julia | ||
CURLFLAGS = --retry 5 --location | ||
CURL = /usr/bin/curl --retry 5 --location | ||
|
||
.PHONY: clean | ||
|
||
.DELETE_ON_ERROR: | ||
|
||
utf8proc_data.c.new: data_generator.rb UnicodeData.txt GraphemeBreakProperty.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt CharWidths.txt emoji-data.txt | ||
$(RUBY) data_generator.rb < UnicodeData.txt > $@ | ||
|
||
CharWidths.txt: charwidths.jl EastAsianWidth.txt | ||
$(JULIA) charwidths.jl > $@ | ||
utf8proc_data.c.new: ../data_make.py UnicodeData.txt GraphemeBreakProperty.txt DerivedCoreProperties.txt \ | ||
CompositionExclusions.txt CaseFolding.txt emoji-data.txt EastAsianWidth.txt | ||
../data_make.py --format=1 --fix26 --output $@ . | ||
|
||
# Unicode data version (must also update utf8proc_unicode_version function) | ||
UNICODE_VERSION=13.0.0 | ||
UNICODE_VERSION?=14.0.0 | ||
URL_ROOT = $(URLCACHE)https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd | ||
|
||
UnicodeData.txt: | ||
$(CURL) $(CURLFLAGS) -o $@ https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/UnicodeData.txt | ||
$(CURL) -o $@ $(URL_ROOT)/UnicodeData.txt | ||
|
||
EastAsianWidth.txt: | ||
$(CURL) $(CURLFLAGS) -o $@ $(URLCACHE)https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/EastAsianWidth.txt | ||
$(CURL) -o $@ $(URL_ROOT)/EastAsianWidth.txt | ||
|
||
GraphemeBreakProperty.txt: | ||
$(CURL) $(CURLFLAGS) -o $@ $(URLCACHE)https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/auxiliary/GraphemeBreakProperty.txt | ||
$(CURL) -o $@ $(URL_ROOT)/auxiliary/GraphemeBreakProperty.txt | ||
|
||
DerivedCoreProperties.txt: | ||
$(CURL) $(CURLFLAGS) -o $@ $(URLCACHE)https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/DerivedCoreProperties.txt | ||
$(CURL) -o $@ $(URL_ROOT)/DerivedCoreProperties.txt | ||
|
||
CompositionExclusions.txt: | ||
$(CURL) $(CURLFLAGS) -o $@ $(URLCACHE)https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/CompositionExclusions.txt | ||
$(CURL) -o $@ $(URL_ROOT)/CompositionExclusions.txt | ||
|
||
CaseFolding.txt: | ||
$(CURL) $(CURLFLAGS) -o $@ $(URLCACHE)https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/CaseFolding.txt | ||
$(CURL) -o $@ $(URL_ROOT)/CaseFolding.txt | ||
|
||
NormalizationTest.txt: | ||
$(CURL) $(CURLFLAGS) -o $@ $(URLCACHE)https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/NormalizationTest.txt | ||
$(CURL) -o $@ $(URL_ROOT)/NormalizationTest.txt | ||
|
||
GraphemeBreakTest.txt: | ||
$(CURL) $(CURLFLAGS) -o $@ $(URLCACHE)https://www.unicode.org/Public/$(UNICODE_VERSION)/ucd/auxiliary/GraphemeBreakTest.txt | ||
$(CURL) -o $@ $(URL_ROOT)/auxiliary/GraphemeBreakTest.txt | ||
|
||
emoji-data.txt: | ||
$(CURL) $(CURLFLAGS) -o $@ $(URLCACHE)https://unicode.org/Public/$(UNICODE_VERSION)/ucd/emoji/emoji-data.txt | ||
$(CURL) -o $@ $(URL_ROOT)/emoji/emoji-data.txt | ||
|
||
Uppercase.txt: DerivedCoreProperties.txt | ||
$(RUBY) -e 'puts File.read("DerivedCoreProperties.txt")[/# Derived Property: Uppercase.*?# Total code points:/m]' > $@ | ||
sed -En '/^# Derived Property: Uppercase/,/^# Total code points:/p' DerivedCoreProperties.txt > $@ | ||
|
||
Lowercase.txt: DerivedCoreProperties.txt | ||
$(RUBY) -e 'puts File.read("DerivedCoreProperties.txt")[/# Derived Property: Lowercase.*?# Total code points:/m]' > $@ | ||
sed -En '/^# Derived Property: Lowercase/,/^# Total code points:/p' DerivedCoreProperties.txt > $@ | ||
|
||
clean: | ||
rm -f UnicodeData.txt EastAsianWidth.txt GraphemeBreakProperty.txt DerivedCoreProperties.txt CompositionExclusions.txt CaseFolding.txt NormalizationTest.txt GraphemeBreakTest.txt CharWidths.txt emoji-data.txt | ||
rm -f Uppercase.txt Lowercase.txt | ||
rm -f UnicodeData.txt EastAsianWidth.txt GraphemeBreakProperty.txt DerivedCoreProperties.txt \ | ||
CompositionExclusions.txt CaseFolding.txt NormalizationTest.txt GraphemeBreakTest.txt \ | ||
emoji-data.txt Uppercase.txt Lowercase.txt | ||
rm -f utf8proc_data.c.new |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upgrading to Unicode 14 should happen in a separate PR.