Commit:    428f9cb070de3cd60f6dc99ace2ea3607b0df98d
Author:    Anatol Belski <[email protected]>         Thu, 17 Nov 2016 20:01:09 +0100
Parents:   83fd08e03965bd4b2feb7df777965936e9591bb7
Branches:  master

Link:       
http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=428f9cb070de3cd60f6dc99ace2ea3607b0df98d

Log:
Fix build object setup

No explicit vars are required with the new SDK, so LIB, INCLUDE, PATH
are used right away.

Changed paths:
  M  include/BuildVC.php
  M  include/PeclBuildVC.php


Diff:
diff --git a/include/BuildVC.php b/include/BuildVC.php
index 02e7b02..6efd7ae 100644
--- a/include/BuildVC.php
+++ b/include/BuildVC.php
@@ -29,6 +29,7 @@ class BuildVC {
 
        function __construct(Branch $branch, $build_name)
        {
+               /* XXX this has to be merged with PeclBuildVC and any other, be 
it per trait or inheritance. */
                $build_dir = $branch->config->getBuildDir();
                if (!file_exists($build_dir)) {
                        throw new \Exception("Directory '$build_dir' doesn't 
exist");
@@ -40,41 +41,27 @@ class BuildVC {
                $this->compiler = $this->branch->config->getCompiler();
                $this->architecture = $this->branch->config->getArchitecture();
 
-               $vc_env_prefix = strtoupper($this->compiler);
-               if ($this->architecture == 'x64') {
-                       $vc_env_prefix .= '_X64_';
-               } else {
-                       $vc_env_prefix .= '_';
+               $sdk_arch = getenv("PHP_SDK_ARCH");
+               if (strtolower($this->architecture) != strtolower($sdk_arch)) {
+                       throw new \Exception("Arch mismatch. PHP SDK is 
configured for '$sdk_arch', while the current RMTOOLS config targets 
'{$this->architecture}'");
                }
 
-               $path = getenv($vc_env_prefix . 'PATH');
-               if (empty($path)) {
-                       /* TODO check all the other things */
-                       throw new \Exception("Compiler environment couldn't be 
determined");
-                       //include __DIR__ . '/../data/config.php';
-                       /* use default config */
-                       //$env = $custom_env;
-               } else {
-                       $env = array();
-                       $env['PATH'] = getenv($vc_env_prefix . 'PATH') . ';' . 
getenv('PATH') ;
-                       $env['INCLUDE'] = getenv($vc_env_prefix . 'INCLUDE');
-                       $env['LIB'] = getenv($vc_env_prefix . 'LIB');
+               $sdk_vc = getenv("PHP_SDK_VC");
+               if (strtolower($this->compiler) != strtolower($sdk_vc)) {
+                       throw new \Exception("Compiler mismatch. PHP SDK is 
configured for '$sdk_vc', while the current RMTOOLS config targets 
'{$this->compiler}'");
                }
 
-               /* We don't support anymore VC6, so calling these scripts from 
the
-                  SDK are just fine */
-               if (!$env['INCLUDE'] || !$env['LIB']) {
-                       $env['INCLUDE'] = getenv('INCLUDE');
-                       $env['LIB'] = getenv('LIB');
-               }
+               $env = array();
+               $env['PATH'] = getenv('PATH') ;
+               $env['INCLUDE'] = getenv('INCLUDE');
+               $env['LIB'] = getenv('LIB');
 
                $env['TMP'] = $env['TEMP'] = getenv('TEMP');
                $env['SystemDrive'] = getenv('SystemDrive');
                $env['SystemRoot'] = getenv('SystemRoot');
-               if (!isset($env['BISON_SIMPLE'])) {
-                       $env['BISON_SIMPLE'] = getenv('BISON_SIMPLE');
-               }
 
+               /* XXX Not sure, in how far the below is needed. */
+               /*
                $env['CPU'] = "i386";
                $env['APPVER'] = "5.01";  // setenv /xp
                if (strcasecmp($this->architecture, 'x64') == 0) {
@@ -83,6 +70,7 @@ class BuildVC {
                if (strcmp($branch->config->getAppver(), '2008') == 0) {
                        $env['APPVER'] = "6.0";
                }
+                */
                if ($branch->config->getDebug() == 0) {
                        $env['NODEBUG'] = "1";
                }
diff --git a/include/PeclBuildVC.php b/include/PeclBuildVC.php
index 3f875ad..7a760d9 100644
--- a/include/PeclBuildVC.php
+++ b/include/PeclBuildVC.php
@@ -30,6 +30,7 @@ class PeclBuildVC {
 
        function __construct(PeclBranch $branch, $build_name)
        {
+               /* XXX eliminate code duplication with BuildVC*/
                $build_dir = $branch->config->getBuildDir();
                if (!file_exists($build_dir)) {
                        throw new \Exception("Directory '$build_dir' doesn't 
exist");
@@ -42,39 +43,27 @@ class PeclBuildVC {
                $this->architecture = 
$branch->config->builds[$build_name]['arch'];
                $this->thread_safe = 
(boolean)$branch->config->builds[$build_name]['thread_safe'];
 
-               $vc_env_prefix = strtoupper($this->compiler);
-               if ($this->architecture == 'x64') {
-                       $vc_env_prefix .= '_X64_';
-               } else {
-                       $vc_env_prefix .= '_';
+               $sdk_arch = getenv("PHP_SDK_ARCH");
+               if (strtolower($this->architecture) != strtolower($sdk_arch)) {
+                       throw new \Exception("Arch mismatch. PHP SDK is 
configured for '$sdk_arch', while the current RMTOOLS config targets 
'{$this->architecture}'");
                }
 
-               $path = getenv($vc_env_prefix . 'PATH');
-               if (empty($path)) {
-                       include __DIR__ . '/../data/config.php';
-                       /* use default config */
-                       $env = $custom_env;
-               } else {
-                       $env = array();
-                       $env['PATH'] = getenv($vc_env_prefix . 'PATH') . ';' . 
getenv('PATH') ;
-                       $env['INCLUDE'] = getenv($vc_env_prefix . 'INCLUDE');
-                       $env['LIB'] = getenv($vc_env_prefix . 'LIB');
+               $sdk_vc = getenv("PHP_SDK_VC");
+               if (strtolower($this->compiler) != strtolower($sdk_vc)) {
+                       throw new \Exception("Compiler mismatch. PHP SDK is 
configured for '$sdk_vc', while the current RMTOOLS config targets 
'{$this->compiler}'");
                }
 
-               /* We don't support anymore VC6, so calling these scripts from 
the
-                  SDK are just fine */
-               if (!$env['INCLUDE'] || !$env['LIB']) {
-                       $env['INCLUDE'] = getenv('INCLUDE');
-                       $env['LIB'] = getenv('LIB');
-               }
+               $env = array();
+               $env['PATH'] = getenv('PATH') ;
+               $env['INCLUDE'] = getenv('INCLUDE');
+               $env['LIB'] = getenv('LIB');
 
                $env['TMP'] = $env['TEMP'] = getenv('TEMP');
                $env['SystemDrive'] = getenv('SystemDrive');
                $env['SystemRoot'] = getenv('SystemRoot');
-               if (!isset($env['BISON_SIMPLE'])) {
-                       $env['BISON_SIMPLE'] = getenv('BISON_SIMPLE');
-               }
 
+               /* XXX Not sure, in how far the below is needed. */
+               /*
                $env['CPU'] = "i386";
                $env['APPVER'] = "5.01";  // setenv /xp
                if (strcasecmp($this->architecture, 'x64') == 0) {
@@ -83,6 +72,7 @@ class PeclBuildVC {
                if (strcmp($branch->config->getAppver(), '2008') == 0) {
                        $env['APPVER'] = "6.0";
                }
+                */
                if ($branch->config->getDebug() == 0) {
                        $env['NODEBUG'] = "1";
                }


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to