blob: aa90865befa428e0b0972197bc0e79d008fd7053 [file] [log] [blame]
Torsten Bögershausen9c943892014-05-09 23:51:44 +02001#!/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#
Beat Bollif3eb5492016-12-14 00:31:39 +01008cd "$(dirname "$0")"
Stefan Bellere233bef2018-04-10 14:26:17 -07009UNICODEWIDTH_H=$(git rev-parse --show-toplevel)/unicode-width.h
Beat Bollib79e28e2016-12-14 00:31:40 +010010
Beat Bollifef54f32016-12-14 00:31:42 +010011wget -N http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt \
12 http://www.unicode.org/Public/UCD/latest/ucd/EastAsianWidth.txt &&
Beat Bollib79e28e2016-12-14 00:31:40 +010013if ! test -d uniset; then
Beat Bolli3f0a3862016-12-14 00:31:41 +010014 git clone https://github.com/depp/uniset.git &&
15 ( cd uniset && git checkout 4b186196dd )
Beat Bollib79e28e2016-12-14 00:31:40 +010016fi &&
Beat Bollif3eb5492016-12-14 00:31:39 +010017(
Beat Bollib79e28e2016-12-14 00:31:40 +010018 cd uniset &&
19 if ! test -x uniset; then
20 autoreconf -i &&
21 ./configure --enable-warnings=-Werror CFLAGS='-O0 -ggdb'
Torsten Bögershausen9c943892014-05-09 23:51:44 +020022 fi &&
Beat Bollib79e28e2016-12-14 00:31:40 +010023 make
24) &&
25UNICODE_DIR=. && export UNICODE_DIR &&
26cat >$UNICODEWIDTH_H <<-EOF
27static const struct interval zero_width[] = {
Beat Bolli3fe57992016-12-14 00:31:43 +010028 $(uniset/uniset --32 cat:Me,Mn,Cf + U+1160..U+11FF - U+00AD)
Beat Bollib79e28e2016-12-14 00:31:40 +010029};
30static const struct interval double_width[] = {
31 $(uniset/uniset --32 eaw:F,W)
32};
33EOF