• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3# Copyright (C) 2013 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#      http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17
18# Stop if anything goes wrong, and show what we're doing. (This script is slow.)
19set -e
20set -x
21
22# TODO: extract this from the .dat file's name.
23ICU_VERSION=50
24
25ICU_BIN=$ANDROID_BUILD_TOP/prebuilts/misc/linux-x86_64/icu-$ICU_VERSION
26ICU4C_DIR=$ANDROID_BUILD_TOP/external/icu4c
27
28# Make a temporary directory.
29rm -rf $ICU4C_DIR/tmp
30mkdir $ICU4C_DIR/tmp
31
32# TODO: expand this to more than just the curr and region files.
33data_kinds="curr region"
34
35for data_kind in $data_kinds ; do
36  mkdir $ICU4C_DIR/tmp/$data_kind
37
38  # Compile the .txt files to .res files.
39  cd $ICU4C_DIR/data/$data_kind
40  for locale in *.txt ; do
41    $ICU_BIN/genrb -d $ICU4C_DIR/tmp/$data_kind ../../data/$data_kind/$locale
42  done
43done
44
45# Create a copy of the .dat file that uses the new .res files.
46cp $ICU4C_DIR/stubdata/icudt${ICU_VERSION}l-all.dat $ICU4C_DIR/tmp/icudt${ICU_VERSION}l.dat
47cd $ICU4C_DIR/tmp
48for data_kind in $data_kinds ; do
49  for res in $data_kind/*.res ; do
50    $ICU_BIN/icupkg -a $res icudt${ICU_VERSION}l.dat
51  done
52done
53
54# Make the modified .dat file the canonical copy.
55mv $ICU4C_DIR/tmp/icudt${ICU_VERSION}l.dat $ICU4C_DIR/stubdata/icudt${ICU_VERSION}l-all.dat
56