update-icu.sh 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. set -e
  6. # Update to an ICU release:
  7. # Usage: update-icu.sh <URL of ICU GIT> <release tag name>
  8. # E.g., for ICU 62.1: update-icu.sh https://github.com/unicode-org/icu.git release-62-1
  9. #
  10. # Update to an ICU maintenance branch:
  11. # Usage: update-icu.sh <URL of ICU GIT> <maintenance name>
  12. # E.g., for ICU 62.1: update-icu.sh https://github.com/unicode-org/icu.git maint/maint-62
  13. if [ $# -lt 2 ]; then
  14. echo "Usage: update-icu.sh <URL of ICU GIT> <release tag name>"
  15. exit 1
  16. fi
  17. # Ensure that $Date$ in the checked-out git files expands timezone-agnostically,
  18. # so that this script's behavior is consistent when run from any time zone.
  19. export TZ=UTC
  20. # Also ensure GIT-INFO is consistently English.
  21. export LANG=en_US.UTF-8
  22. export LANGUAGE=en_US
  23. export LC_ALL=en_US.UTF-8
  24. icu_dir=`dirname $0`/icu
  25. # Remove intl/icu/source, then replace it with a clean export.
  26. rm -rf ${icu_dir}/source
  27. tmpclonedir=$(mktemp -d)
  28. git clone --depth 1 --branch $2 $1 ${tmpclonedir}
  29. cp -r ${tmpclonedir}/icu4c/source ${icu_dir}/source
  30. # Record `git log`.
  31. # (This ensures that if ICU modifications are performed properly, it's always
  32. # possible to run the command at the top of this script and make no changes to
  33. # the tree.)
  34. git -C ${tmpclonedir} log -1 > ${icu_dir}/GIT-INFO
  35. # Clean up after ourselves.
  36. rm -rf ${tmpclonedir}
  37. # remove layoutex, tests, and samples, but leave makefiles in place
  38. find ${icu_dir}/source/layoutex -name '*Makefile.in' -prune -or -type f -print | xargs rm
  39. find ${icu_dir}/source/test -name '*Makefile.in' -prune -or -type f -print | xargs rm
  40. find ${icu_dir}/source/samples -name '*Makefile.in' -prune -or -type f -print | xargs rm
  41. # remove data that we currently don't need
  42. rm -rf ${icu_dir}/source/data/brkitr/*
  43. rm ${icu_dir}/source/data/lang/*.mk
  44. rm ${icu_dir}/source/data/lang/*.txt
  45. rm ${icu_dir}/source/data/mappings/*.mk
  46. find ${icu_dir}/source/data/mappings \
  47. -name ibm-37_P100-1995.ucm -prune -or \
  48. -name ibm-1047_P100-1995.ucm -prune -or \
  49. -name '*.ucm' -print | xargs rm
  50. rm ${icu_dir}/source/data/rbnf/*
  51. rm ${icu_dir}/source/data/region/*.mk
  52. rm ${icu_dir}/source/data/region/*.txt
  53. rm ${icu_dir}/source/data/translit/*
  54. rm ${icu_dir}/source/data/unit/*.mk
  55. rm ${icu_dir}/source/data/unit/*.txt
  56. for patch in \
  57. bug-915735 \
  58. suppress-warnings.diff \
  59. bug-1172609-timezone-recreateDefault.diff \
  60. bug-1198952-workaround-make-3.82-bug.diff \
  61. bug-1228227-bug-1263325-libc++-gcc_hidden.diff \
  62. ucol_getKeywordValuesForLocale-ulist_resetList.diff \
  63. unum_formatDoubleForFields.diff \
  64. ; do
  65. echo "Applying local patch $patch"
  66. patch -d ${icu_dir}/../../ -p1 --no-backup-if-mismatch < ${icu_dir}/../icu-patches/$patch
  67. done
  68. topsrcdir=`dirname $0`/../
  69. python ${topsrcdir}/js/src/tests/ecma_6/String/make-normalize-generateddata-input.py $topsrcdir
  70. # Update our moz.build files in config/external/icu, and
  71. # build a new ICU data file.
  72. python `dirname $0`/icu_sources_data.py $topsrcdir
  73. #hg addremove ${icu_dir} ${topsrcdir}/config/external/icu
  74. # Check local tzdata version.
  75. `dirname $0`/update-tzdata.sh -c