public function install(Extension $ext, array $configureOptions = array()) { $sourceDir = $ext->getSourceDirectory(); $pwd = getcwd(); $buildLogPath = $sourceDir . DIRECTORY_SEPARATOR . 'build.log'; $make = new MakeTask($this->logger, $this->options); $make->setBuildLogPath($buildLogPath); $this->logger->info("Log stored at: {$buildLogPath}"); $this->logger->info("Changing directory to {$sourceDir}"); chdir($sourceDir); if (!$this->options->{'no-clean'} && $ext->isBuildable()) { $clean = new MakeTask($this->logger, $this->options); $clean->setQuiet(); $clean->clean($ext); } if ($ext->getConfigM4File() !== "config.m4" && !file_exists($sourceDir . DIRECTORY_SEPARATOR . 'config.m4')) { symlink($ext->getConfigM4File(), $sourceDir . DIRECTORY_SEPARATOR . 'config.m4'); } // If the php version is specified, we should get phpize with the correct version. $this->logger->info('===> Phpize...'); Utils::system("phpize > {$buildLogPath} 2>&1", $this->logger); // here we don't want to use closure, because // 5.2 does not support closure. We haven't decided whether to // support 5.2 yet. $escapeOptions = array_map('escapeshellarg', $configureOptions); $this->logger->info("===> Configuring..."); $phpConfig = Config::getCurrentPhpConfigBin(); if (file_exists($phpConfig)) { $this->logger->debug("Appending argument: --with-php-config={$phpConfig}"); $escapeOptions[] = '--with-php-config=' . $phpConfig; } // Utils::system('./configure ' . join(' ', $escapeOptions) . ' >> build.log 2>&1'); $cmd = './configure ' . join(' ', $escapeOptions); if (!$this->logger->isDebug()) { $cmd .= " >> {$buildLogPath} 2>&1"; } Utils::system($cmd, $this->logger); $this->logger->info("===> Building..."); if ($this->logger->isDebug()) { passthru('make'); } else { $make->run($ext); } $this->logger->info("===> Installing..."); // This function is disabled when PHP is running in safe mode. if ($this->logger->isDebug()) { passthru('make install'); } else { $make->install($ext); } // TODO: use getSharedLibraryPath() $this->logger->debug("Installed extension library: " . $ext->getSharedLibraryPath()); // Try to find the installed path by pattern // Installing shared extensions: /Users/c9s/.phpbrew/php/php-5.4.10/lib/php/extensions/debug-non-zts-20100525/ chdir($pwd); $this->logger->info("===> Extension is installed."); }
public function findConfigM4File($dir) { if ($file = parent::findConfigM4File($dir)) { return $file; } if ($file = $this->findConfigM4FileFromPackageXml()) { return $file; } }
public function renameSourceDirectory(Extension $ext) { $currentPhpExtensionDirectory = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext'; $extName = $ext->getExtensionName(); $name = $ext->getName(); $extensionDir = $currentPhpExtensionDirectory . DIRECTORY_SEPARATOR . $extName; $extensionExtractDir = $currentPhpExtensionDirectory . DIRECTORY_SEPARATOR . $name; if ($name != $extName) { $this->logger->info("===> Rename source directory to {$extensionDir}..."); $cmds = array("rm -rf {$extensionDir}", "mv {$extensionExtractDir} {$extensionDir}"); foreach ($cmds as $cmd) { $this->logger->debug($cmd); Utils::system($cmd); } // replace source directory to new source directory $sourceDir = str_replace($extensionExtractDir, $extensionDir, $ext->getSourceDirectory()); $ext->setSourceDirectory($sourceDir); $ext->setName($extName); } }
public function describeExtension(Extension $ext) { $info = array('Name' => $ext->getExtensionName(), 'Source Directory' => $ext->getSourceDirectory(), 'Config' => $ext->getConfigM4Path(), 'INI File' => $ext->getConfigFilePath(), 'Extension' => $ext instanceof PeclExtension ? 'Pecl' : 'Core', 'Zend' => $ext->isZend() ? 'yes' : 'no', 'Loaded' => extension_loaded($ext->getExtensionName()) ? $this->formatter->format('yes', 'green') : $this->formatter->format('no', 'red')); foreach ($info as $label => $val) { $this->logger->writeln(sprintf('%20s: %s', $label, $val)); } $options = $ext->getConfigureOptions(); if (!empty($options)) { $this->logger->newline(); $this->logger->writeln(sprintf('%20s: ', 'Configure Options')); $this->logger->newline(); foreach ($options as $option) { $this->logger->writeln(sprintf(' %-32s %s', $option->option . ($option->valueHint ? '[=' . $option->valueHint . ']' : ''), $option->desc)); $this->logger->newline(); } } }
public function describeExtension(Extension $ext) { $this->logger->write(sprintf(' [%s] %-12s %-12s', extension_loaded($ext->getExtensionName()) ? '*' : ' ', $ext->getExtensionName(), phpversion($ext->getExtensionName()))); if ($this->options->{'show-path'}) { $this->logger->write(sprintf(' from %s', $ext->getConfigM4Path())); } $this->logger->newline(); // $this->logger->writeln(sprintf('config: %s', $ext->getConfigFilePath())); if ($this->options->{'show-options'}) { $padding = ' '; if ($ext instanceof M4Extension) { $options = $ext->getConfigureOptions(); if (!empty($options)) { $this->logger->info($padding . 'Configure options:'); foreach ($options as $option) { $this->logger->info($padding . ' ' . sprintf('%-32s %s', $option->option . ($option->valueHint ? '[=' . $option->valueHint . ']' : ''), $option->desc)); } } } } }
public function hasConflicts(Extension $ext) { return array_key_exists($ext->getName(), $this->conflicts); }