• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3# © 2021 and later: Unicode, Inc. and others.
4# License & terms of use: http://www.unicode.org/copyright.html
5
6# This script runs Bazel to create (generate) header files and binary data files
7# with Unicode character/script/collation data that are
8# needed for bootstrapping the ICU4C build to integrate the data.
9
10# Required environment variables:
11#   - ICU_SRC - the root directory of ICU source. This directory contains the
12#               `icu4c` directory.
13
14ICU4C_COMMON=$ICU_SRC/icu4c/source/common
15ICU4C_DATA_IN=$ICU_SRC/icu4c/source/data/in
16ICU4C_NORM2=$ICU_SRC/icu4c/source/data/unidata/norm2
17
18# Delete the files from the source tree that we need to generate,
19# to make extra sure that we do not depend on their old versions for generating new ones.
20# We cannot just delete *_data.h because ucol_data.h is not a generated header file.
21rm $ICU_SRC/icu4c/source/common/norm2_nfc_data.h
22rm $ICU_SRC/icu4c/source/common/propname_data.h
23rm $ICU_SRC/icu4c/source/common/*_props_data.h
24rm $ICU4C_DATA_IN/*.icu
25rm $ICU4C_DATA_IN/*.nrm
26rm $ICU4C_DATA_IN/coll/*.icu
27# icu4c/source/i18n/collationfcd.cpp is generated by genuca;
28# probably hard to build genuca without depending on the old version.
29
30# Exit this shell script when a command fails.
31set -e
32
33# Generate normalization data files directly into the source tree.
34bazelisk run //icu4c/source/tools/gennorm2 -- -o $ICU4C_COMMON/norm2_nfc_data.h -s $ICU4C_NORM2 nfc.txt --csource
35bazelisk run //icu4c/source/tools/gennorm2 -- -o $ICU4C_DATA_IN/nfc.nrm         -s $ICU4C_NORM2 nfc.txt
36bazelisk run //icu4c/source/tools/gennorm2 -- -o $ICU4C_DATA_IN/nfkc.nrm        -s $ICU4C_NORM2 nfc.txt nfkc.txt
37bazelisk run //icu4c/source/tools/gennorm2 -- -o $ICU4C_DATA_IN/nfkc_cf.nrm     -s $ICU4C_NORM2 nfc.txt nfkc.txt nfkc_cf.txt
38bazelisk run //icu4c/source/tools/gennorm2 -- -o $ICU4C_DATA_IN/uts46.nrm       -s $ICU4C_NORM2 nfc.txt uts46.txt
39
40# genprops writes several files directly into the source tree.
41bazelisk run //tools/unicode/c/genprops $ICU_SRC/icu4c
42
43# genuca also writes several files directly into the source tree.
44# We run it twice for different versions of the CLDR root sort order.
45bazelisk run //tools/unicode/c/genuca -- --hanOrder implicit $ICU_SRC/icu4c
46bazelisk run //tools/unicode/c/genuca -- --hanOrder radical-stroke $ICU_SRC/icu4c
47# Also generate the ICU4X versions
48bazelisk run //tools/unicode/c/genuca -- --icu4x --hanOrder implicit $ICU_SRC/icu4c
49bazelisk run //tools/unicode/c/genuca -- --icu4x --hanOrder radical-stroke $ICU_SRC/icu4c
50