lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | # Generate test locale files. |
| 3 | # Copyright (C) 2000-2015 Free Software Foundation, Inc. |
| 4 | # This file is part of the GNU C Library. |
| 5 | |
| 6 | # The GNU C Library is free software; you can redistribute it and/or |
| 7 | # modify it under the terms of the GNU Lesser General Public |
| 8 | # License as published by the Free Software Foundation; either |
| 9 | # version 2.1 of the License, or (at your option) any later version. |
| 10 | |
| 11 | # The GNU C Library is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | # Lesser General Public License for more details. |
| 15 | |
| 16 | # You should have received a copy of the GNU Lesser General Public |
| 17 | # License along with the GNU C Library; if not, see |
| 18 | # <http://www.gnu.org/licenses/>. |
| 19 | |
| 20 | set -e |
| 21 | |
| 22 | common_objpfx="$1"; shift |
| 23 | localedef_before_env="$1"; shift |
| 24 | run_program_env="$1"; shift |
| 25 | localedef_after_env="$1"; shift |
| 26 | locfile="$1"; shift |
| 27 | |
| 28 | generate_locale () |
| 29 | { |
| 30 | charmap=$1 |
| 31 | input=$2 |
| 32 | out=$3 |
| 33 | if ${localedef_before_env} ${run_program_env} I18NPATH=../localedata \ |
| 34 | ${localedef_after_env} --quiet -c -f $charmap -i $input \ |
| 35 | ${common_objpfx}localedata/$out |
| 36 | then |
| 37 | # The makefile checks the timestamp of the LC_CTYPE file, |
| 38 | # but localedef won't have touched it if it was able to |
| 39 | # hard-link it to an existing file. |
| 40 | touch ${common_objpfx}localedata/$out/LC_CTYPE |
| 41 | else |
| 42 | echo "Charmap: \"${charmap}\" Inputfile: \"${input}\"" \ |
| 43 | "Outputdir: \"${out}\" failed" |
| 44 | exit 1 |
| 45 | fi |
| 46 | } |
| 47 | |
| 48 | locfile=`echo $locfile|sed 's|.*/\([^/]*/LC_CTYPE\)|\1|'` |
| 49 | locale=`echo $locfile|sed 's|\([^.]*\)[.].*/LC_CTYPE|\1|'` |
| 50 | charmap=`echo $locfile|sed 's|[^.]*[.]\(.*\)/LC_CTYPE|\1|'` |
| 51 | |
| 52 | echo "Generating locale $locale.$charmap: this might take a while..." |
| 53 | generate_locale `echo $charmap | sed -e s/SJIS/SHIFT_JIS/` $locale \ |
| 54 | $locale.$charmap |