move opentelemetry back to PIE

This commit is contained in:
henderkes
2026-07-22 22:36:15 +07:00
parent ed0863db6f
commit 347a3c3c11
6 changed files with 29 additions and 15 deletions

View File

@@ -2,8 +2,9 @@ ext-opentelemetry:
type: php-extension
artifact:
source:
type: pecl
name: opentelemetry
type: pie
repo: open-telemetry/ext-opentelemetry
build-root: ext
metadata:
license-files: [LICENSE]
license: Apache-2.0

View File

@@ -4,10 +4,10 @@ krb5:
source:
type: url
url: 'https://web.mit.edu/kerberos/dist/krb5/1.22/krb5-1.22.2.tar.gz'
build-root: src
metadata:
license-files: [NOTICE]
license: BSD-3-Clause
source-root: src
depends:
- openssl
suggests:

View File

@@ -331,13 +331,13 @@ class Artifact
/**
* Get source build root directory.
* It's only worked when 'source-root' is defined in artifact config.
* It's only used when source.build-root is defined in artifact config.
* Normally it's equal to source dir.
*/
public function getSourceRoot(): string
{
if (isset($this->config['metadata']['source-root'])) {
return FileSystem::convertPath($this->getSourceDir() . '/' . ltrim($this->config['metadata']['source-root'], '/'));
if (isset($this->config['source']['build-root'])) {
return FileSystem::convertPath($this->getSourceDir() . '/' . ltrim($this->config['source']['build-root'], '/'));
}
return $this->getSourceDir();
}

View File

@@ -297,8 +297,8 @@ class ConfigValidator
throw new ValidationException("Artifact source object of type '{$type}' must have required field '{$field}'");
}
}
// check for unknown fields
$allowed_fields = array_merge(['type'], $required_fields, $optional_fields);
// check for unknown fields ('build-root': optional build subdir, applies to any type)
$allowed_fields = array_merge(['type', 'build-root'], $required_fields, $optional_fields);
self::validateNoInvalidFields('artifact object', $item_name, $data, $allowed_fields);
}

View File

@@ -251,7 +251,7 @@ abstract class Package
/**
* Get source build root directory.
* It's only worked when 'source-root' is defined in artifact config.
* It's only worked when source.build-root is defined in artifact config.
* Normally it's equal to source dir.
*/
public function getSourceRoot(): string

View File

@@ -60,6 +60,19 @@ class PhpExtensionPackage extends Package
return parent::getSourceDir();
}
/**
* Directory the extension is actually built in: cd'd into by phpize/configure/make.
* Equals getSourceDir() unless the artifact declares source.build-root (e.g. a PIE
* package whose config.m4 lives in an ext/ subdir).
*/
public function getSourceRoot(): string
{
if ($this->getArtifact() === null) {
return $this->getSourceDir();
}
return parent::getSourceRoot();
}
public function getExtensionName(): string
{
return str_replace('ext-', '', $this->getName());
@@ -299,7 +312,7 @@ class PhpExtensionPackage extends Package
#[Stage]
public function phpizeForUnix(array $env, PhpExtensionPackage $package): void
{
shell()->cd($package->getSourceDir())->setEnv($env)->exec(BUILD_BIN_PATH . '/phpize');
shell()->cd($package->getSourceRoot())->setEnv($env)->exec(BUILD_BIN_PATH . '/phpize');
}
/**
@@ -310,7 +323,7 @@ class PhpExtensionPackage extends Package
{
$phpvars = getenv('SPC_EXTRA_PHP_VARS') ?: '';
// CustomPhpConfigureArg keys are OS names ('Linux'/'Darwin'), not platform strings
shell()->cd($package->getSourceDir())
shell()->cd($package->getSourceRoot())
->setEnv($env)
->exec(
'./configure ' . $this->getPhpConfigureArg(SystemTarget::getTargetOS(), true) .
@@ -329,7 +342,7 @@ class PhpExtensionPackage extends Package
$package->patchSharedLibAdd();
$extra_ldflags = (string) getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS');
$makeArgs = $extra_ldflags !== '' ? 'EXTRA_LDFLAGS=' . escapeshellarg($extra_ldflags) : '';
shell()->cd($package->getSourceDir())
shell()->cd($package->getSourceRoot())
->setEnv($env)
->exec('make clean')
->exec("make -j{$builder->concurrency} {$makeArgs}")
@@ -355,7 +368,7 @@ class PhpExtensionPackage extends Package
? '-l:libstdc++.a'
: (str_contains($sharedLibs, '-lstdc++') ? '-lstdc++' : '');
$makefile = $this->getSourceDir() . '/Makefile';
$makefile = $this->getSourceRoot() . '/Makefile';
if (!is_file($makefile)) {
return;
}
@@ -390,9 +403,9 @@ class PhpExtensionPackage extends Package
return;
}
if (!is_dir($this->getSourceDir())) {
if (!is_dir($this->getSourceRoot())) {
throw new ValidationException(
"Extension source directory not found: {$this->getSourceDir()}",
"Extension source directory not found: {$this->getSourceRoot()}",
validation_module: "Extension {$this->getName()} source"
);
}