3 # This is a helper script for the Makefile in the parent directory.
4 # When the localization definitions are generated in the draft area,
5 # this script will copy base ones that others symlink to, and rearrange
6 # the generate makefile to pull the LOCALES first.
11 echo "finalize <type>' to package standard localization"
12 echo "type must be one of { monetdef, msgdef, numericdef, timedef, colldef, ctypedef }"
17 [ $1 = "monetdef" -o $1 = "msgdef" -o $1 = "colldef" -o \
18 $1 = "numericdef" -o $1 = "timedef" -o $1 = "ctypedef" ] || usage
21 base=$(dirname ${self})
22 old=${base}/../${1}.draft
24 TEMP=/tmp/${1}.locales
25 TEMP2=/tmp/${1}.hashes
27 FULLEXTRACT=/tmp/extracted-names
28 AWKCMD="/## PLACEHOLDER/ { \
29 while ( getline line < \"${TEMP}\" ) {print line} } \
30 !/## PLACEHOLDER/ { print \$0 }"
32 grep '^LOCALES+' ${old}/Makefile > ${TEMP}
34 if [ $1 = "ctypedef" ]
36 keep=$(cat ${TEMP} | awk '{ print $2 ".src" }')
37 (cd ${old} && md5 -r ${keep} | sort) > ${TEMP2}
38 keep=$(awk '{ if ($1 != last1) print $2; last1 = $1; }' ${TEMP2})
39 for original in ${keep}
41 cp ${old}/${original} ${new}/
43 linx=$(awk '{ if ($1 == last1) { print "ln -s " last2 " ${new}/" $2 ";"} \
44 else {last1 = $1; last2 = $2}}' ${TEMP2})
47 /usr/bin/sed -E -e 's/[ ]+/ /g' \
48 ${CLDRDIR}/posix/UTF-8.cm \
49 > ${base}/../etc/final-maps/map.UTF-8
50 CHARMAPS="ARMSCII-8 Big5 Big5HKSCS CP1131 CP1251 \
51 CP866 GB2312 GBK ISCII-DEV ISO8859-1 \
52 ISO8859-13 ISO8859-15 ISO8859-2 ISO8859-4 \
53 ISO8859-5 ISO8859-7 ISO8859-9 KOI8-R KOI8-U \
54 PT154 SJIS US-ASCII eucCN eucJP eucKR"
56 # GB18030 blows up, use pre-generate Illumos version
58 for map in ${CHARMAPS}
61 if [ ${map} = "Big5HKSCS" ]
65 /usr/local/bin/perl ${base}/convert_map.pl \
66 ${base}/../etc/charmaps/${map}.TXT ${encoding} \
67 | /usr/bin/sed -E -e 's/ +/ /g' \
68 > ${base}/../etc/final-maps/map.${map}
69 echo map ${map} converted.
72 else # below is everything but ctypedef
74 keep=$(cat ${TEMP} | awk '{ print $2 }')
75 for original in ${keep}
77 cp ${old}/${original}.src ${new}/
82 grep -v '^LOCALES+' ${old}/Makefile | awk "${AWKCMD}" > ${new}/Makefile