diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ea2c4b1c..a62fcc0a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -265,9 +265,9 @@ jobs: ./bin/spc doctor --auto-fix ${{ matrix.combo.build-args }} --dl-with-php=${{ matrix.combo.php-version }} - - name: Setup upterm session - if: ${{ failure() }} - uses: owenthereal/action-upterm@v1 +# - name: Setup upterm session +# if: ${{ failure() }} +# uses: owenthereal/action-upterm@v1 - name: Upload logs if: always() && hashFiles('log/**') != '' diff --git a/src/Package/Target/php/unix.php b/src/Package/Target/php/unix.php index 54ccff43..641c12f6 100644 --- a/src/Package/Target/php/unix.php +++ b/src/Package/Target/php/unix.php @@ -169,18 +169,18 @@ trait unix #[BeforeStage('php', [self::class, 'makeForUnix'], 'php')] #[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)')] - public function tryPatchMakefileUnix(ToolchainInterface $toolchain): void + public function tryPatchMakefileUnix(TargetPackage $package, ToolchainInterface $toolchain): void { if (SystemTarget::getTargetOS() !== 'Linux') { return; } // 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 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'); } } diff --git a/src/StaticPHP/Registry/PackageLoader.php b/src/StaticPHP/Registry/PackageLoader.php index 212bcb10..bc38a650 100644 --- a/src/StaticPHP/Registry/PackageLoader.php +++ b/src/StaticPHP/Registry/PackageLoader.php @@ -499,6 +499,10 @@ class PackageLoader 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; + + if ($instance_class instanceof Package && isset(self::$packages[$package_name])) { + $instance_class = self::$packages[$package_name]; + } $conditionals = array_map( fn (\ReflectionAttribute $a) => $a->newInstance()->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.'); } $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( fn (\ReflectionAttribute $a) => $a->newInstance()->class, [...$method->getDeclaringClass()->getAttributes(ConditionalOn::class), ...$method->getAttributes(ConditionalOn::class)],