public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] fix/enhance Unicode table generation scripts
@ 2018-03-14  9:46 Corinna Vinschen
  0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2018-03-14  9:46 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=44d90834fb08c2e9326b68cb7ed159bfd4839b36

commit 44d90834fb08c2e9326b68cb7ed159bfd4839b36
Author: Thomas Wolff <mintty@users.noreply.github.com>
Date:   Tue Mar 13 18:26:19 2018 +0100

    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.

Diff:
---
 newlib/libc/ctype/mkunidata  | 34 ++++++++++++++++++++++++++--------
 newlib/libc/string/mkunidata | 37 +++++++++++++++++++++++++++----------
 2 files changed, 53 insertions(+), 18 deletions(-)

diff --git a/newlib/libc/ctype/mkunidata b/newlib/libc/ctype/mkunidata
index ea18e67..4bdf3bc 100755
--- a/newlib/libc/ctype/mkunidata
+++ b/newlib/libc/ctype/mkunidata
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-echo generating Unicode character properties data for newlib/libc/ctype
+echo Generating Unicode character properties data for newlib/libc/ctype
 
 cd `dirname $0`
 
@@ -8,23 +8,41 @@ 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=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 data from unicode.org
 	for data in UnicodeData.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
+	do	cp /usr/share/unicode/ucd/$data .
+	done
 	;;
 esac
 
+echo checking Unicode data file
 for data in UnicodeData.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
 
 #############################################################################
diff --git a/newlib/libc/string/mkunidata b/newlib/libc/string/mkunidata
index c0bf5de..7ebebeb 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-14  9:46 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14  9:46 [newlib-cygwin] fix/enhance Unicode table generation scripts Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).