38 lines
935 B
PHP
Raw Normal View History

2025-05-20 07:46:07 +07:00
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
2025-05-20 08:24:28 +07:00
use SPC\builder\linux\LinuxBuilder;
2025-05-20 07:46:07 +07:00
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('phar')]
class phar extends Extension
{
2025-05-20 09:20:20 +07:00
public function buildUnixShared(): void
2025-05-20 07:46:07 +07:00
{
2025-05-20 08:24:28 +07:00
if (!$this->builder instanceof LinuxBuilder) {
2025-05-20 09:20:20 +07:00
parent::buildUnixShared();
return;
2025-05-20 08:24:28 +07:00
}
2025-05-20 09:20:20 +07:00
2025-05-20 07:46:07 +07:00
FileSystem::replaceFileStr(
$this->source_dir . '/config.m4',
['$ext_dir/phar.1', '$ext_dir/phar.phar.1'],
['${ext_dir}phar.1', '${ext_dir}phar.phar.1']
);
2025-05-20 09:20:20 +07:00
try {
parent::buildUnixShared();
} finally {
FileSystem::replaceFileStr(
$this->source_dir . '/config.m4',
['${ext_dir}phar.1', '${ext_dir}phar.phar.1'],
['$ext_dir/phar.1', '$ext_dir/phar.phar.1']
);
}
2025-05-20 07:46:07 +07:00
}
}