diff options
author | ngie <ngie@FreeBSD.org> | 2015-12-19 19:57:28 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2015-12-19 19:57:28 +0000 |
commit | f8c5cd12c37a92500da3f42f1d25bae9cc70e30a (patch) | |
tree | ea8f2cb9e0c06c3875296365ec64f45267a791eb /tools | |
parent | 490921132f201193a73d81699cb455aa2ae87357 (diff) | |
parent | 69774947bfffd5e16d26b60a82d880aa659abbf2 (diff) | |
download | FreeBSD-src-f8c5cd12c37a92500da3f42f1d25bae9cc70e30a.zip FreeBSD-src-f8c5cd12c37a92500da3f42f1d25bae9cc70e30a.tar.gz |
MFhead @ r292474
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/tools/locale/tools/cldr2def.pl | 22 | ||||
-rwxr-xr-x | tools/tools/locale/tools/finalize | 76 |
2 files changed, 50 insertions, 48 deletions
diff --git a/tools/tools/locale/tools/cldr2def.pl b/tools/tools/locale/tools/cldr2def.pl index 3b8169f..d26cb2e 100755 --- a/tools/tools/locale/tools/cldr2def.pl +++ b/tools/tools/locale/tools/cldr2def.pl @@ -796,7 +796,7 @@ sub make_makefile { print "Creating Makefile for $TYPE\n"; my $SRCOUT; my $SRCOUT2; - my $SRCOUT3; + my $SRCOUT3 = ""; my $MAPLOC; if ($TYPE eq "colldef") { $SRCOUT = "localedef -D -U -i \${.IMPSRC} \\\n" . @@ -808,16 +808,16 @@ sub make_makefile { } elsif ($TYPE eq "ctypedef") { $SRCOUT = "localedef -D -U -c -w \${MAPLOC}/widths.txt \\\n" . - "\t-f \${MAPLOC}/map.\${.IMPSRC:T:R:C/^.*\\.//} " . + "\t-f \${MAPLOC}/map.\${.IMPSRC:T:R:E} " . "\\\n\t-i \${.IMPSRC} \${.OBJDIR}/\${.IMPSRC:T:R} " . " || true"; $SRCOUT2 = "LC_CTYPE"; $MAPLOC = "MAPLOC=\t\t\${.CURDIR}/../../tools/tools/" . "locale/etc/final-maps\n"; $SRCOUT3 = "## SYMPAIRS\n\n" . - ".for PAIR in \${SYMPAIRS}\n" . - "\${PAIR:C/^.*://:S/src\$/LC_CTYPE/}: " . - "\${PAIR:C/:.*//}\n" . + ".for s t in \${SYMPAIRS}\n" . + "\${t:S/src\$/LC_CTYPE/}: " . + "\$s\n" . "\tlocaledef -D -U -c -w \${MAPLOC}/widths.txt \\\n" . "\t-f \${MAPLOC}/map.\${.TARGET:T:R:C/^.*\\.//} " . "\\\n\t-i \${.ALLSRC} \${.OBJDIR}/\${.TARGET:T:R} " . @@ -891,7 +891,7 @@ EOF my @a = split(/_/, $file); my @b = split(/\./, $a[-1]); $file =~ s/_x_/_/; - print FOUT "SAME+=\t\t$link:$file\n"; + print FOUT "SAME+=\t\t$link $file\n"; undef($languages{$a[0]}{$a[1]}{data}{$b[0]}{$b[1]}); } } @@ -923,7 +923,7 @@ EOF my $file = $l . "_"; $file .= $f . "_" if ($f ne "x"); $file .= $c; - print FOUT "SAME+=\t\t$file.$e:$languages{$l}{$f}{nc_link}.$e\t# legacy (lang/country change)\n"; + print FOUT "SAME+=\t\t$file.$e $languages{$l}{$f}{nc_link}.$e\t# legacy (lang/country change)\n"; } } @@ -933,7 +933,7 @@ EOF my $file = $l . "_"; $file .= $f . "_" if ($f ne "x"); $file .= $c; - print FOUT "SAME+=\t\t$file.$a[0]:$file.$a[1]\t# legacy (same charset)\n"; + print FOUT "SAME+=\t\t$file.$a[0] $file.$a[1]\t# legacy (same charset)\n"; } } @@ -946,9 +946,9 @@ EOF FILES= \${LOCALES:S/\$/.${SRCOUT2}/} CLEANFILES= \${FILES} -.for f in \${SAME} -SYMLINKS+= ../\${f:C/:.*\$//}/\${FILESNAME} \\ - \${LOCALEDIR}/\${f:C/^.*://}/\${FILESNAME} +.for f t in \${SAME} +SYMLINKS+= ../\$f/\${FILESNAME} \\ + \${LOCALEDIR}/\$t/\${FILESNAME} .endfor .for f in \${LOCALES} diff --git a/tools/tools/locale/tools/finalize b/tools/tools/locale/tools/finalize index f8c0ce9..7ce3e74 100755 --- a/tools/tools/locale/tools/finalize +++ b/tools/tools/locale/tools/finalize @@ -1,5 +1,7 @@ #!/bin/sh # +# $FreeBSD$ +# # This is a helper script for the Makefile in the parent directory. # When the localization definitions are generated in the draft area, # this script will copy base ones that others symlink to, and rearrange @@ -8,9 +10,9 @@ usage () { - echo "finalize <type>' to package standard localization" - echo "type must be one of { monetdef, msgdef, numericdef, timedef, colldef, ctypedef }" - exit 1 + echo "finalize <type>' to package standard localization" + echo "type must be one of { monetdef, msgdef, numericdef, timedef, colldef, ctypedef }" + exit 1 } [ $# -ne 1 ] && usage @@ -36,48 +38,48 @@ grep '^LOCALES+' ${old}/Makefile > ${TEMP} if [ $1 = "ctypedef" ] then -keep=$(cat ${TEMP} | awk '{ print $2 ".src" }') -(cd ${old} && md5 -r ${keep} | sort) > ${TEMP2} -keep=$(awk '{ if ($1 != last1) print $2; last1 = $1; }' ${TEMP2}) -for original in ${keep} -do - cp ${old}/${original} ${new}/ -done -awk '{ if ($1 == last1) { print "SYMPAIRS+=\t" last2 ":" $2 } \ -else {last1 = $1; last2 = $2}}' ${TEMP2} > ${TEMP3} -rm -f ${TEMP2} + keep=$(cat ${TEMP} | awk '{ print $2 ".src" }') + (cd ${old} && md5 -r ${keep} | sort) > ${TEMP2} + keep=$(awk '{ if ($1 != last1) print $2; last1 = $1; }' ${TEMP2}) + for original in ${keep} + do + cp ${old}/${original} ${new}/ + done + awk '{ if ($1 == last1) { print "SYMPAIRS+=\t" last2 " " $2 } \ + else {last1 = $1; last2 = $2}}' ${TEMP2} > ${TEMP3} + rm -f ${TEMP2} /usr/bin/sed -E -e 's/[ ]+/ /g' \ ${CLDRDIR}/posix/UTF-8.cm \ > ${base}/../etc/final-maps/map.UTF-8 -CHARMAPS="ARMSCII-8 Big5 Big5HKSCS CP1131 CP1251 \ - CP866 GB2312 GBK ISCII-DEV ISO8859-1 \ - ISO8859-13 ISO8859-15 ISO8859-2 ISO8859-4 \ - ISO8859-5 ISO8859-7 ISO8859-9 KOI8-R KOI8-U \ - PT154 SJIS US-ASCII eucCN eucJP eucKR" + CHARMAPS="ARMSCII-8 Big5 Big5HKSCS CP1131 CP1251 \ + CP866 GB2312 GBK ISCII-DEV ISO8859-1 \ + ISO8859-13 ISO8859-15 ISO8859-2 ISO8859-4 \ + ISO8859-5 ISO8859-7 ISO8859-9 KOI8-R KOI8-U \ + PT154 SJIS US-ASCII eucCN eucJP eucKR" -# GB18030 blows up, use pre-generate Illumos version + # GB18030 blows up, use pre-generate Illumos version -for map in ${CHARMAPS} -do -encoding=${map} -if [ ${map} = "Big5HKSCS" ] -then -encoding="Big5" -fi -/usr/local/bin/perl ${base}/convert_map.pl \ - ${base}/../etc/charmaps/${map}.TXT ${encoding} \ - | /usr/bin/sed -E -e 's/ +/ /g' \ - > ${base}/../etc/final-maps/map.${map} - echo map ${map} converted. -done + for map in ${CHARMAPS} + do + encoding=${map} + if [ ${map} = "Big5HKSCS" ] + then + encoding="Big5" + fi + /usr/local/bin/perl ${base}/convert_map.pl \ + ${base}/../etc/charmaps/${map}.TXT ${encoding} \ + | /usr/bin/sed -E -e 's/ +/ /g' \ + > ${base}/../etc/final-maps/map.${map} + echo map ${map} converted. + done else # below is everything but ctypedef -keep=$(cat ${TEMP} | awk '{ print $2 }') -for original in ${keep} -do - cp ${old}/${original}.src ${new}/ -done + keep=$(cat ${TEMP} | awk '{ print $2 }') + for original in ${keep} + do + cp ${old}/${original}.src ${new}/ + done fi |