diff options
author | Thomas Wolff <mintty@users.noreply.github.com> | 2018-03-13 20:26:19 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2018-03-14 12:44:32 +0300 |
commit | 44d90834fb08c2e9326b68cb7ed159bfd4839b36 (patch) | |
tree | 11b6a8b6b661cb6f6697a0d4110e9cff640231c1 /newlib/libc/string | |
parent | e98d3eb3eb9b6abd897e102031a14b7057641a65 (diff) |
fix/enhance Unicode table generation scripts
Scripts do not try to acquire Unicode data by best-effort magic anymore.
Options supported:
-h for help
-i to copy Unicode data from /usr/share/unicode/ucd first
-u to download Unicode data from unicode.org first
If (despite of -i or -u if given) the necessary Unicode files are not
available locally, table generation is skipped, but no error code is
returned, so not to obstruct the build process if called from a Makefile.
Diffstat (limited to 'newlib/libc/string')
-rwxr-xr-x | newlib/libc/string/mkunidata | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/newlib/libc/string/mkunidata b/newlib/libc/string/mkunidata index c0bf5de6c..7ebebeb07 100755 --- a/newlib/libc/string/mkunidata +++ b/newlib/libc/string/mkunidata @@ -1,6 +1,6 @@ #! /bin/sh -echo generating Unicode width data for newlib/libc/string/wcwidth.c +echo Generating Unicode width data for newlib/libc/string/wcwidth.c cd `dirname $0` PATH="$PATH":. # ensure access to uniset tool @@ -9,34 +9,51 @@ PATH="$PATH":. # ensure access to uniset tool # checks and (with option -u) downloads case "$1" in +-h) echo "Usage: $0 [-h|-u|-i]" + echo "Generate width data tables ambiguous.t, combining.t, wide.t" + echo "from local Unicode files UnicodeData.txt, Blocks.txt, EastAsianWidth.txt." + echo "" + echo "Options:" + echo " -u download files from unicode.org first, download uniset tool" + echo " -i copy files from /usr/share/unicode/ucd first" + echo " -h show this" + exit + ;; -u) - #WGET=wget -N -t 1 --timeout=55 - WGET=curl -R -O --connect-timeout 55 - WGET+=-z $@ + wget () { + curl -R -O --connect-timeout 55 -z "`basename $1`" "$1" + } echo downloading uniset tool - $WGET http://www.cl.cam.ac.uk/~mgk25/download/uniset.tar.gz + wget http://www.cl.cam.ac.uk/~mgk25/download/uniset.tar.gz gzip -dc uniset.tar.gz | tar xvf - uniset echo downloading data from unicode.org for data in UnicodeData.txt Blocks.txt EastAsianWidth.txt - do $WGET http://unicode.org/Public/UNIDATA/$data + do wget http://unicode.org/Public/UNIDATA/$data done ;; -*) echo checking package unicode-ucd - grep unicode-ucd /etc/setup/installed.db || exit 9 +-i) + echo copying data from /usr/share/unicode/ucd + for data in UnicodeData.txt Blocks.txt EastAsianWidth.txt + do cp /usr/share/unicode/ucd/$data . + done ;; esac echo checking uniset tool type uniset || exit 9 +echo checking Unicode data files for data in UnicodeData.txt Blocks.txt EastAsianWidth.txt -do test -r $data || ln -s /usr/share/unicode/ucd/$data . || exit 9 +do if [ -r $data ] + then true + else echo $data not available, skipping table generation + exit + fi done echo generating from Unicode version `sed -e 's,[^.0-9],,g' -e 1q Blocks.txt` -exit ############################################################################# # table generation |