echo "Using the existing git repository at {
$repoDir}.\n";
} else { echo "Starting git clone. This may take a while...\n";
$repoDir =
sys_get_temp_dir().'/icu-data';
$git = GitRepository::
download('https://github.com/unicode-org/icu.git',
$repoDir);
echo "Git clone to {
$repoDir} complete.\n";
}$gitTag =
$git->
getLastTag(fn ($tag) =>
preg_match('#^release-[0-9]{1,}-[0-9]{1}$#',
$tag));
$shortIcuVersion =
strip_minor_versions(preg_replace('#release-([0-9]{1,})-([0-9]{1,})#', '$1.$2',
$gitTag));
echo "Checking out `{
$gitTag}` for version `{
$shortIcuVersion}`...\n";
$git->
checkout('tags/'.
$gitTag);
$filesystem =
new Filesystem();
$sourceDir =
$repoDir.'/icu4c/source';
if ($argc >= 3
) { $buildDir =
$argv[2
];
} else {