add dist name getter for extension

This commit is contained in:
crazywhalecc 2023-04-08 11:49:06 +08:00
parent 84daa9b151
commit f4ebca927b
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 27 additions and 1 deletions

View File

@ -112,6 +112,17 @@ class Extension
return $this->name;
}
/**
* returns extension dist name
*/
public function getDistName(): string
{
return match ($this->name) {
'mbregex' => 'mbstring',
default => $this->name,
};
}
/**
* @throws RuntimeException
*/
@ -183,6 +194,21 @@ class Extension
$arg .= ' --with-event-openssl --with-openssl-dir="' . BUILD_ROOT_PATH . '"';
}
break;*/
case 'enchant':
$glibs = [
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libgio-2.0.a',
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libglib-2.0.a',
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libgmodule-2.0.a',
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libgobject-2.0.a',
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libgthread-2.0.a',
'/Users/jerry/project/git-project/static-php-cli/buildroot/lib/libintl.a',
];
$arg = ' --with-enchant="' . BUILD_ROOT_PATH . '"';
$arg .= ' ENCHANT2_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '/enchant-2"';
$arg .= ' ENCHANT2_LIBS="' . $this->getLibFilesString() . '"';
$arg .= ' GLIB_CFLAGS=-I"' . BUILD_INCLUDE_PATH . '"';
$arg .= ' GLIB_LIBS="' . implode(' ', $glibs) . '"';
break;
case 'iconv':
$arg = ' --with-iconv="' . BUILD_ROOT_PATH . '"';
break;

View File

@ -68,7 +68,7 @@ trait UnixBuilderTrait
}
foreach ($this->exts as $ext) {
logger()->debug('testing ext: ' . $ext->getName());
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri ' . $ext->getName(), false);
[$ret] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri ' . $ext->getDistName(), false);
if ($ret !== 0) {
throw new RuntimeException('extension ' . $ext->getName() . ' failed compile check');
}