com web/rmtools: rudimentary preparation to build pecl exts: client/bin/pecl.bat client/data/config/pecl/pecl53.ini client/data/config/pecl/pecl54.ini
client/data/config/pecl/pecl55.ini client/data/config/pecl/pecltrunk.ini client/include/BranchConfig.php client/include/PeclBranch.php
client/include/PeclBuildVC.php client/script/pecl.php

From: Date: Fri, 30 Aug 2013 05:59:49 +0000
Subject: com web/rmtools: rudimentary preparation to build pecl exts: client/bin/pecl.bat client/data/config/pecl/pecl53.ini client/data/config/pecl/pecl54.ini
client/data/config/pecl/pecl55.ini client/data/config/pecl/pecltrunk.ini client/include/BranchConfig.php client/include/PeclBranch.php
client/include/PeclBuildVC.php client/script/pecl.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-16731@lists.php.net to get a copy of this message
Commit: c17d9eb229c1ae5c7dc1e128ac1478e448d03599 Author: Anatol Belski <ab@php.net> Fri, 30 Aug 2013 07:59:49 +0200 Parents: 2bbb78813877523c3c5e24a7439dd6ab2ea5d493 Branches: master Link: http://git.php.net/?p=web/rmtools.git;a=commitdiff;h=c17d9eb229c1ae5c7dc1e128ac1478e448d03599 Log: rudimentary preparation to build pecl exts for now we can work with a fixed source tree path, todos - read the tarballs from the given dir - extract and copy each one into the php-src/ext - check some minimal stuff for the ext, like whether it's enable/with option - check for the lib deps (can be ommited for now) - build with php - pack dll and pdb to some out dir (both ext and possible deps) - push to the ftp server Changed paths: A client/bin/pecl.bat A client/data/config/pecl/pecl53.ini A client/data/config/pecl/pecl54.ini A client/data/config/pecl/pecl55.ini A client/data/config/pecl/pecltrunk.ini M client/include/BranchConfig.php A client/include/PeclBranch.php A client/include/PeclBuildVC.php A client/script/pecl.php

diff --git a/client/bin/pecl.bat b/client/bin/pecl.bat new file mode 100644 index 0000000..51ed9e9 --- /dev/null +++ b/client/bin/pecl.bat @@ -0,0 +1,84 @@ +@ECHO OFF +SET BAT_DIR=%~dp0 + +set yyyy=%date:~6,4% +set mm=%date:~3,2% +set dd=%date:~0,2% + +set hh=%time:~0,2% +if %hh% lss 10 (set hh=0%time:~1,1%) +set nn=%time:~3,2% +set ss=%time:~6,2% +set cur_date=%yyyy%%mm%%dd%-%hh%%nn%%ss% + +set LOG_FILE=c:\php-sdk\logs\task-pecl-%cur_date%.log +set RMTOOLS_BASE_DIR=c:\php-sdk\rmtools-client + +IF EXIST c:\php-sdk\locks\pecl.lock ( +ECHO Snapshot script is already running. +GOTO EXIT_LOCKED +) + +ECHO running > c:\php-sdk\locks\pecl.lock + +CALL c:\php-sdk\bin\phpsdk_setvars.bat + +copy c:\php-sdk\rmtools.base\data\config\credentials_ftps.php %RMTOOLS_BASE_DIR%\data\config\ >> %LOG_FILE% 2<&1 + +REM VC9 Support +SET PSDK_61_DIR=C:\Program Files\Microsoft SDKs\Windows\v6.1 +SET VC9_DIR=C:\Program Files (x86)\Microsoft Visual Studio 9.0 +SET VC9_SHELL=C:\WINDOWS\system32\cmd.exe /E:ON /V:ON /T:0E /K "C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\SetEnv.Cmd" +SET VC9_INCLUDE=%PSDK_61_DIR%\include;%VC9_DIR%\VC\ATLMFC\INCLUDE;%VC9_DIR%\VC\INCLUDE +SET VC9_LIB=%PSDK_61_DIR%\lib;%VC9_DIR%\VC\ATLMFC\LIB;%VC9_DIR%\VC\LIB +SET VC9_PATH=%VC9_DIR%\Common7\IDE;%VC9_DIR%\VC\BIN;%VC9_DIR%\Common7\Tools;%VC9_DIR%\VC\VCPackages;%PSDK_61_DIR%\bin;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem +SET VC9_X64_INCLUDE=%VC9_DIR%\VC\Include;C:\Program Files\Microsoft SDKs\Windows\v6.1\Include;C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\gl;%VC9_DIR%VC\ATLMFC\INCLUDE; +SET VC9_X64_LIB=%VC9_DIR%\VC\Lib\amd64;C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib\x64;%VC9_DIR%\VC\ATLMFC\LIB\AMD64; +SET VC9_X64_PATH=%VC9_DIR%\VC\Bin\x86_amd64;%VC9_DIR%\VC\Bin;%VC9_DIR%\VC\vcpackages;%VC9_DIR%\Common7\IDE;C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin;C:\WINDOWS\Microsoft.NET\Framework64\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Perl\site\bin;C:\Perl\bin;C:\Program Files\PHP\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\win2k3cd;C:\Program Files\cvsnt;C:\Program Files\WinSCP\;C:\Program Files\CVSNT\ +SET OLD_PATH=%PATH% +SET PATH=%PATH%;%VC9_PATH% +SET LIB=%VC9_LIB% +SET INCLUDE=%VC9_INCLUDE% + +REM VC11 Support +SET VC11_SHELL=%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"" x86 +SET PSDK_80_DIR=C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0 + +SET VC11_DIR=C:\Program Files (x86)\Microsoft Visual Studio 11.0 +SET VC11_INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.0\include\shared;C:\Program Files (x86)\Windows Kits\8.0\include\um;C:\Program Files (x86)\Windows Kits\8.0\include\winrt; +SET VC11_LIB=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB;C:\Program Files (x86)\Windows Kits\8.0\lib\win8\um\x86; +SET LIBPATH=C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB;C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.VCLibs\11.0\References\CommonConfiguration\neutral; +SET INCLUDE=%VC11_INCLUDE% +SET LIB=%VC11_LIB% + +SET VCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ +SET VisualStudioVersion=11.0 +SET VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\ +SET VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 11.0\ +SET DevEnvDir=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ +SET ExtensionSdkDir=C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs +SET WindowsSdkDir=C:\Program Files (x86)\Windows Kits\8.0\ +SET WindowsSdkDir_35=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ +SET WindowsSdkDir_old=C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\ + +SET VC11_PATH=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft SDKs\F#\3.0\Framework\v4.0\;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VSTSDB\Deploy;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Windows\Microsoft.NET\Framework\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\VCPackages;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools;C:\Program Files (x86)\Windows Kits\8.0\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET WebPages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\ +SET OLD_PATH=%PATH% +SET PATH=%PATH%;%VC11_PATH% + +SET VC11_X64_PATH=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows\Microsoft.NET\Framework64\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools;C:\Program Files (x86)\HTML Help Workshop;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools\x64;C:\Program Files (x86)\Microsoft Visual Studio 11.0\Team Tools\Performance Tools;C:\Program Files (x86)\Windows Kits\8.0\bin\x64;C:\Program Files (x86)\Windows Kits\8.0\bin\x86;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\x64;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX4.0 Tools;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\ +SET VC11_X64_INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows Kits\8.0\include\shared;C:\Program Files (x86)\Windows Kits\8.0\include\um;C:\Program Files (x86)\Windows Kits\8.0\include\winrt; +SET VC11_X64_LIB=C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB\amd64;C:\Program Files (x86)\Windows Kits\8.0\lib\win8\um\x64; +SET VC11_X64_LIBPATH=C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\Windows\Microsoft.NET\Framework64\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\ATLMFC\LIB\amd64;C:\Program Files (x86)\Windows Kits\8.0\References\CommonConfiguration\Neutral;C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\Microsoft.VCLibs\11.0\References\CommonConfiguration\neutral; +SET VC11_X64_SHELL=%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"" amd64 + +REM Run pecl.php +SET BISON_SIMPLE=c:\php-sdk\bin\bison.simple +c:\php-sdk\php\php.exe -d extension_dir=c:\php-sdk\php\ext -d extension=php_openssl.dll -d extension=php_curl.dll %BAT_DIR%\..\script\pecl.php pecl53 C:\pecl_in_pkg\dio-0.0.7.tgz +SET PATH=%OLD_PATH% + +echo Done.>> %LOG_FILE% + +del c:\php-sdk\locks\pecl.lock >> %LOG_FILE% 2<&1 + +:EXIT_LOCKED +echo . diff --git a/client/data/config/pecl/pecl53.ini b/client/data/config/pecl/pecl53.ini new file mode 100644 index 0000000..0e75604 --- /dev/null +++ b/client/data/config/pecl/pecl53.ini @@ -0,0 +1,24 @@ +name=php-5.3 +branch=5.3 +build_dir=c:/obj +build_src_subdir=php-5.3.27-src +build_location=c:/php-sdk/php53/vc9/x86/ +appver=xp +debug=0 +pgo=0 + +[build-nts-windows-vc9-x86] +name=nts-windows-vc9-x86 +compiler=vc9 +arch=x86 +thread_safe=0 +configure_options=--enable-snapshot-build --disable-zts --disable-isapi --enable-debug-pack --disable-isapi --without-mssql --without-pdo-mssql --without-pi3web --enable-com-dotnet --with-mcrypt=static --disable-static-analyze +platform=windows + +[build-ts-windows-vc9-x86] +name=ts-windows-vc9-x86 +compiler=vc9 +arch=x86 +thread_safe=1 +configure_options=--enable-snapshot-build --disable-isapi --enable-debug-pack --without-mssql --without-pdo-mssql --without-pi3web --enable-com-dotnet --with-mcrypt=static --disable-static-analyze +platform=windows diff --git a/client/data/config/pecl/pecl54.ini b/client/data/config/pecl/pecl54.ini new file mode 100644 index 0000000..19f1f62 --- /dev/null +++ b/client/data/config/pecl/pecl54.ini @@ -0,0 +1,24 @@ +name=php-5.4 +branch=5.4 +repo_name=phpnet +repo_module=php-src.git +repo_branch=refs/heads/PHP-5.4 +build_dir=c:/obj +build_location=c:/php-sdk/snap_5_4/vc9/x86/ +appver=xp +debug=0 +pgo=1 + +[build-nts-windows-vc9-x86] +name=nts-windows-vc9-x86 +compiler=vc9 +arch=x86 +configure_options=--enable-snapshot-build --disable-zts --disable-isapi --enable-debug-pack --disable-nsapi --without-mssql --without-pdo-mssql --without-pi3web --with-pdo-oci=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8-11g=c:\php-sdk\oracle\instantclient11\sdk,shared --enable-com-dotnet=shared --with-mcrypt=static --disable-static-analyze +platform=windows + +[build-ts-windows-vc9-x86] +name=ts-windows-vc9-x86 +compiler=vc9 +arch=x86 +configure_options=--enable-snapshot-build --disable-isapi --enable-debug-pack --disable-nsapi --without-mssql --without-pdo-mssql --without-pi3web --with-pdo-oci=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8-11g=c:\php-sdk\oracle\instantclient11\sdk,shared --enable-com-dotnet=shared --with-mcrypt=static --disable-static-analyze +platform=windows \ No newline at end of file diff --git a/client/data/config/pecl/pecl55.ini b/client/data/config/pecl/pecl55.ini new file mode 100644 index 0000000..c77f163 --- /dev/null +++ b/client/data/config/pecl/pecl55.ini @@ -0,0 +1,26 @@ +name=php-5.5 +branch=5.5 +repo_name=phpnet +repo_module=php-src.git +repo_branch=refs/heads/PHP-5.5 +build_dir=c:/obj +build_location=c:/php-sdk/snap_5_5/vc11/x86/ +appver=2008 +debug=0 +pgo=1 +compiler=vc11 +arch=x86 + +[build-nts-windows-vc11-x86] +name=nts-windows-vc11-x86 +compiler=vc11 +arch=x86 +configure_options=--enable-snapshot-build --disable-zts --disable-isapi --enable-debug-pack --disable-nsapi --without-mssql --without-pdo-mssql --without-pi3web --with-pdo-oci=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8-11g=c:\php-sdk\oracle\instantclient11\sdk,shared --enable-com-dotnet=shared --with-mcrypt=static --disable-static-analyze +platform=windows + +[build-ts-windows-vc11-x86] +name=ts-windows-vc11-x86 +compiler=vc11 +arch=x86 +configure_options=--enable-snapshot-build --disable-isapi --enable-debug-pack --disable-nsapi --without-mssql --without-pdo-mssql --without-pi3web --with-pdo-oci=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8-11g=c:\php-sdk\oracle\instantclient11\sdk,shared --enable-com-dotnet=shared --with-mcrypt=static --disable-static-analyze +platform=windows \ No newline at end of file diff --git a/client/data/config/pecl/pecltrunk.ini b/client/data/config/pecl/pecltrunk.ini new file mode 100644 index 0000000..27ad369 --- /dev/null +++ b/client/data/config/pecl/pecltrunk.ini @@ -0,0 +1,24 @@ +name=master +branch=master +repo_name=phpnet +repo_module=php-src.git +repo_branch=refs/heads/master +build_dir=c:/obj +build_location=c:/php-sdk/trunk/vc9/x86/ +appver=2008 +debug=0 +pgo=1 + +[build-nts-windows-vc9-x86] +name=nts-windows-vc9-x86 +compiler=vc9 +arch=x86 +configure_options=--enable-snapshot-build --disable-zts --disable-isapi --enable-debug-pack --disable-nsapi --without-mssql --without-pdo-mssql --without-pi3web --with-pdo-oci=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8-11g=c:\php-sdk\oracle\instantclient11\sdk,shared --enable-com-dotnet=shared --with-mcrypt=static --disable-static-analyze +platform=windows + +[build-ts-windows-vc9-x86] +name=ts-windows-vc9-x86 +compiler=vc9 +arch=x86 +configure_options=--enable-snapshot-build --disable-isapi --enable-debug-pack --disable-nsapi --without-mssql --without-pdo-mssql --without-pi3web --with-pdo-oci=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8=c:\php-sdk\oracle\instantclient10\sdk,shared --with-oci8-11g=c:\php-sdk\oracle\instantclient11\sdk,shared --enable-com-dotnet=shared --with-mcrypt=static --disable-static-analyze +platform=windows diff --git a/client/include/BranchConfig.php b/client/include/BranchConfig.php index a221e74..39ee88f 100644 --- a/client/include/BranchConfig.php +++ b/client/include/BranchConfig.php @@ -21,6 +21,7 @@ class BranchConfig { 'PGO' => 'pgo', 'Debug' => 'debug', 'Appver' => 'appver', + 'BuildSrcSubdir' => 'build_src_subdir', ); function __construct($path) diff --git a/client/include/PeclBranch.php b/client/include/PeclBranch.php new file mode 100644 index 0000000..a79ba57 --- /dev/null +++ b/client/include/PeclBranch.php @@ -0,0 +1,109 @@ +<?php +namespace rmtools; + +include __DIR__ . '/PeclBuildVC.php'; + +/* Primitive branch which maps to some unversioned local source tree. It'll not care about any revisions, etc. */ +class PeclBranch { + public $config; + public $builds; + + public function __construct($config_path) + { + if (!is_readable($config_path)) { + throw new \Exception('Cannot open config data <' . $config_path . '>'); + } + $this->config = new BranchConfig($config_path); + $this->addBuildList(); + } + + private function addBuildList() + { + $builds = $this->config->getBuildList(); + + if (!empty($builds)) { + $this->builds = array(); + foreach ($builds as $n => $v) { + $this->builds[] = $n; + } + } else { + $this->builds = NULL; + } + } + + public function update() + { + // pass + } + + public function hasNewRevision() + { + return false; + } + + public function export($revision = false, $build_type = false, $zip = false, $is_zip = false) + { + // TODO + } + + public function createSourceSnap($build_type = false, $revision = false) + { + return $this->export($revision, $build_type, true); + } + + public function setLastRevisionExported($last_rev) + { + // pass + } + + public function getLastRevisionExported() + { + return NULL; + } + + public function getLastRevisionId() + { + return NULL; + } + + public function getPreviousRevision() + { + return NULL; + } + + function getBuildList($platform) + { + $builds = array(); + foreach ($this->builds as $build_name) { + $build = $this->config->getBuildFromName($build_name); + if (isset($build['platform']) && $build['platform'] == $platform) { + $builds[] = $build_name; + } + } + return $builds; + } + + function createBuildInstance($build_name) + { + $build = $this->config->getBuildFromName($build_name); + + if (!$build) { + throw new \Exception("Invalid build name <$build_name>"); + } + + $compiler = strtolower($build['compiler']); + switch ($compiler) { + case 'vc11': + case 'vc9': + case 'vc6': + $build = new PeclBuildVC($this, $build_name); + break; + case 'icc': + case 'gcc': + throw new \Exception("$compiler not supported yet. Not implemented"); + break; + } + + return $build; + } +} diff --git a/client/include/PeclBuildVC.php b/client/include/PeclBuildVC.php new file mode 100644 index 0000000..73c4eff --- /dev/null +++ b/client/include/PeclBuildVC.php @@ -0,0 +1,214 @@ +<?php +namespace rmtools; +include __DIR__ . '/BranchConfig.php'; +include __DIR__ . '/MakeLogParserVC.php'; + +class PeclBuildVC { + public $branch; + public $build_name; + public $env; + private $obj_dir; + private $build_dir; + protected $old_cwd; + public $logs = array(); + + public $archive_path = false; + public $debug_path = false; + public $devel_path = false; + public $test_path = false; + + public $compiler_log_parser; + public $stats; + public $log_buildconf; + public $log_configure; + public $log_make; + public $log_archive; + + public $zip_devel_filename; + public $zip_debug_filename; + public $zip_test_filename; + + function __construct(PeclBranch $branch, $build_name) + { + $this->branch = $branch; + $this->build_name = $build_name; + $this->obj_dir = $branch->config->getBuildDir() . '/' . $this->build_name; + $this->compiler = $branch->config->builds[$build_name]['compiler']; + $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 .= '_'; + } + + $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'); + } + + /* 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['TMP'] = $env['TEMP'] = getenv('TEMP'); + $env['SystemDrive'] = getenv('SystemDrive'); + $env['SystemRoot'] = getenv('SystemRoot'); + if (!isset($env['BISON_SIMPLE'])) { + $env['BISON_SIMPLE'] = getenv('BISON_SIMPLE'); + } + + $env['CPU'] = "i386"; + $env['APPVER'] = "5.01"; // setenv /xp + if (strcasecmp($this->architecture, 'x64') == 0) { + $env['CPU'] = "AMD64"; + } + if (strcmp($branch->config->getAppver(), '2008') == 0) { + $env['APPVER'] = "6.0"; + } + if ($branch->config->getDebug() == 0) { + $env['NODEBUG'] = "1"; + } + + $this->env = $env; + } + + function setSourceDir($src_dir) + { + $this->build_dir = $src_dir; + } + + private function addLogsToArchive() + { + $zip = new \ZipArchive(); + if ($zip->open($this->archive_path) === FALSE) { + throw new \Exception('cannot open archive'); + } + $zip->addFromString('logs\buildconf.txt', $this->log_buildconf); + $zip->addFromString('logs\configure.txt', $this->log_configure); + $zip->addFromString('logs\make.txt', $this->log_make); + $zip->addFromString('logs\archive.txt', $this->log_archive); + $zip->close(); + } + + function buildconf() + { + $cmd = 'buildconf'; + $ret = exec_single_log($cmd, $this->build_dir, $this->env); + if (!$ret) { + throw new \Exception('buildconf failed'); + } + $this->log_buildconf = $ret['log']; + } + + function configure($extra = false, $rm_obj = true) + { + $args = $this->branch->config->getConfigureOptions($this->build_name) . ($extra ?: $extra); + $cmd = 'configure ' . $args . ' --enable-object-out-dir=' . $this->obj_dir; + /* old build may have been stoped */ + if (is_dir($this->obj_dir) && $rm_obj === true) { + rmdir_rf($this->obj_dir); + } + mkdir($this->obj_dir, 0655, true); + $ret = exec_single_log($cmd, $this->build_dir, $this->env); + if (!$ret) { + throw new \Exception('Configure failed'); + } + $this->log_configure = $ret['log']; + } + + function make($target = false) + { + $cmd = 'nmake' . ($target ?: $target); + $ret = exec_single_log($cmd, $this->build_dir, $this->env); + if (!$ret) { + throw new \Exception('Make failed'); + } + $this->log_make = $ret['log']; + } + + function makeArchive() + { + $cmd = 'nmake snap'; + $ret = exec_single_log($cmd, $this->build_dir, $this->env); + if (!$ret) { + throw new \Exception('Make snap failed'); + } + + $this->log_archive = $ret['log']; + + if (!preg_match('/Build dir: (.*)/', $this->log_configure, $matches)) { + throw new \Exception('Make archive failed, cannot find build dir'); + } + $zip_dir = trim($matches[1]); + + if (!preg_match('/.*(php-\d\.\d\.\d.*\.zip)/', $this->log_archive, $matches)) { + throw new \Exception('Make archive failed, cannot find php archive'); + } + $zip_filename = trim($matches[1]); + + if (!preg_match('/.*(php-devel-pack-\d\.\d\.\d.*\.zip)/', $this->log_archive, $matches)) { + throw new \Exception('Make archive failed, cannot find php-devel archive'); + } + $zip_devel_filename = trim($matches[1]); + $this->zip_devel_filename = $zip_devel_filename; + + if (!preg_match('/.*(php-debug-pack-\d\.\d\.\d.*\.zip)/', $this->log_archive, $matches)) { + throw new \Exception('Make archive failed, cannot find php-debug archive'); + } + $zip_debug_filename = trim($matches[1]); + $this->zip_debug_filename = $zip_debug_filename; + + if (!preg_match('/.*(php-test-pack-\d\.\d\.\d.*\.zip)/', $this->log_archive, $matches)) { + throw new \Exception('Make archive failed, cannot find php-test archive'); + } + $zip_test_filename = trim($matches[1]); + $this->zip_test_filename = $zip_test_filename; + + $this->archive_path = realpath($zip_dir . '/' . $zip_filename); + $this->debug_path = realpath($zip_dir . '/' . $zip_debug_filename); + $this->devel_path = realpath($zip_dir . '/' . $zip_devel_filename); + $this->test_path = realpath($zip_dir . '/' . $zip_test_filename); + + $this->addLogsToArchive(); + } + + function getMakeLogParsed() + { + $parser = new MakeLogParserVc; + $tmpfile = $this->obj_dir . '/' . 'make.txt'; + file_put_contents($tmpfile, $this->log_make); + $parser->parse($tmpfile, $this->build_dir); + unlink($tmpfile); + $this->stats = $parser->stats; + $this->compiler_log_parser = $parser; + return $parser->toHtml($this->build_name); + } + + function getStats() + { + return $this->stats; + } + + function clean() + { + rmdir_rf($this->obj_dir); + } + + function getLogs() + { + + } +} diff --git a/client/script/pecl.php b/client/script/pecl.php new file mode 100644 index 0000000..1599104 --- /dev/null +++ b/client/script/pecl.php @@ -0,0 +1,132 @@ +<?php +include __DIR__ . '/../data/config.php'; +include __DIR__ . '/../include/PeclBranch.php'; +include __DIR__ . '/../include/Tools.php'; + +use rmtools as rm; + +if ($argc < 3 || $argc > 4) { + echo "Usage: snapshot <config name> </path/to/ext/tgz>\n"; + exit(); +} + +$branch_name = $argv[1]; +$ext_tgz = $argv[2]; +$config_path = __DIR__ . '/../data/config/pecl/' . $branch_name . '.ini'; + +if (!file_exists($ext_tgz)) { + echo "'$ext_tgz' does not exist\n"; + exit(3); +} +if ('.tgz' != substr($ext_tgz, -4)) { + echo "Pecl package should end with .tgz\n"; + exit(3); +} +$tmp = explode('-', basename($ext_tgz, '.tgz')); +$ext_name = $tmp[0]; +$ext_ver = $tmp[1]; +unset($tmp); + +$branch = new rm\PeclBranch($config_path); + +$branch_name = $branch->config->getName(); + +echo "Running <$config_path>\n"; +echo "\t$branch_name\n"; + +$build_dir_parent = $branch->config->getBuildLocation(); + +if (!is_dir($build_dir_parent)) { + echo "Invalid build location <$build_dir_parent>\n"; + exit(-1); +} + +$builds = $branch->getBuildList('windows'); + +$has_build_errors = false; +$build_errors = array(); + +/* Each windows configuration from the ini for the given PHP version will be built */ +foreach ($builds as $build_name) { + + $build_src_path = realpath($build_dir_parent . DIRECTORY_SEPARATOR . $branch->config->getBuildSrcSubdir()); + $log = rm\exec_single_log('mklink /J ' . $build_src_path . ' ' . $build_src_path); + + $build = $branch->createBuildInstance($build_name); + + // looks like php_http-2.0.0beta4-5.3-nts-vc9-x86 + $ext_build_name = 'php_' . $ext_name + . '-' . $ext_ver + . '-' . $branch_name + . '-' . ($build->thread_safe ? 'ts' : 'nts') + . '-' . $build->compiler + . '-' . $build->architecture; + + echo "Starting build for $ext_build_name\n"; + echo "running build in <$build_src_path>\n"; + + $toupload_dir = TMP_DIR . '/' . $ext_build_name; + if (!is_dir($toupload_dir)) { + mkdir($toupload_dir, 0655, true); + } + + if (!is_dir($toupload_dir . '/logs')) { + mkdir($toupload_dir . '/logs', 0655, true); + } + + try { + $build->setSourceDir($build_src_path); + $build->buildconf(); + if ($branch->config->getPGO() == 1) { + echo "Creating PGI build\n"; + $build->configure(' "--enable-pgi" '); + } + else { + $build->configure(); + } + $build->make(); + $html_make_log = $build->getMakeLogParsed(); + continue; + $build->makeArchive(); + } catch (Exception $e) { + echo $e->getMessage() . "\n"; + echo $build->log_buildconf; + } + continue; + + /* PGO stuff would come here */ + + $stats = $build->getStats(); + + $json_filename = $build_config['name'] . '.json'; + + $json_data = array( + 'stats' => $stats, + 'has_php_pkg' => file_exists($build->archive_path), + 'has_debug_pkg' => file_exists($build->debug_path), + 'has_devel_pkg' => file_exists($build->devel_path), + 'has_test_pkg' => file_exists($build->test_path), + ); + + if ($stats['error'] > 0) { + $has_build_errors = true; + $build_errors[$build_config['name']] = $build->compiler_log_parser->getErrors(); + $json_data['build_error'] = $build_errors[$build_config['name']]; + } + + $json = json_encode($json_data); + file_put_contents($toupload_dir . '/' . $json_filename, $json); + rm\upload_build_result_ftp_curl($toupload_dir, $branch_name . '/r' . $last_rev); + $build->clean(); + rmdir($build_src_path); +} + +/*Upload the branch DB */ +/*$try = 0; +do { + $status = rm\upload_file_curl($branch->db_path, $branch_name . '/' . basename($branch->db_path)); + $try++; +} while ( $status === false && $try < 10 );*/ + +echo "Done.\n"; +
« previous php.webmaster (#16731) next »