update-icu.sh (3414B)
1 #!/bin/sh 2 # This Source Code Form is subject to the terms of the Mozilla Public 3 # License, v. 2.0. If a copy of the MPL was not distributed with this 4 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 5 6 set -e 7 8 # Update to an ICU release: 9 # Usage: update-icu.sh <URL of ICU GIT> <release tag name> 10 # E.g., for ICU 62.1: update-icu.sh https://github.com/unicode-org/icu.git release-62-1 11 # 12 # Update to an ICU maintenance branch: 13 # Usage: update-icu.sh <URL of ICU GIT> <maintenance name> 14 # E.g., for ICU 62.1: update-icu.sh https://github.com/unicode-org/icu.git maint/maint-62 15 16 if [ $# -lt 2 ]; then 17 echo "Usage: update-icu.sh <URL of ICU GIT> <release tag name>" 18 exit 1 19 fi 20 21 # Ensure that $Date$ in the checked-out git files expands timezone-agnostically, 22 # so that this script's behavior is consistent when run from any time zone. 23 export TZ=UTC 24 25 # Also ensure GIT-INFO is consistently English. 26 export LANG=en_US.UTF-8 27 export LANGUAGE=en_US 28 export LC_ALL=en_US.UTF-8 29 30 icu_dir=`dirname $0`/icu 31 32 # Remove intl/icu/source, then replace it with a clean export. 33 rm -rf ${icu_dir}/source 34 tmpclonedir=$(mktemp -d) 35 git clone --depth 1 --branch $2 $1 ${tmpclonedir} 36 cp -r ${tmpclonedir}/icu4c/source ${icu_dir}/source 37 38 # Record `git log`. 39 # (This ensures that if ICU modifications are performed properly, it's always 40 # possible to run the command at the top of this script and make no changes to 41 # the tree.) 42 git -C ${tmpclonedir} log -1 > ${icu_dir}/GIT-INFO 43 44 # Clean up after ourselves. 45 rm -rf ${tmpclonedir} 46 47 # Remove layoutex, tests, and samples, but leave makefiles and test data in place. 48 find ${icu_dir}/source/layoutex -name '*Makefile.in' -prune -or -type f -print | xargs rm 49 find ${icu_dir}/source/test -name '*Makefile.in' -prune -or -name 'testdata' -prune -or -type f -print | xargs rm 50 find ${icu_dir}/source/samples -name '*Makefile.in' -prune -or -type f -print | xargs rm 51 52 for patch in \ 53 bug-915735 \ 54 suppress-warnings.diff \ 55 bug-1198952-workaround-make-3.82-bug.diff \ 56 bug-1614941-dsb-hsb-dates.diff \ 57 bug-1636984-display-name-fractional-seconds.diff \ 58 bug-1636984-append-item-dayperiod-fractional-seconds.diff \ 59 bug-1706949-wasi-workaround.diff \ 60 bug-1790071-ICU-22132-standardize-vtzone-output.diff \ 61 double-conversion.diff \ 62 bug-1856290-ICU-20548-dateinterval-timezone.diff \ 63 bug-1954138-dtitvfmt-adopt-calendar.diff \ 64 bug-1972781-chinese-based-calendar.diff \ 65 bug-2000225-ICU-23264-increase-measure-unit-capacity.diff \ 66 bug-2000225-ICU-23262-missing-resource-error-for-iso8601-era.diff \ 67 bug-2002735-ICU-23277-coptic-single-era.diff \ 68 bug-2002997-ICU-23278-metazone-with-offset.diff \ 69 ; do 70 echo "Applying local patch $patch" 71 patch -d ${icu_dir}/../../ -p1 --no-backup-if-mismatch < ${icu_dir}/../icu-patches/$patch 72 done 73 74 topsrcdir=`dirname $0`/../ 75 python ${topsrcdir}/js/src/tests/non262/String/make-normalize-generateddata-input.py $topsrcdir 76 77 # Update our moz.build files in config/external/icu, and build a new ICU data 78 # file. 79 python `dirname $0`/icu_sources_data.py $topsrcdir 80 81 hg addremove "${icu_dir}/source" "${icu_dir}/GIT-INFO" ${topsrcdir}/config/external/icu 82 83 # Check local tzdata version. 84 `dirname $0`/update-tzdata.sh -c 85 86 # CLDR updates may lead to new language tag mappings, so we need to call make_intl_data.py, too. 87 echo "INFO: Please run 'js/src/builtin/intl/make_intl_data.py langtags' to update additional language tag files for SpiderMonkey."