findIncludePrefix() public static method

public static findIncludePrefix ( )
Beispiel #1
0
 public function testPrefix()
 {
     $this->assertNotNull(Utils::findLibPrefix('icu/pkgdata.inc', 'icu/Makefile.inc'));
     $this->assertNotNull(Utils::findIncludePrefix('openssl/opensslv.h'));
 }
Beispiel #2
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;
 }
Beispiel #3
0
 public function testPrefix()
 {
     $this->assertNotNull(Utils::findIncludePrefix('openssl/opensslv.h'));
 }