Changeset View
Changeset View
Standalone View
Standalone View
head/tools/tools/locale/tools/finalize
Show First 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | usage () | ||||
exit 1 | exit 1 | ||||
} | } | ||||
[ $# -ne 1 ] && usage | [ $# -ne 1 ] && usage | ||||
[ $1 = "monetdef" -o $1 = "msgdef" -o $1 = "colldef" -o \ | [ $1 = "monetdef" -o $1 = "msgdef" -o $1 = "colldef" -o \ | ||||
$1 = "numericdef" -o $1 = "timedef" -o $1 = "ctypedef" ] || usage | $1 = "numericdef" -o $1 = "timedef" -o $1 = "ctypedef" ] || usage | ||||
self=$(realpath $0) | self=$(realpath $0) | ||||
base=$(dirname ${self}) | base=${BASEDIR:-$(dirname ${self})} | ||||
old=${base}/../${1}.draft | : ${ETCDIR:=${base}/../etc} | ||||
new=${base}/../${1} | : ${TOOLSDIR:=${base}} | ||||
TEMP=/tmp/${1}.locales | : ${OUTBASEDIR:=${base}/../${1}} | ||||
TEMP2=/tmp/${1}.hashes | : ${OLD_DIR:=${OUTBASEDIR}.draft} | ||||
TEMP3=/tmp/${1}.symlinks | : ${NEW_DIR:=${OUTBASEDIR}} | ||||
TEMP4=/tmp/${1}.mapped | old=${OLD_DIR} | ||||
FULLMAP=/tmp/utf8-map | new=${NEW_DIR} | ||||
FULLEXTRACT=/tmp/extracted-names | : ${TMPDIR:=/tmp} | ||||
TEMP=${TMPDIR}/${1}.locales | |||||
TEMP2=${TMPDIR}/${1}.hashes | |||||
TEMP3=${TMPDIR}/${1}.symlinks | |||||
TEMP4=${TMPDIR}/${1}.mapped | |||||
FULLMAP=${TMPDIR}/utf8-map | |||||
FULLEXTRACT=${TMPDIR}/extracted-names | |||||
AWKCMD="/## PLACEHOLDER/ { \ | AWKCMD="/## PLACEHOLDER/ { \ | ||||
while ( getline line < \"${TEMP}\" ) {print line} } \ | while ( getline line < \"${TEMP}\" ) {print line} } \ | ||||
/## SYMPAIRS/ { \ | /## SYMPAIRS/ { \ | ||||
while ( getline line < \"${TEMP3}\" ) {print line} } \ | while ( getline line < \"${TEMP3}\" ) {print line} } \ | ||||
/## LOCALES_MAPPED/ { \ | /## LOCALES_MAPPED/ { \ | ||||
while ( getline line < \"${TEMP4}\" ) {print line} } \ | while ( getline line < \"${TEMP4}\" ) {print line} } \ | ||||
!/## / { print \$0 }" | !/## / { print \$0 }" | ||||
# Rename the sources with 3 components name into the POSIX version of the name using @modifier | # Rename the sources with 3 components name into the POSIX version of the name using @modifier | ||||
mkdir -p $old $new | |||||
cd $old | cd $old | ||||
pwd | pwd | ||||
for i in *_*_*.*.src; do | for i in *_*_*.*.src; do | ||||
if [ "$i" = "*_*_*.*.src" ]; then | if [ "$i" = "*_*_*.*.src" ]; then | ||||
break | break | ||||
fi | fi | ||||
oldname=${i%.*} | oldname=${i%.*} | ||||
nname=`echo $oldname | awk '{ split($0, a, "_"); print a[1]"_"a[3]"@"a[2];} '` | nname=`echo $oldname | awk '{ split($0, a, "_"); print a[1]"_"a[3]"@"a[2];} '` | ||||
▲ Show 20 Lines • Show All 61 Lines • ▼ Show 20 Lines | then | ||||
do | do | ||||
cp ${old}/${original} ${new}/ | cp ${old}/${original} ${new}/ | ||||
done | done | ||||
awk '{ if ($1 == last1) { print "SYMPAIRS+=\t" last2 " " $2 } \ | awk '{ if ($1 == last1) { print "SYMPAIRS+=\t" last2 " " $2 } \ | ||||
else {last1 = $1; last2 = $2}}' ${TEMP2} > ${TEMP3} | else {last1 = $1; last2 = $2}}' ${TEMP2} > ${TEMP3} | ||||
rm -f ${TEMP2} | rm -f ${TEMP2} | ||||
/usr/bin/sed -E -e 's/[ ]+/ /g' \ | /usr/bin/sed -E -e 's/[ ]+/ /g' \ | ||||
${UNIDIR}/posix/UTF-8.cm \ | ${UNIDIR}/posix/UTF-8.cm \ | ||||
> ${base}/../etc/final-maps/map.UTF-8 | > ${ETCDIR}/final-maps/map.UTF-8 | ||||
/usr/bin/sed -E -e 's/[ ]+/ /g' \ | /usr/bin/sed -E -e 's/[ ]+/ /g' \ | ||||
${UNIDIR}/posix/eucCN.cm \ | ${UNIDIR}/posix/eucCN.cm \ | ||||
> ${base}/../etc/final-maps/map.eucCN | > ${ETCDIR}/final-maps/map.eucCN | ||||
/usr/bin/sed -E -e 's/[ ]+/ /g' \ | /usr/bin/sed -E -e 's/[ ]+/ /g' \ | ||||
${UNIDIR}/posix/eucCN.cm \ | ${UNIDIR}/posix/eucCN.cm \ | ||||
> ${base}/../etc/final-maps/map.GB2312 | > ${ETCDIR}/final-maps/map.GB2312 | ||||
# GB18030 and Big5 are pre-generated from CLDR data | # GB18030 and Big5 are pre-generated from CLDR data | ||||
CHARMAPS="ARMSCII-8 CP1131 CP1251 \ | CHARMAPS="ARMSCII-8 CP1131 CP1251 \ | ||||
CP866 GBK ISCII-DEV ISO8859-1 \ | CP866 GBK ISCII-DEV ISO8859-1 \ | ||||
ISO8859-13 ISO8859-15 ISO8859-2 ISO8859-4 \ | ISO8859-13 ISO8859-15 ISO8859-2 ISO8859-4 \ | ||||
ISO8859-5 ISO8859-7 ISO8859-9 KOI8-R KOI8-U \ | ISO8859-5 ISO8859-7 ISO8859-9 KOI8-R KOI8-U \ | ||||
PT154 SJIS US-ASCII eucJP eucKR" | PT154 SJIS US-ASCII eucJP eucKR" | ||||
for map in ${CHARMAPS} | for map in ${CHARMAPS} | ||||
do | do | ||||
encoding=${map} | encoding=${map} | ||||
/usr/local/bin/perl ${base}/convert_map.pl \ | env ETCDIR="${ETCDIR}" \ | ||||
${base}/../etc/charmaps/${map}.TXT ${encoding} \ | /usr/local/bin/perl ${TOOLSDIR}/convert_map.pl \ | ||||
${ETCDIR}/charmaps/${map}.TXT ${encoding} \ | |||||
| /usr/bin/sed -E -e 's/ +/ /g' \ | | /usr/bin/sed -E -e 's/ +/ /g' \ | ||||
> ${base}/../etc/final-maps/map.${map} | > ${ETCDIR}/final-maps/map.${map} | ||||
echo map ${map} converted. | echo map ${map} converted. | ||||
done | done | ||||
elif [ $1 = "colldef" ] | elif [ $1 = "colldef" ] | ||||
then | then | ||||
awk -v tmp4=${TEMP4} '$1 == "SAME+=" && $0 !~ /legacy/ { | awk -v tmp4=${TEMP4} '$1 == "SAME+=" && $0 !~ /legacy/ { | ||||
orig=$2 | orig=$2 | ||||
dest=$3 | dest=$3 | ||||
Show All 33 Lines |