Example #1
0
 public function execute($extName, $version = 'stable')
 {
     $logger = $this->getLogger();
     $extensions = array();
     if (Utils::startsWith($extName, '+')) {
         $config = Config::getConfigParam('extensions');
         $extName = ltrim($extName, '+');
         if (isset($config[$extName])) {
             foreach ($config[$extName] as $extensionName => $extOptions) {
                 $args = explode(' ', $extOptions);
                 $extensions[$extensionName] = $this->getExtData($args);
             }
         } else {
             $logger->info('Extension set name not found. Have you configured it at the config.yaml file?');
         }
     } else {
         $args = array_slice(func_get_args(), 1);
         $extensions[$extName] = $this->getExtData($args);
     }
     if ($this->options->{'php-version'} !== null) {
         $phpVersion = Utils::findLatestPhpVersion($this->options->{'php-version'});
         Config::setPhpVersion($phpVersion);
     }
     foreach ($extensions as $extensionName => $extData) {
         $extension = new Extension($extensionName, $logger);
         $extension->install($extData->version, $extData->options);
     }
     Config::useSystemPhpVersion();
 }
Example #2
0
 public function execute($version = null)
 {
     // get current version
     if (!$version) {
         $version = getenv('PHPBREW_PHP');
     }
     // $currentVersion;
     $root = Config::getPhpbrewRoot();
     $home = Config::getPhpbrewHome();
     $lookup = getenv('PHPBREW_LOOKUP_PREFIX');
     // $versionBuildPrefix = Config::getVersionBuildPrefix($version);
     // $versionBinPath     = Config::getVersionBinPath($version);
     echo "export PHPBREW_ROOT={$root}\n";
     echo "export PHPBREW_HOME={$home}\n";
     echo "export PHPBREW_LOOKUP_PREFIX={$lookup}\n";
     if ($version !== false) {
         // checking php version exists
         $version = Utils::findLatestPhpVersion($version);
         $targetPhpBinPath = Config::getVersionBinPath($version);
         if (!is_dir($targetPhpBinPath)) {
             throw new Exception("# php version: " . $version . " not exists.");
         }
         echo 'export PHPBREW_PHP=' . $version . "\n";
         echo 'export PHPBREW_PATH=' . ($version ? Config::getVersionBinPath($version) : '') . "\n";
     }
 }
Example #3
0
 public function check(Build $build)
 {
     $apxs = $build->getVariant('apxs2');
     // trying to find apxs binary in case it wasn't explicitly specified (+apxs variant without path)
     if ($apxs === true) {
         $apxs = Utils::findbin('apxs');
         $this->logger->debug("Found apxs2 binary: {$apxs}");
     }
     if (!is_executable($apxs)) {
         throw new Exception("apxs binary is not executable: {$apxs}");
     }
     // use apxs to check module dir permission
     if ($apxs && ($libdir = trim(Utils::pipeExecute("{$apxs} -q LIBEXECDIR")))) {
         if (false === is_writable($libdir)) {
             $this->logger->error("Apache module dir {$libdir} is not writable.\nPlease consider using chmod to change the folder permission:");
             $this->logger->error("    \$ sudo chmod -R oga+rw {$libdir}");
             $this->logger->error("Warnings: the command above is not safe for public systems. please use with discretion.");
             throw new Exception();
         }
     }
     if ($apxs && ($confdir = trim(Utils::pipeExecute("{$apxs} -q SYSCONFDIR")))) {
         if (false === is_writable($confdir)) {
             $this->logger->error("Apache conf dir {$confdir} is not writable for phpbrew.");
             $this->logger->error("Please consider using chmod to change the folder permission: ");
             $this->logger->error("    \$ sudo chmod -R oga+rw {$confdir}");
             $this->logger->error("Warnings: the command above is not safe for public systems. please use with discretion.");
             throw new Exception();
         }
     }
 }
Example #4
0
 public function check(Build $build)
 {
     $apxs = $build->getVariant('apxs2');
     // trying to find apxs binary in case it wasn't explicitly specified (+apxs variant without path)
     if ($apxs === true) {
         $apxs = Utils::findbin('apxs');
         $this->logger->debug("Found apxs2 binary: {$apxs}");
     }
     if (!is_executable($apxs)) {
         throw new Exception("apxs binary is not executable: {$apxs}");
     }
     // use apxs to check module dir permission
     if ($apxs && ($libdir = trim(Utils::pipeExecute("{$apxs} -q LIBEXECDIR")))) {
         if (false === is_writable($libdir)) {
             throw new Exception("Apache module dir {$libdir} is not writable.\nPlease consider using chmod or sudo.");
         }
     }
     if ($apxs && ($confdir = trim(Utils::pipeExecute("{$apxs} -q SYSCONFDIR")))) {
         if (false === is_writable($confdir)) {
             $msg = array();
             $msg[] = "Apache conf dir {$confdir} is not writable for phpbrew.";
             $msg[] = "Please consider using chmod or sudo: ";
             $msg[] = "    \$ sudo chmod -R og+rw {$confdir}";
             throw new Exception(join("\n", $msg));
         }
     }
 }
Example #5
0
 public function execute()
 {
     $root = Config::getPhpbrewRoot();
     $php = Config::getCurrentPhpName();
     $file = "{$root}/php/{$php}/etc/php.ini";
     Utils::editor($file);
 }
Example #6
0
 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.");
 }
Example #7
0
 public function execute()
 {
     $file = php_ini_loaded_file();
     if (!file_exists($file)) {
         $php = Config::getCurrentPhpName();
         $this->logger->warn("Sorry, I can't find the {$file} file for php {$php}.");
         return;
     }
     Utils::editor($file);
 }
Example #8
0
 protected function detectProcessorNumberByGrep()
 {
     if (Utils::findBin('grep') && file_exists('/proc/cpuinfo')) {
         $process = new Process('grep -c ^processor /proc/cpuinfo 2>/dev/null');
         $process->run();
         $this->processorNumber = intval($process->getOutput());
         return $this->processorNumber;
     }
     return null;
 }
Example #9
0
 public function purgeExtension(Extension $ext)
 {
     if ($sourceDir = $ext->getSourceDirectory()) {
         $currentPhpExtensionDirectory = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext';
         $extName = $ext->getExtensionName();
         $extensionDir = $currentPhpExtensionDirectory . DIRECTORY_SEPARATOR . $extName;
         if (file_exists($extensionDir)) {
             Utils::system("rm -rvf {$extensionDir}");
         }
     }
 }
Example #10
0
 /**
  * Construct a Build object,
  *
  * A build object contains the information of all build options, prefix, paths... etc
  *
  * @param string $version build version
  * @param string $name    build name
  * @param string $prefix  install prefix
  */
 public function __construct($version, $name = null, $installPrefix = null)
 {
     $this->version = $version;
     $this->name = $name ? $name : Utils::canonicalizeBuildName($version);
     if ($installPrefix) {
         $this->setInstallPrefix($installPrefix);
     } else {
         // TODO: find the install prefix automatically
     }
     $this->setBuildSettings(new BuildSettings());
 }
Example #11
0
 public function execute()
 {
     if ($this->options->{'php'} !== null) {
         $php = Utils::findLatestPhpVersion($this->options->{'php'});
     } else {
         $php = Config::getCurrentPhpName();
     }
     $buildDir = Config::getBuildDir();
     $extDir = $buildDir . DIRECTORY_SEPARATOR . $php . DIRECTORY_SEPARATOR . 'ext';
     // listing all local extensions
     if (version_compare('php-' . phpversion(), $php, '==')) {
         $loaded = array_map('strtolower', get_loaded_extensions());
     } else {
         $this->logger->info('PHP version is different from current active version.');
         $this->logger->info('Only available extensions are listed.');
         $this->logger->info('You will not see which of them are loaded.');
         $loaded = array();
     }
     // list for extensions which are not enabled
     $extensions = array();
     if (is_dir($extDir)) {
         $fp = opendir($extDir);
         if ($fp !== false) {
             while ($file = readdir($fp)) {
                 if ($file === '.' || $file === '..') {
                     continue;
                 }
                 if (is_file($extDir . '/' . $file)) {
                     continue;
                 }
                 $n = strtolower(preg_replace('#-[\\d\\.]+$#', '', $file));
                 if (in_array($n, $loaded)) {
                     continue;
                 }
                 $extensions[] = $n;
             }
             sort($loaded);
             sort($extensions);
             closedir($fp);
         }
     }
     $this->logger->info('Loaded extensions:');
     foreach ($loaded as $ext) {
         $this->logger->info("  [*] {$ext}");
     }
     $this->logger->info('Available extensions:');
     foreach ($extensions as $ext) {
         $this->logger->info("  [ ] {$ext}");
     }
 }
Example #12
0
 private function make($path, $target = 'all')
 {
     if (!file_exists($path . DIRECTORY_SEPARATOR . 'Makefile')) {
         $this->logger->error("Makefile not found in path {$path}");
         return false;
     }
     $cmd = array("make", "-C", $path, $this->isQuiet() ? "--quiet" : "", $target);
     if (!$this->logger->isDebug() && $this->buildLogPath) {
         $cmd[] = " >> {$this->buildLogPath} 2>&1";
     }
     $this->logger->info("===> Running make {$target}: " . join(' ', $cmd));
     $ret = Utils::system($cmd, $this->logger);
     return $ret == 0;
 }
Example #13
0
 public function configure()
 {
     // avoid warnings when web scraping possible malformed HTML from pecl
     if (extension_loaded('libxml')) {
         libxml_use_internal_errors(true);
     }
     // prevent execution time limit fatal error
     set_time_limit(0);
     // prevent warnings when timezone is not set
     date_default_timezone_set(Utils::readTimeZone() ?: 'America/Los_Angeles');
     // fix bold output so it looks good on light and dark terminals
     $this->getFormatter()->addStyle('bold', array('bold' => 1));
     $this->logger->levelStyles['warn'] = 'yellow';
     $this->logger->levelStyles['error'] = 'red';
 }
Example #14
0
 public function execute($buildName)
 {
     $prefix = Config::getVersionInstallPrefix($buildName);
     if (!file_exists($prefix)) {
         throw new Exception("{$prefix} does not exist.");
     }
     $prompter = new \CLIFramework\Prompter();
     $answer = $prompter->ask("Are you sure to delete {$buildName}?", array('Y', 'n'), 'Y');
     if (strtolower($answer) == "y") {
         Utils::recursive_unlink($prefix, $this->logger);
         $this->logger->info("{$buildName} is removed.  I hope you're not surprised. :)");
     } else {
         $this->logger->info("Let me guess, you drunk tonight.");
     }
 }
Example #15
0
 public function execute($extensionName)
 {
     $ext = ExtensionFactory::lookup($extensionName);
     if (!$ext) {
         return $this->error("Extension {$extensionName} not found.");
     }
     $file = $ext->getConfigFilePath();
     $this->logger->info("Looking for {$file} file...");
     if (!file_exists($file)) {
         $file .= '.disabled';
         // try with ini.disabled file
         $this->logger->info("Looking for {$file} file...");
         if (!file_exists($file)) {
             $this->logger->warn("Sorry, I can't find the ini file for the requested extension: \"{$extensionName}\".");
             return;
         }
     }
     Utils::editor($file);
 }
Example #16
0
 public function execute($version)
 {
     $buildDir = Config::getBuildDir() . DIRECTORY_SEPARATOR . $version;
     if ($this->options->all) {
         if (!file_exists($buildDir)) {
             $this->logger->info("Source directory " . $buildDir . " does not exist.");
         } else {
             $this->logger->info("Source directory " . $buildDir . " found, deleting...");
             Utils::recursive_unlink($buildDir, $this->logger);
         }
     } else {
         $make = new MakeTask($this->logger);
         $make->setQuiet();
         $build = new Build($version);
         $build->setSourceDirectory($buildDir);
         if ($make->clean($build)) {
             $this->logger->info("Distribution is cleaned up. Woof! ");
         }
     }
 }
Example #17
0
    public function patch($build, $options)
    {
        $this->logger->info('===> Applying patch - apxs2 module version name ...');
        if ($options->dryrun) {
            return;
        }
        // patch for libphp$(PHP_MAJOR_VERSION).so
        $patch = <<<'EOS'
perl -i.bak -pe 's#
libphp\$\(PHP_MAJOR_VERSION\)\.#libphp\$\(PHP_VERSION\)\.#gx' configure Makefile.global
EOS;
        Utils::system($patch) !== false or die('apxs2 patch failed.');
        $patch = <<<'EOS'
perl -i.bak -pe 's#
libs/libphp\$PHP_MAJOR_VERSION\.
#libs/libphp\$PHP_VERSION\.#gx' configure Makefile.global
EOS;
        Utils::system($patch) !== false or die('apxs2 patch failed.');
        // replace .so files
        $patch = <<<'EOS'
perl -i.bak -pe 's#
libs/libphp5.so
#libs/libphp\$PHP_VERSION\.so#gx' configure Makefile.global
EOS;
        Utils::system($patch) !== false or die('apxs2 patch failed.');
        // patch for OVERALL_TARGET=libphp$PHP_MAJOR_VERSION.la
        // libphp$(PHP_VERSION).la:
        // replace .la files
        $patch = <<<'EOS'
perl -i.bak -pe 's#
libs/libphp5.la
#libs/libphp\$PHP_VERSION\.la#gx' configure Makefile.global
EOS;
        Utils::system($patch) !== false or die('apxs2 patch failed.');
        $patch = <<<'EOS'
perl -i.bak -pe 's#
libphp\$PHP_MAJOR_VERSION\.#libphp\$PHP_VERSION\.#gx' configure Makefile.global
EOS;
        Utils::system($patch) !== false or die('apxs2 patch failed.');
    }
Example #18
0
 /**
  * @param Buildable $build can be PeclExtension or Build object.
  */
 private function make($path, $target = 'all', $build = null)
 {
     if (!file_exists($path . DIRECTORY_SEPARATOR . 'Makefile')) {
         $this->logger->error("Makefile not found in path {$path}");
         return false;
     }
     // FreeBSD make doesn't support --quiet option
     // We should prefer GNU make instead of BSD make.
     // @see https://github.com/phpbrew/phpbrew/issues/529
     $gmake = Utils::findBin('gmake');
     $make = null;
     if (!$gmake) {
         $make = Utils::findBin('make');
         if ($make && $this->isGNUMake($make)) {
             $gmake = $make;
         }
     }
     // Prefer 'gmake' rather than 'make'
     $cmd = array($gmake ?: $make, '-C', escapeshellarg($path));
     if ($this->isQuiet()) {
         if ($gmake) {
             $cmd[] = '--quiet';
         } else {
             // make may be a link to gmake, we should prevent that.
             // append '-Q' only when we're really sure it is BSD make.
             if (php_uname('s') === 'FreeBSD') {
                 $cmd[] = '-Q';
             }
         }
     }
     $cmd[] = escapeshellarg($target);
     if (!$this->logger->isDebug() && $this->buildLogPath) {
         $cmd[] = ' >> ' . escapeshellarg($this->buildLogPath) . ' 2>&1';
     }
     $this->logger->info("===> Running make {$target}: " . implode(' ', $cmd));
     return Utils::system($cmd, $this->logger, $build) === 0;
 }
Example #19
0
 public function testFindLatestPhpVersion()
 {
     $this->markTestSkipped("We should use a virtual file system here (vsfStream)");
     $buildDir = Config::getBuildDir();
     $paths = array();
     $paths[] = $buildDir . DIRECTORY_SEPARATOR . 'php-12.3.4';
     $paths[] = $buildDir . DIRECTORY_SEPARATOR . 'php-12.3.6';
     // Create paths
     foreach ($paths as $path) {
         if (!is_dir($path)) {
             mkdir($path);
         }
     }
     is('12.3.6', Utils::findLatestPhpVersion('12'));
     is('12.3.6', Utils::findLatestPhpVersion('12.3'));
     is('12.3.4', Utils::findLatestPhpVersion('12.3.4'));
     is(false, Utils::findLatestPhpVersion('11'));
     // Cleanup paths
     foreach ($paths as $path) {
         if (is_dir($path)) {
             rmdir($path);
         }
     }
 }
Example #20
0
 public function check(Build $build)
 {
     $apxs = $build->getVariant('apxs2');
     if (!$apxs) {
         $apxs = Utils::findbin('apxs');
     }
     $this->logger->debug("Found apxs2 sbin: {$apxs}");
     // use apxs to check module dir permission
     if ($apxs && ($libdir = trim(Utils::pipeExecute("{$apxs} -q LIBEXECDIR")))) {
         if (false === is_writable($libdir)) {
             $msg = array();
             throw new Exception("Apache module dir {$libdir} is not writable.\nPlease consider using chmod or sudo.");
         }
     }
     if ($apxs && ($confdir = trim(Utils::pipeExecute("{$apxs} -q SYSCONFDIR")))) {
         if (false === is_writable($confdir)) {
             $msg = array();
             $msg[] = "Apache conf dir {$confdir} is not writable for phpbrew.";
             $msg[] = "Please consider using chmod or sudo: ";
             $msg[] = "    \$ sudo chmod -R og+rw {$confdir}";
             throw new Exception(join("\n", $msg));
         }
     }
 }
Example #21
0
 public function execute($extName, $version = 'stable')
 {
     if ((preg_match('#^git://#', $extName) || preg_match('#\\.git$#', $extName)) && !preg_match("#github|bitbucket#", $extName)) {
         $pathinfo = pathinfo($extName);
         $repoUrl = $extName;
         $extName = $pathinfo['filename'];
         $extDir = Config::getBuildDir() . DIRECTORY_SEPARATOR . Config::getCurrentPhpName() . DIRECTORY_SEPARATOR . 'ext' . DIRECTORY_SEPARATOR . $extName;
         if (!file_exists($extDir)) {
             passthru("git clone {$repoUrl} {$extDir}", $ret);
             if ($ret != 0) {
                 return $this->logger->error('Clone failed.');
             }
         }
     }
     $extensions = array();
     if (Utils::startsWith($extName, '+')) {
         $config = Config::getConfigParam('extensions');
         $extName = ltrim($extName, '+');
         if (isset($config[$extName])) {
             foreach ($config[$extName] as $extensionName => $extOptions) {
                 $args = explode(' ', $extOptions);
                 $extensions[$extensionName] = $this->getExtConfig($args);
             }
         } else {
             $this->logger->info('Extension set name not found. Have you configured it at the config.yaml file?');
         }
     } else {
         $args = array_slice(func_get_args(), 1);
         $extensions[$extName] = $this->getExtConfig($args);
     }
     $extensionList = new ExtensionList();
     $manager = new ExtensionManager($this->logger);
     foreach ($extensions as $extensionName => $extConfig) {
         $provider = $extensionList->exists($extensionName);
         if (!$provider) {
             throw new Exception("Could not find provider for {$extensionName}.");
         }
         $extensionName = $provider->getPackageName();
         $ext = ExtensionFactory::lookupRecursive($extensionName);
         $always_redownload = $this->options->{'pecl'} || $this->options->{'redownload'} || !$provider->isBundled($extensionName);
         // Extension not found, use pecl to download it.
         if (!$ext || $always_redownload) {
             // not every project has stable branch, using master as default version
             $args = array_slice(func_get_args(), 1);
             if (!isset($args[0]) || $args[0] != $extConfig->version) {
                 $extConfig->version = $provider->getDefaultVersion();
             }
             $extensionDownloader = new ExtensionDownloader($this->logger, $this->options);
             $extensionDownloader->download($provider, $extConfig->version);
             // Reload the extension
             if ($provider->shouldLookupRecursive()) {
                 $ext = ExtensionFactory::lookupRecursive($extensionName);
             } else {
                 $ext = ExtensionFactory::lookup($extensionName);
             }
             if ($ext) {
                 $extensionDownloader->renameSourceDirectory($ext);
             }
         }
         if (!$ext) {
             throw new Exception("{$extensionName} not found.");
         }
         $manager->installExtension($ext, $extConfig->options);
     }
 }
Example #22
0
 /**
  * Build variants to configure options from php build object.
  *
  * @param Build $build The build object, contains version information
  *
  * @return array|void
  * @throws \Exception
  */
 public function build(Build $build)
 {
     $customVirtualVariants = Config::getConfigParam('variants');
     foreach (array_keys($build->getVariants()) as $variantName) {
         if (isset($customVirtualVariants[$variantName])) {
             foreach ($customVirtualVariants[$variantName] as $lib => $params) {
                 if (is_array($params)) {
                     $this->variants[$lib] = $params;
                 }
             }
         }
     }
     // reset builtList
     $this->builtList = array();
     // reset built options
     if ($build->hasVariant('all') || $build->hasVariant('neutral')) {
         $this->options = array();
     } else {
         // build common options
         $this->options = array('--disable-all', '--enable-phar', '--enable-session', '--enable-short-tags', '--enable-tokenizer', '--with-pcre-regex');
         if ($prefix = Utils::findIncludePrefix('zlib.h')) {
             $this->addOptions('--with-zlib=' . $prefix);
         }
     }
     if ($prefix = Utils::findLibPrefix('x86_64-linux-gnu')) {
         $this->addOptions("--with-libdir=lib/x86_64-linux-gnu");
     } elseif ($prefix = Utils::findLibPrefix('i386-linux-gnu')) {
         $this->addOptions("--with-libdir=lib/i386-linux-gnu");
     }
     // enable/expand virtual variants
     foreach ($this->virtualVariants as $name => $variantNames) {
         if ($build->isEnabledVariant($name)) {
             foreach ($variantNames as $subVariantName) {
                 // enable the sub-variant only if it's not already enabled
                 // in order to not override a non-default value with the default
                 if (!$build->isEnabledVariant($subVariantName)) {
                     $build->enableVariant($subVariantName);
                 }
             }
             // it's a virtual variant, can not be built by buildVariant
             // method.
             $build->removeVariant($name);
         }
     }
     // Remove these enabled variant for disabled variants.
     $build->resolveVariants();
     // before we build these options from variants,
     // we need to check the enabled and disabled variants
     $this->checkConflicts($build);
     foreach ($build->getVariants() as $feature => $userValue) {
         if ($options = $this->buildVariant($build, $feature, $userValue)) {
             $this->addOptions($options);
         }
     }
     foreach ($build->getDisabledVariants() as $feature => $true) {
         if ($options = $this->buildDisableVariant($build, $feature)) {
             $this->addOptions($options);
         }
     }
     /*
     $opts = array_merge( $opts ,
         $this->getVersionSpecificOptions($version) );
     */
     $options = array_merge(array(), $this->options);
     // reset options
     $this->options = array();
     return $options;
 }
Example #23
0
 public function __construct()
 {
     $this->bin = Utils::findBin('brew');
 }
Example #24
0
 public function testFindbin()
 {
     ok(Utils::findBin('ls'));
     ok(Utils::findBin('psql'));
 }
Example #25
0
 public function getOSVersion()
 {
     return Utils::system('sw_vers -productVersion');
 }
Example #26
0
 protected function detectBitness()
 {
     return intval(Utils::system('getconf LONG_BIT'));
 }
Example #27
0
 protected function isCurlCommandAvailable()
 {
     return Utils::findbin('curl');
 }
Example #28
0
 public function hasSupport($requireSsl)
 {
     return Utils::findbin('curl');
 }
Example #29
0
 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);
     }
 }
Example #30
0
 public function match($build)
 {
     $currentVersion = preg_replace('/[^\\d]*(\\d+).(\\d+).*/i', '$1.$2', $build->version);
     return Utils::support64bit() && version_compare($currentVersion, '5.3', '==');
 }