|
24 | 24 | require_once __DIR__ . '/common.php';
|
25 | 25 | require_once __DIR__ . '/autoload.php';
|
26 | 26 |
|
27 |
| -if ($GLOBALS['argc'] > 2) { |
| 27 | +if ($GLOBALS['argc'] > 3) { |
28 | 28 | bailout(<<<MESSAGE
|
29 |
| -Usage: php update-icu-component.php <path/to/icu/source> |
| 29 | +Usage: php update-icu-component.php <path/to/icu/source> <path/to/icu/build> |
30 | 30 |
|
31 | 31 | Updates the ICU data for Symfony2 to the latest version of the ICU version
|
32 | 32 | included in the intl extension. For example, if your intl extension includes
|
33 | 33 | ICU 4.8, the script will download the latest data available for ICU 4.8.
|
34 | 34 |
|
35 | 35 | If you downloaded the SVN repository before, you can pass the path to the
|
36 |
| -repository in the first optional argument. |
| 36 | +repository source in the first optional argument. |
| 37 | +
|
| 38 | +If you also built the repository before, you can pass the directory where that |
| 39 | +build is stored in the second parameter. The build directory needs to contain |
| 40 | +the subdirectories bin/ and lib/. |
37 | 41 |
|
38 | 42 | For running this script, the intl extension must be loaded and all vendors
|
39 | 43 | must have been installed through composer:
|
|
75 | 79 | echo " $urlVersion\n";
|
76 | 80 | }
|
77 | 81 |
|
78 |
| -if (2 === $GLOBALS['argc']) { |
| 82 | +if ($GLOBALS['argc'] >= 2) { |
79 | 83 | $sourceDir = $GLOBALS['argv'][1];
|
80 | 84 | $svn = new SvnRepository($sourceDir);
|
81 | 85 |
|
|
89 | 93 | echo "SVN checkout to {$sourceDir} complete.\n";
|
90 | 94 | }
|
91 | 95 |
|
92 |
| -// Always build genrb so that we can determine the ICU version of the |
93 |
| -// download by running genrb --version |
94 |
| -echo "Building genrb.\n"; |
| 96 | +if ($GLOBALS['argc'] >= 3) { |
| 97 | + $buildDir = $GLOBALS['argv'][2]; |
| 98 | +} else { |
| 99 | + // Always build genrb so that we can determine the ICU version of the |
| 100 | + // download by running genrb --version |
| 101 | + echo "Building genrb.\n"; |
| 102 | + |
| 103 | + cd($sourceDir); |
| 104 | + |
| 105 | + echo "Running configure...\n"; |
| 106 | + |
| 107 | + $buildDir = sys_get_temp_dir() . '/icu-data/' . $shortIcuVersion . '/build'; |
95 | 108 |
|
96 |
| -cd($sourceDir); |
| 109 | + $filesystem->remove($buildDir); |
| 110 | + $filesystem->mkdir($buildDir); |
97 | 111 |
|
98 |
| -echo "Running configure...\n"; |
| 112 | + run('./configure --prefix=' . $buildDir . ' 2>&1'); |
99 | 113 |
|
100 |
| -$buildDir = sys_get_temp_dir() . '/icu-data/' . $shortIcuVersion . '/build'; |
| 114 | + echo "Running make...\n"; |
101 | 115 |
|
102 |
| -$filesystem->remove($buildDir); |
103 |
| -$filesystem->mkdir($buildDir); |
| 116 | + // If the directory "lib" does not exist in the download, create it or we |
| 117 | + // will run into problems when building libicuuc.so. |
| 118 | + $filesystem->mkdir($sourceDir . '/lib'); |
104 | 119 |
|
105 |
| -run('./configure --prefix=' . $buildDir . ' 2>&1'); |
| 120 | + // If the directory "bin" does not exist in the download, create it or we |
| 121 | + // will run into problems when building genrb. |
| 122 | + $filesystem->mkdir($sourceDir . '/bin'); |
106 | 123 |
|
107 |
| -echo "Running make...\n"; |
| 124 | + echo "[1/5] libicudata.so..."; |
108 | 125 |
|
109 |
| -echo "libicudata.so\n"; |
| 126 | + cd($sourceDir . '/stubdata'); |
| 127 | + run('make 2>&1 && make install 2>&1'); |
110 | 128 |
|
111 |
| -cd($sourceDir . '/stubdata'); |
112 |
| -run('make 2>&1 && make install 2>&1'); |
| 129 | + echo " ok.\n"; |
113 | 130 |
|
114 |
| -echo "libicuuc.so\n"; |
| 131 | + echo "[2/5] libicuuc.so..."; |
115 | 132 |
|
116 |
| -cd($sourceDir . '/common'); |
117 |
| -run('make 2>&1 && make install 2>&1'); |
| 133 | + cd($sourceDir . '/common'); |
| 134 | + run('make 2>&1 && make install 2>&1'); |
118 | 135 |
|
119 |
| -echo "libicui18n.so\n"; |
| 136 | + echo " ok.\n"; |
120 | 137 |
|
121 |
| -cd($sourceDir . '/i18n'); |
122 |
| -run('make 2>&1 && make install 2>&1'); |
| 138 | + echo "[3/5] libicui18n.so..."; |
123 | 139 |
|
124 |
| -echo "libicutu.so\n"; |
| 140 | + cd($sourceDir . '/i18n'); |
| 141 | + run('make 2>&1 && make install 2>&1'); |
125 | 142 |
|
126 |
| -cd($sourceDir . '/tools/toolutil'); |
127 |
| -run('make 2>&1 && make install 2>&1'); |
| 143 | + echo " ok.\n"; |
128 | 144 |
|
129 |
| -echo "genrb\n"; |
| 145 | + echo "[4/5] libicutu.so..."; |
130 | 146 |
|
131 |
| -cd($sourceDir . '/tools/genrb'); |
132 |
| -run('make 2>&1 && make install 2>&1'); |
| 147 | + cd($sourceDir . '/tools/toolutil'); |
| 148 | + run('make 2>&1 && make install 2>&1'); |
| 149 | + |
| 150 | + echo " ok.\n"; |
| 151 | + |
| 152 | + echo "[5/5] genrb..."; |
| 153 | + |
| 154 | + cd($sourceDir . '/tools/genrb'); |
155 | + run('make 2>&1 && make install 2>&1'); |
| 156 | + |
| 157 | + echo " ok.\n"; |
| 158 | +} |
133 | 159 |
|
134 | 160 | $genrb = $buildDir . '/bin/genrb';
|
135 | 161 | $genrbEnv = 'LD_LIBRARY_PATH=' . $buildDir . '/lib ';
|
|
0 commit comments