8000 [Intl] Improved the bundle compilation process · symfony/symfony@dd2d013 · GitHub
[go: up one dir, main page]

Skip to content

Commit dd2d013

Browse files
committed
[Intl] Improved the bundle compilation process
1 parent f47e60a commit dd2d013

File tree

3 files changed

+57
-31
lines changed

3 files changed

+57
-31
lines changed

src/Symfony/Component/Intl/Resources/bin/update-icu-component.php

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@
2424
require_once __DIR__ . '/common.php';
2525
require_once __DIR__ . '/autoload.php';
2626

27-
if ($GLOBALS['argc'] > 2) {
27+
if ($GLOBALS['argc'] > 3) {
2828
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>
3030
3131
Updates the ICU data for Symfony2 to the latest version of the ICU version
3232
included in the intl extension. For example, if your intl extension includes
3333
ICU 4.8, the script will download the latest data available for ICU 4.8.
3434
3535
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/.
3741
3842
For running this script, the intl extension must be loaded and all vendors
3943
must have been installed through composer:
@@ -75,7 +79,7 @@
7579
echo " $urlVersion\n";
7680
}
7781

78-
if (2 === $GLOBALS['argc']) {
82+
if ($GLOBALS['argc'] >= 2) {
7983
$sourceDir = $GLOBALS['argv'][1];
8084
$svn = new SvnRepository($sourceDir);
8185

@@ -89,47 +93,69 @@
8993
echo "SVN checkout to {$sourceDir} complete.\n";
9094
}
9195

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';
95108

96-
cd($sourceDir);
109+
$filesystem->remove($buildDir);
110+
$filesystem->mkdir($buildDir);
97111

98-
echo "Running configure...\n";
112+
run('./configure --prefix=' . $buildDir . ' 2>&1');
99113

100-
$buildDir = sys_get_temp_dir() . '/icu-data/' . $shortIcuVersion . '/build';
114+
echo "Running make...\n";
101115

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');
104119

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');
106123

107-
echo "Running make...\n";
124+
echo "[1/5] libicudata.so...";
108125

109-
echo "libicudata.so\n";
126+
cd($sourceDir . '/stubdata');
127+
run('make 2>&1 && make install 2>&1');
110128

111-
cd($sourceDir . '/stubdata');
112-
run('make 2>&1 && make install 2>&1');
129+
echo " ok.\n";
113130

114-
echo "libicuuc.so\n";
131+
echo "[2/5] libicuuc.so...";
115132

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');
118135

119-
echo "libicui18n.so\n";
136+
echo " ok.\n";
120137

121-
cd($sourceDir . '/i18n');
122-
run('make 2>&1 && make install 2>&1');
138+
echo "[3/5] libicui18n.so...";
123139

124-
echo "libicutu.so\n";
140+
cd($sourceDir . '/i18n');
141+
run('make 2>&1 && make install 2>&1');
125142

126-
cd($sourceDir . '/tools/toolutil');
127-
run('make 2>&1 && make install 2>&1');
143+
echo " ok.\n";
128144

129-
echo "genrb\n";
145+
echo "[4/5] libicutu.so...";
130146

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+
}
133159

134160
$genrb = $buildDir . '/bin/genrb';
135161
$genrbEnv = 'LD_LIBRARY_PATH=' . $buildDir . '/lib ';

src/Symfony/Component/Intl/Resources/bin/update-stubs.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363

6464
$icuVersionInIcuComponent = IcuData::getVersion();
6565

66-
echo "Compiling stubs for ICU version $icuVersionInIcuComponent.";
66+
echo "Compiling stubs for ICU version $icuVersionInIcuComponent.\n";
6767

6868
echo "Preparing stub creation...\n";
6969

src/Symfony/Component/Intl/Util/SvnRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static function download($url, $targetDir)
5656

5757
$filesystem = new Filesystem();
5858

59-
if (!$filesystem->exists($targetDir)) {
59+
if (!$filesystem->exists($targetDir . '/.svn')) {
6060
$filesystem->remove($targetDir);
6161
$filesystem->mkdir($targetDir);
6262

0 commit comments

Comments
 (0)
0