Fix typo in 9b54bd30006c008b4a951331b273613d5bac3abf
[pm.git] / intl / update-icu.sh
blob93627afa099dd31b9627b23aa9006c0e036766b4
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/.
6 set -e
8 # Usage: update-icu.sh <URL of ICU SVN with release>
9 # E.g., for ICU 58.2: update-icu.sh https://ssl.icu-project.org/repos/icu/tags/release-58-2/icu4c/
11 if [ $# -lt 1 ]; then
12 echo "Usage: update-icu.sh <URL of ICU SVN with release>"
13 exit 1
16 # Ensure that $Date$ in the checked-out svn files expands timezone-agnostically,
17 # so that this script's behavior is consistent when run from any time zone.
18 export TZ=UTC
20 # Also ensure SVN-INFO is consistently English.
21 export LANG=en_US.UTF-8
22 export LC_ALL=en_US.UTF-8
24 icu_dir=`dirname $0`/icu
26 # Remove intl/icu/source, then replace it with a clean export.
27 rm -rf ${icu_dir}/source
28 svn export $1/source/ ${icu_dir}/source
30 # remove layoutex, tests, and samples, but leave makefiles in place
31 find ${icu_dir}/source/layoutex -name '*Makefile.in' -prune -or -type f -print | xargs rm
32 find ${icu_dir}/source/test -name '*Makefile.in' -prune -or -type f -print | xargs rm
33 find ${icu_dir}/source/samples -name '*Makefile.in' -prune -or -type f -print | xargs rm
35 # remove data that we currently don't need
36 rm -rf ${icu_dir}/source/data/brkitr/*
37 rm ${icu_dir}/source/data/lang/*.mk
38 rm ${icu_dir}/source/data/lang/*.txt
39 rm ${icu_dir}/source/data/mappings/*.mk
40 find ${icu_dir}/source/data/mappings \
41 -name ibm-37_P100-1995.ucm -prune -or \
42 -name ibm-1047_P100-1995.ucm -prune -or \
43 -name '*.ucm' -print | xargs rm
44 rm ${icu_dir}/source/data/rbnf/*
45 rm ${icu_dir}/source/data/region/*.mk
46 rm ${icu_dir}/source/data/region/*.txt
47 rm ${icu_dir}/source/data/translit/*
48 rm ${icu_dir}/source/data/unit/*.mk
49 rm ${icu_dir}/source/data/unit/*.txt
51 # Record `svn info`, eliding the line that changes every time the entire ICU
52 # repository (not just the path within it we care about) receives a commit.
53 # (This ensures that if ICU modifications are performed properly, it's always
54 # possible to run the command at the top of this script and make no changes to
55 # the tree.)
56 svn info $1 | grep -v '^Revision: [[:digit:]]\+$' > ${icu_dir}/SVN-INFO
58 for patch in \
59 bug-915735 \
60 suppress-warnings.diff \
61 bug-1172609-timezone-recreateDefault.diff \
62 bug-1198952-workaround-make-3.82-bug.diff \
63 bug-1228227-bug-1263325-libc++-gcc_hidden.diff \
64 bug-1325858-close-key.diff \
65 ucol_getKeywordValuesForLocale-ulist_resetList.diff \
66 unum_formatDoubleForFields.diff \
67 ; do
68 echo "Applying local patch $patch"
69 patch -d ${icu_dir}/../../ -p1 --no-backup-if-mismatch < ${icu_dir}/../icu-patches/$patch
70 done
72 # NOTE: If you're updating this script for a new ICU version, you have to rerun
73 # js/src/tests/ecma_6/String/make-normalize-generateddata-input.py for any
74 # normalization changes the new ICU implements.