mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-12 03:15:35 +08:00
Fix wrongly constructed class
This commit is contained in:
6
.github/workflows/tests.yml
vendored
6
.github/workflows/tests.yml
vendored
@@ -265,9 +265,9 @@ jobs:
|
|||||||
./bin/spc doctor --auto-fix
|
./bin/spc doctor --auto-fix
|
||||||
${{ matrix.combo.build-args }} --dl-with-php=${{ matrix.combo.php-version }}
|
${{ matrix.combo.build-args }} --dl-with-php=${{ matrix.combo.php-version }}
|
||||||
|
|
||||||
- name: Setup upterm session
|
# - name: Setup upterm session
|
||||||
if: ${{ failure() }}
|
# if: ${{ failure() }}
|
||||||
uses: owenthereal/action-upterm@v1
|
# uses: owenthereal/action-upterm@v1
|
||||||
|
|
||||||
- name: Upload logs
|
- name: Upload logs
|
||||||
if: always() && hashFiles('log/**') != ''
|
if: always() && hashFiles('log/**') != ''
|
||||||
|
|||||||
@@ -169,18 +169,18 @@ trait unix
|
|||||||
#[BeforeStage('php', [self::class, 'makeForUnix'], 'php')]
|
#[BeforeStage('php', [self::class, 'makeForUnix'], 'php')]
|
||||||
#[PatchDescription('Patch Makefile to fix //lib path for Linux builds')]
|
#[PatchDescription('Patch Makefile to fix //lib path for Linux builds')]
|
||||||
#[PatchDescription('Patch BUILD_CC to disable auto-vectorization when zig-cc is used (prevents minilua segfault)')]
|
#[PatchDescription('Patch BUILD_CC to disable auto-vectorization when zig-cc is used (prevents minilua segfault)')]
|
||||||
public function tryPatchMakefileUnix(ToolchainInterface $toolchain): void
|
public function tryPatchMakefileUnix(TargetPackage $package, ToolchainInterface $toolchain): void
|
||||||
{
|
{
|
||||||
if (SystemTarget::getTargetOS() !== 'Linux') {
|
if (SystemTarget::getTargetOS() !== 'Linux') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// replace //lib with /lib in Makefile
|
// replace //lib with /lib in Makefile
|
||||||
shell()->cd(SOURCE_PATH . '/php-src')->exec('sed -i "s|//lib|/lib|g" Makefile');
|
shell()->cd($package->getSourceDir())->exec('sed -i "s|//lib|/lib|g" Makefile');
|
||||||
|
|
||||||
// try to fix minilua with zig-cc, disable vectorize for some edge cases
|
// try to fix minilua with zig-cc, disable vectorize for some edge cases
|
||||||
if ($toolchain instanceof ZigToolchain) {
|
if ($toolchain instanceof ZigToolchain) {
|
||||||
$makefile = "{$this->getSourceDir()}/Makefile";
|
$makefile = "{$package->getSourceDir()}/Makefile";
|
||||||
FileSystem::replaceFileRegex($makefile, '/^(BUILD_CC\s*=\s*zig-cc)\s*$/m', '$1 -fno-vectorize -fno-slp-vectorize');
|
FileSystem::replaceFileRegex($makefile, '/^(BUILD_CC\s*=\s*zig-cc)\s*$/m', '$1 -fno-vectorize -fno-slp-vectorize');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,6 +499,10 @@ class PackageLoader
|
|||||||
throw new RegistryException('Package name must not be empty when no package context is available for BeforeStage attribute.');
|
throw new RegistryException('Package name must not be empty when no package context is available for BeforeStage attribute.');
|
||||||
}
|
}
|
||||||
$package_name = $method_instance->package_name === '' ? $pkg->getName() : $method_instance->package_name;
|
$package_name = $method_instance->package_name === '' ? $pkg->getName() : $method_instance->package_name;
|
||||||
|
|
||||||
|
if ($instance_class instanceof Package && isset(self::$packages[$package_name])) {
|
||||||
|
$instance_class = self::$packages[$package_name];
|
||||||
|
}
|
||||||
$conditionals = array_map(
|
$conditionals = array_map(
|
||||||
fn (\ReflectionAttribute $a) => $a->newInstance()->class,
|
fn (\ReflectionAttribute $a) => $a->newInstance()->class,
|
||||||
[...$method->getDeclaringClass()->getAttributes(ConditionalOn::class), ...$method->getAttributes(ConditionalOn::class)],
|
[...$method->getDeclaringClass()->getAttributes(ConditionalOn::class), ...$method->getAttributes(ConditionalOn::class)],
|
||||||
@@ -529,6 +533,11 @@ class PackageLoader
|
|||||||
throw new RegistryException('Package name must not be empty when no package context is available for AfterStage attribute.');
|
throw new RegistryException('Package name must not be empty when no package context is available for AfterStage attribute.');
|
||||||
}
|
}
|
||||||
$package_name = $method_instance->package_name === '' ? $pkg->getName() : $method_instance->package_name;
|
$package_name = $method_instance->package_name === '' ? $pkg->getName() : $method_instance->package_name;
|
||||||
|
|
||||||
|
if ($instance_class instanceof Package && isset(self::$packages[$package_name])) {
|
||||||
|
$instance_class = self::$packages[$package_name];
|
||||||
|
}
|
||||||
|
|
||||||
$conditionals = array_map(
|
$conditionals = array_map(
|
||||||
fn (\ReflectionAttribute $a) => $a->newInstance()->class,
|
fn (\ReflectionAttribute $a) => $a->newInstance()->class,
|
||||||
[...$method->getDeclaringClass()->getAttributes(ConditionalOn::class), ...$method->getAttributes(ConditionalOn::class)],
|
[...$method->getDeclaringClass()->getAttributes(ConditionalOn::class), ...$method->getAttributes(ConditionalOn::class)],
|
||||||
|
|||||||
Reference in New Issue
Block a user