Blame localedata/gen-locale.sh

Packit 6c4009
#!/bin/sh
Packit 6c4009
# Generate test locale files.
Packit 6c4009
# Copyright (C) 2000-2018 Free Software Foundation, Inc.
Packit 6c4009
# This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
# The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
# modify it under the terms of the GNU Lesser General Public
Packit 6c4009
# License as published by the Free Software Foundation; either
Packit 6c4009
# version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
# The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
# Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
# You should have received a copy of the GNU Lesser General Public
Packit 6c4009
# License along with the GNU C Library; if not, see
Packit 6c4009
# <http://www.gnu.org/licenses/>.
Packit 6c4009
Packit 6c4009
set -e
Packit 6c4009
Packit 6c4009
common_objpfx="$1"; shift
Packit 6c4009
localedef_before_env="$1"; shift
Packit 6c4009
run_program_env="$1"; shift
Packit 6c4009
localedef_after_env="$1"; shift
Packit 6c4009
locfile="$1"; shift
Packit 6c4009
Packit 6c4009
generate_locale ()
Packit 6c4009
{
Packit 6c4009
  charmap=$1
Packit 6c4009
  input=$2
Packit 6c4009
  out=$3
Packit 6c4009
  flags=$4
Packit 6c4009
  ret=0
Packit 6c4009
  ${localedef_before_env} ${run_program_env} I18NPATH=../localedata \
Packit 6c4009
	${localedef_after_env} $flags -f $charmap -i $input \
Packit 6c4009
	${common_objpfx}localedata/$out || ret=$?
Packit 6c4009
  if [ $ret -eq 0 ]; then
Packit 6c4009
    # The makefile checks the timestamp of the LC_CTYPE file,
Packit 6c4009
    # but localedef won't have touched it if it was able to
Packit 6c4009
    # hard-link it to an existing file.
Packit 6c4009
    touch ${common_objpfx}localedata/$out/LC_CTYPE
Packit 6c4009
  else
Packit 6c4009
    echo "Charmap: \"${charmap}\" Inputfile: \"${input}\"" \
Packit 6c4009
	 "Outputdir: \"${out}\" failed"
Packit 6c4009
    exit 1
Packit 6c4009
  fi
Packit 6c4009
}
Packit 6c4009
Packit 6c4009
locfile=`echo $locfile|sed 's|.*/\([^/]*/LC_CTYPE\)|\1|'`
Packit 6c4009
locale=`echo $locfile|sed 's|\([^.]*\)[.].*/LC_CTYPE|\1|'`
Packit 6c4009
charmap=`echo $locfile|sed 's|[^.]*[.]\([^@ ]*\)\(@[^ ]*\)\?/LC_CTYPE|\1|'`
Packit 6c4009
modifier=`echo $locfile|sed 's|[^.]*[.]\([^@ ]*\)\(@[^ ]*\)\?/LC_CTYPE|\2|'`
Packit 6c4009
Packit 6c4009
echo "Generating locale $locale.$charmap: this might take a while..."
Packit 6c4009
Packit 6c4009
# Run quietly and force output.
Packit 6c4009
flags="--quiet -c"
Packit 6c4009
Packit 6c4009
# For SJIS the charmap is SHIFT_JIS. We just want the locale to have
Packit 6c4009
# a slightly nicer name instead of using "*.SHIFT_SJIS", but that
Packit 6c4009
# means we need a mapping here.
Packit 6c4009
charmap_real="$charmap"
Packit 6c4009
if [ "$charmap" = "SJIS" ]; then
Packit 6c4009
  charmap_real="SHIFT_JIS"
Packit 6c4009
fi
Packit 6c4009
Packit 6c4009
# In addition to this the SHIFT_JIS character maps are not ASCII
Packit 6c4009
# compatible so we must use `--no-warnings=ascii' to disable the
Packit 6c4009
# warning. See localedata/Makefile $(INSTALL-SUPPORTED-LOCALES)
Packit 6c4009
# for the same logic.
Packit 6c4009
if [ "$charmap_real" = 'SHIFT_JIS' ] \
Packit 6c4009
   || [ "$charmap_real" = 'SHIFT_JISX0213' ]; then
Packit 6c4009
  flags="$flags --no-warnings=ascii"
Packit 6c4009
fi
Packit 6c4009
Packit 6c4009
generate_locale $charmap_real $locale$modifier $locale.$charmap$modifier "$flags"