1#!/bin/bash
2# Copyright (c) 2022 Huawei Device Co., Ltd.
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14set -e
15script_path=$(cd $(dirname $0);pwd)
16iana_path="${script_path}/../../data/iana"
17posix_path="${iana_path}/../prebuild/posix"
18zic_path="${iana_path}/../prebuild/tool/linux"
19
20make -C ${iana_path}
21mv ${iana_path}/zic ${zic_path}
22
23state_name=('africa' 'antarctica' 'asia' 'australasia' 'europe' 'etcetera' 'northamerica' 'southamerica' 'backward')
24for name in ${state_name[@]}
25do
26    ${zic_path}/zic -d ${iana_path}/zoneinfo ${iana_path}/$name
27done
28
29rm -rf ${posix_path}/*
30mv ${iana_path}/zoneinfo/* ${posix_path}
31mv ${iana_path}/version.txt ${posix_path}
32echo 'done'
33exit 0