mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-03 23:05:41 +08:00
make patchLaDependencyPrefix argument optional, remove cleanLaFiles
This commit is contained in:
@@ -84,13 +84,24 @@ trait UnixLibraryTrait
|
||||
}
|
||||
}
|
||||
|
||||
public function patchLaDependencyPrefix(array $files): void
|
||||
public function patchLaDependencyPrefix(?array $files = null): void
|
||||
{
|
||||
logger()->info('Patching library [' . static::NAME . '] la files');
|
||||
$throwOnMissing = true;
|
||||
if ($files === null) {
|
||||
$files = $this->getStaticLibs();
|
||||
$files = array_map(fn ($name) => str_replace('.a', '.la', $name), $files);
|
||||
$throwOnMissing = false;
|
||||
}
|
||||
foreach ($files as $name) {
|
||||
$realpath = realpath(BUILD_LIB_PATH . '/' . $name);
|
||||
if ($realpath === false) {
|
||||
throw new RuntimeException('Cannot find library [' . static::NAME . '] la file [' . $name . '] !');
|
||||
if ($throwOnMissing) {
|
||||
throw new RuntimeException('Cannot find library [' . static::NAME . '] la file [' . $name . '] !');
|
||||
} else {
|
||||
logger()->warning('Cannot find library [' . static::NAME . '] la file [' . $name . '] !');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
logger()->debug('Patching ' . $realpath);
|
||||
// replace prefix
|
||||
@@ -105,22 +116,6 @@ trait UnixLibraryTrait
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* remove libtool archive files
|
||||
*
|
||||
* @throws FileSystemException
|
||||
* @throws WrongUsageException
|
||||
*/
|
||||
public function cleanLaFiles(): void
|
||||
{
|
||||
foreach ($this->getStaticLibs() as $lib) {
|
||||
$filename = pathinfo($lib, PATHINFO_FILENAME) . '.la';
|
||||
if (file_exists(BUILD_LIB_PATH . '/' . $filename)) {
|
||||
unlink(BUILD_LIB_PATH . '/' . $filename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function getLibExtraCFlags(): string
|
||||
{
|
||||
$env = getenv($this->getSnakeCaseName() . '_CFLAGS') ?: '';
|
||||
|
||||
Reference in New Issue
Block a user