Merge branch 'jc/epochtime-wo-tz'
[git] / update_unicode.sh
1 #!/bin/sh
2 #See http://www.unicode.org/reports/tr44/
3 #
4 #Me Enclosing_Mark  an enclosing combining mark
5 #Mn Nonspacing_Mark a nonspacing combining mark (zero advance width)
6 #Cf Format          a format control character
7 #
8 UNICODEWIDTH_H=../unicode_width.h
9 if ! test -d unicode; then
10         mkdir unicode
11 fi &&
12 ( cd unicode &&
13         if ! test -f UnicodeData.txt; then
14                 wget http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt
15         fi &&
16         if ! test -f EastAsianWidth.txt; then
17                 wget http://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt
18         fi &&
19         if ! test -d uniset; then
20                 git clone https://github.com/depp/uniset.git
21         fi &&
22         (
23                 cd uniset &&
24                 if ! test -x uniset; then
25                         autoreconf -i &&
26                         ./configure --enable-warnings=-Werror CFLAGS='-O0 -ggdb'
27                 fi &&
28                 make
29         ) &&
30         UNICODE_DIR=. && export UNICODE_DIR &&
31         cat >$UNICODEWIDTH_H <<-EOF
32         static const struct interval zero_width[] = {
33                 $(uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD |
34                   grep -v plane)
35         };
36         static const struct interval double_width[] = {
37                 $(uniset/uniset --32 eaw:F,W)
38         };
39         EOF
40 )