generate.sh (2653B)
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 14 ICU4C_COMMON=$ICU_SRC/icu4c/source/common 15 ICU4C_DATA_IN=$ICU_SRC/icu4c/source/data/in 16 ICU4C_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. 21 rm $ICU_SRC/icu4c/source/common/norm2_nfc_data.h 22 rm $ICU_SRC/icu4c/source/common/propname_data.h 23 rm $ICU_SRC/icu4c/source/common/*_props_data.h 24 rm $ICU4C_DATA_IN/*.icu 25 rm $ICU4C_DATA_IN/*.nrm 26 rm $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. 31 set -e 32 33 # Generate normalization data files directly into the source tree. 34 bazelisk run //icu4c/source/tools/gennorm2 -- -o $ICU4C_COMMON/norm2_nfc_data.h -s $ICU4C_NORM2 nfc.txt --csource 35 bazelisk run //icu4c/source/tools/gennorm2 -- -o $ICU4C_DATA_IN/nfc.nrm -s $ICU4C_NORM2 nfc.txt 36 bazelisk run //icu4c/source/tools/gennorm2 -- -o $ICU4C_DATA_IN/nfkc.nrm -s $ICU4C_NORM2 nfc.txt nfkc.txt 37 bazelisk run //icu4c/source/tools/gennorm2 -- -o $ICU4C_DATA_IN/nfkc_cf.nrm -s $ICU4C_NORM2 nfc.txt nfkc.txt nfkc_cf.txt 38 bazelisk run //icu4c/source/tools/gennorm2 -- -o $ICU4C_DATA_IN/nfkc_scf.nrm -s $ICU4C_NORM2 nfc.txt nfkc.txt nfkc_scf.txt 39 bazelisk run //icu4c/source/tools/gennorm2 -- -o $ICU4C_DATA_IN/uts46.nrm -s $ICU4C_NORM2 nfc.txt uts46.txt 40 41 # genprops writes several files directly into the source tree. 42 bazelisk run //tools/unicode/c/genprops $ICU_SRC/icu4c 43 44 # genuca also writes several files directly into the source tree. 45 # We run it twice for different versions of the CLDR root sort order. 46 bazelisk run //tools/unicode/c/genuca -- --hanOrder implicit $ICU_SRC/icu4c 47 bazelisk run //tools/unicode/c/genuca -- --hanOrder radical-stroke $ICU_SRC/icu4c 48 # Also generate the ICU4X versions 49 bazelisk run //tools/unicode/c/genuca -- --icu4x --hanOrder implicit $ICU_SRC/icu4c 50 bazelisk run //tools/unicode/c/genuca -- --icu4x --hanOrder radical-stroke $ICU_SRC/icu4c