public function setPackage(Package $pkg)
{
$this->package = $pkg;
$this->setVersion($pkg->getReleaseVersion());
if ($pkg->getZendExtSrcRelease()) {
$this->setZend(true);
}
if ($n = strtolower($pkg->getProvidesExtension())) {
$this->setExtensionName($n);
$this->setSharedLibraryName($n . '.so');
}
if ($options = $pkg->getConfigureOptions()) {
$this->configureOptions = array();
foreach ($options as $option) {
$this->addConfigureOption(new ConfigureOption('--' . $option->name, $option->prompt, $option->default));
}
}
}
public static function createPeclExtension($packageName, $packageXmlPath) { $parser = new PackageXmlParser(); $package = $parser->parse($packageXmlPath); $ext = new PeclExtension($packageName); $ext->setPackage($package); /** * xhprof stores package.xml in the root directory, but putting the * config.m4 in the extension directory. * the path can be retrieve from the contents part from the package.xml */ if ($m4path = $ext->findConfigM4FileFromPackageXml()) { $sourceDirectory = dirname($packageXmlPath); $m4dir = dirname($m4path); if ($m4dir != '.') { $sourceDirectory .= DIRECTORY_SEPARATOR . $m4dir; } $ext->setSourceDirectory($sourceDirectory); } else { $ext->setSourceDirectory(dirname($packageXmlPath)); } return $ext; }