libc/newlib/libc/ctype/mkunidata
Thomas Wolff 44d90834fb 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.
2018-03-14 10:44:32 +01:00

59 lines
1.4 KiB
Bash
Executable file

#! /bin/sh
echo Generating Unicode character properties data for newlib/libc/ctype
cd `dirname $0`
#############################################################################
# checks and (with option -u) download
case "$1" in
-h) echo "Usage: $0 [-h|-u|-i]"
echo "Generate case conversion table caseconv.t and character category table categories.t"
echo "from local Unicode file UnicodeData.txt."
echo ""
echo "Options:"
echo " -u download file from unicode.org first"
echo " -i copy file from /usr/share/unicode/ucd first"
echo " -h show this"
exit
;;
-u)
wget () {
curl -R -O --connect-timeout 55 -z "`basename $1`" "$1"
}
echo downloading data from unicode.org
for data in UnicodeData.txt
do wget http://unicode.org/Public/UNIDATA/$data
done
;;
-i)
echo copying data from /usr/share/unicode/ucd
for data in UnicodeData.txt
do cp /usr/share/unicode/ucd/$data .
done
;;
esac
echo checking Unicode data file
for data in UnicodeData.txt
do if [ -r $data ]
then true
else echo $data not available, skipping table generation
exit
fi
done
#############################################################################
# table generation
echo generating character category table for "isw*.c"
sh ./mkcategories
echo generating case conversion table for "tow*.c"
sh ./mkcaseconv
#############################################################################
# end