mirror of
https://github.com/php-win-ext/php-sdk-binary-tools.git
synced 2026-04-25 17:58:07 +02:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 53d62894b7 | |||
| f0b6aacb6a | |||
| 1cd2c55d47 | |||
| afa44a8ac6 | |||
| dc48bef3a6 | |||
| 449a2092e0 | |||
| 4b1dbb58de | |||
| a047c663b9 | |||
| 20d13baab2 | |||
| 78c9f7b6d7 | |||
| 8a4ca6589c | |||
| 8ae549bbbe | |||
| d683a0977f | |||
| b1e2870343 | |||
| d1036b5b3d | |||
| 19c8ccbf07 | |||
| abe66fdf5b | |||
| 775cf0dbfa | |||
| 6ee0f9557b | |||
| 3a4163b0fa | |||
| cc7c11adad | |||
| d929b4aa7f | |||
| c56dfe3e27 | |||
| 33bbf07e51 | |||
| f29db9b574 | |||
| e88df96780 | |||
| 75fdf46b45 | |||
| e93a98a22b | |||
| a00a4ff668 | |||
| 1bb6a4adb5 | |||
| 7893436c79 | |||
| f6d81cff66 | |||
| 571063120d | |||
| 3562ee4586 | |||
| 9d638cbb32 | |||
| 73c01dfa10 | |||
| 677fe52847 | |||
| 2aef6dbdf2 | |||
| 37e9248d0f | |||
| b3f507b55f | |||
| 743aedd52c | |||
| 1bb2ac6540 | |||
| 050caa59e5 | |||
| 27ea9be829 |
@@ -14,7 +14,7 @@ The PHP SDK 2.2+ is compatible with PHP 7.2 and above.
|
|||||||
|
|
||||||
The PHP SDK 2.1 is required to build PHP 7.1 or 7.0.
|
The PHP SDK 2.1 is required to build PHP 7.1 or 7.0.
|
||||||
|
|
||||||
The legacy binary tools SDK is available from the [legacy branch](https://github.com/Microsoft/php-sdk-binary-tools/tree/legacy) and is suitable to build PHP 5.
|
The legacy binary tools SDK is available from the [legacy branch](https://github.com/php/php-sdk-binary-tools/tree/legacy) and is suitable to build PHP 5.
|
||||||
|
|
||||||
# Requirements
|
# Requirements
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ It is not required to hold the source in the PHP SDK directory. It could be usef
|
|||||||
|
|
||||||
## Basic usage example
|
## Basic usage example
|
||||||
|
|
||||||
- `git clone https://github.com/Microsoft/php-sdk-binary-tools.git c:\php-sdk`
|
- `git clone https://github.com/php/php-sdk-binary-tools.git c:\php-sdk`
|
||||||
- `cd c:\php-sdk`
|
- `cd c:\php-sdk`
|
||||||
- `git checkout php-sdk-2.1.9` or later
|
- `git checkout php-sdk-2.1.9` or later
|
||||||
- invoke `phpsdk-vc15-x64.bat`
|
- invoke `phpsdk-vc15-x64.bat`
|
||||||
@@ -80,7 +80,7 @@ More extensive documentation can be found on the [wiki](https://wiki.php.net/int
|
|||||||
|
|
||||||
## The old way
|
## The old way
|
||||||
|
|
||||||
- `git clone https://github.com/Microsoft/php-sdk-binary-tools.git c:\php-sdk`
|
- `git clone https://github.com/php/php-sdk-binary-tools.git c:\php-sdk`
|
||||||
- follow the instructions on the PHP [wiki page](https://wiki.php.net/internals/windows/stepbystepbuild "PHP wiki page")
|
- follow the instructions on the PHP [wiki page](https://wiki.php.net/internals/windows/stepbystepbuild "PHP wiki page")
|
||||||
|
|
||||||
# Customizing
|
# Customizing
|
||||||
@@ -122,7 +122,9 @@ As of the version 2.1.0, the SDK includes a tool for the [PGO](https://docs.micr
|
|||||||
## Preparing PGO training environment
|
## Preparing PGO training environment
|
||||||
- the pgo folder in the SDK root dir contains templates and scenarios for PGO training
|
- the pgo folder in the SDK root dir contains templates and scenarios for PGO training
|
||||||
- adjust and execute [doc/phpsdk_pgo_prep_elevated.bat.example](doc/phpsdk_pgo_prep_elevated.bat.example) to open ports required for PHP SDK training servers
|
- adjust and execute [doc/phpsdk_pgo_prep_elevated.bat.example](doc/phpsdk_pgo_prep_elevated.bat.example) to open ports required for PHP SDK training servers
|
||||||
- run `phpsdk_pgo --init`
|
- run `phpsdk_pgo --init`. Note that composer requires huge amounts of memory, so
|
||||||
|
it may be necessary to set the environment variable `COMPOSER_MEMORY_LIMIT=-1`.
|
||||||
|
The PGO initialization may not succeed in x86 enviroments.
|
||||||
|
|
||||||
## Creating PGO build
|
## Creating PGO build
|
||||||
- compile PHP configured using `--enable-pgi`
|
- compile PHP configured using `--enable-pgi`
|
||||||
@@ -205,3 +207,24 @@ previously.
|
|||||||
- If you experience some strange crashes on MSYS2 tools, try the phpsdk_rebase_msys2 tool. MSYS2 tools might be have unstable
|
- If you experience some strange crashes on MSYS2 tools, try the phpsdk_rebase_msys2 tool. MSYS2 tools might be have unstable
|
||||||
on ASLR enabled systems.
|
on ASLR enabled systems.
|
||||||
|
|
||||||
|
# Internal notes
|
||||||
|
|
||||||
|
## Releases
|
||||||
|
|
||||||
|
Users of the PHP SDK are supposed to use tagged versions for stability and
|
||||||
|
reproducability. This requires the maintainers of the PHP SDK to create such
|
||||||
|
tags for *all* *relevant* *changes*. The tag format should be `php-sdk-X.Y.Z`,
|
||||||
|
with the common major, minor and revision numbers.
|
||||||
|
|
||||||
|
Comprehensive changes, which would be hard to test extensively, such as updates
|
||||||
|
to the bundled PHP or the MinGW tools, should walk through a QA (aka. pre-release)
|
||||||
|
process, typically with beta versions (e.g. `php-sdk-X.Y.Zbeta1`). Only after
|
||||||
|
these have been thoroughly tested, and all relevant issues have been resolved,
|
||||||
|
a GA release should be tagged.
|
||||||
|
|
||||||
|
After each tag, a couple of other repositories should be informed about the
|
||||||
|
available update, ideally in form of a pull request. These repositories are:
|
||||||
|
|
||||||
|
* https://github.com/php/php-src (for Windows CI)
|
||||||
|
* https://github.com/php/php-windows-builder
|
||||||
|
* https://github.com/php/setup-php-sdk
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
@@ -5,6 +5,7 @@ extension=php_sqlite3.dll
|
|||||||
extension=php_openssl.dll
|
extension=php_openssl.dll
|
||||||
extension=php_mbstring.dll
|
extension=php_mbstring.dll
|
||||||
extension=php_mysqli.dll
|
extension=php_mysqli.dll
|
||||||
|
extension=php_zip.dll
|
||||||
memory_limit=4G
|
memory_limit=4G
|
||||||
|
|
||||||
error_reporting=-1
|
error_reporting=-1
|
||||||
|
|||||||
Binary file not shown.
Regular → Executable
+4
-1
@@ -20,13 +20,16 @@ if "%PHP_SDK_ARCH%" NEQ "" (
|
|||||||
goto create_all
|
goto create_all
|
||||||
) else (
|
) else (
|
||||||
:create_all
|
:create_all
|
||||||
for %%i in (vc14 vc15 vs16) do (
|
for %%i in (vc14 vc15 vs16 vs17) do (
|
||||||
MD %_%\%%i\x86\deps\bin
|
MD %_%\%%i\x86\deps\bin
|
||||||
MD %_%\%%i\x86\deps\lib
|
MD %_%\%%i\x86\deps\lib
|
||||||
MD %_%\%%i\x86\deps\include
|
MD %_%\%%i\x86\deps\include
|
||||||
MD %_%\%%i\x64\deps\bin
|
MD %_%\%%i\x64\deps\bin
|
||||||
MD %_%\%%i\x64\deps\lib
|
MD %_%\%%i\x64\deps\lib
|
||||||
MD %_%\%%i\x64\deps\include
|
MD %_%\%%i\x64\deps\include
|
||||||
|
MD %_%\%%i\arm64\deps\bin
|
||||||
|
MD %_%\%%i\arm64\deps\lib
|
||||||
|
MD %_%\%%i\arm64\deps\include
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
+1
-1
@@ -180,7 +180,7 @@ function usage(int $code = -1)
|
|||||||
echo "Usage: ", PHP_EOL, PHP_EOL;
|
echo "Usage: ", PHP_EOL, PHP_EOL;
|
||||||
echo "Configuration:", PHP_EOL;
|
echo "Configuration:", PHP_EOL;
|
||||||
echo " -b --branch Branch name, eg. 7.0, 7.1, etc. If omited, several guess methods apply.", PHP_EOL;
|
echo " -b --branch Branch name, eg. 7.0, 7.1, etc. If omited, several guess methods apply.", PHP_EOL;
|
||||||
echo " -a --arch Architecture, x86 or x64. If omited, cl.exe is used to guess.", PHP_EOL;
|
echo " -a --arch Architecture, x86 or x64 or arm64. If omited, cl.exe is used to guess.", PHP_EOL;
|
||||||
echo " -t --crt CRT, marked by the corresponding VC++ version, eg. vc11, vc14, etc.", PHP_EOL;
|
echo " -t --crt CRT, marked by the corresponding VC++ version, eg. vc11, vc14, etc.", PHP_EOL;
|
||||||
echo " -s --stability One of stable or staging.", PHP_EOL, PHP_EOL;
|
echo " -s --stability One of stable or staging.", PHP_EOL, PHP_EOL;
|
||||||
echo "Commands:", PHP_EOL;
|
echo "Commands:", PHP_EOL;
|
||||||
|
|||||||
Regular → Executable
@@ -65,7 +65,7 @@ foreach ($dirs as $path) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!preg_match(",.*-(vc\d+)-(x\d\d)\.zip,", $filename, $m)) {
|
if (!preg_match(",.*-(v[c|s]\d+)-(x\d\d)\.zip,", $filename, $m)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
+2
-12
@@ -12,18 +12,8 @@ echo.
|
|||||||
call %PHP_SDK_BIN_PATH%\phpsdk_version.bat
|
call %PHP_SDK_BIN_PATH%\phpsdk_version.bat
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
if "%PHP_SDK_OS_ARCH%"=="x64" (
|
echo OS architecture: %PHP_SDK_OS_ARCH%
|
||||||
echo OS architecture: 64-bit
|
echo Build architecture: %PHP_SDK_ARCH%
|
||||||
) else (
|
|
||||||
echo OS architecture: 32-bit
|
|
||||||
)
|
|
||||||
|
|
||||||
if "%PHP_SDK_ARCH%"=="x64" (
|
|
||||||
echo Build architecture: 64-bit
|
|
||||||
) else (
|
|
||||||
echo Build architecture: 32-bit
|
|
||||||
)
|
|
||||||
|
|
||||||
echo Visual C++: %PHP_SDK_VC_TOOLSET_VER%
|
echo Visual C++: %PHP_SDK_VC_TOOLSET_VER%
|
||||||
echo PHP-SDK path: %PHP_SDK_ROOT_PATH%
|
echo PHP-SDK path: %PHP_SDK_ROOT_PATH%
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
+95
-33
@@ -44,32 +44,65 @@ if 14 gtr %TMP_CHK% (
|
|||||||
set PHP_SDK_VS_NUM=%TMP_CHK%
|
set PHP_SDK_VS_NUM=%TMP_CHK%
|
||||||
set TMP_CHK=
|
set TMP_CHK=
|
||||||
|
|
||||||
if /i not "%2"=="x64" (
|
rem check target arch
|
||||||
if /i not "%2"=="x86" (
|
if "%2"=="x86" set PHP_SDK_ARCH=%2
|
||||||
echo Unsupported arch "%2"
|
if "%2"=="x64" set PHP_SDK_ARCH=%2
|
||||||
goto out_error
|
if "%2"=="x86_64" set PHP_SDK_ARCH=x64
|
||||||
)
|
if "%2"=="amd64" set PHP_SDK_ARCH=x64
|
||||||
|
if "%2"=="arm64" set PHP_SDK_ARCH=%2
|
||||||
|
if "%PHP_SDK_ARCH%"=="" (
|
||||||
|
echo Unsupported target arch %2 >&2
|
||||||
|
goto out_error
|
||||||
)
|
)
|
||||||
|
|
||||||
set PHP_SDK_ARCH=%2
|
set TOOLSET=
|
||||||
|
if NOT "%3"=="" SET TOOLSET=%3
|
||||||
|
|
||||||
rem check OS arch
|
rem check OS arch
|
||||||
set TMPKEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion
|
rem todo: allow user choose host sdk arch (i.e. x64 target can be compiled at x64(native) or x86(cross))
|
||||||
reg query "%TMPKEY%" /v "ProgramFilesDir (x86)" >nul 2>nul
|
for /f "usebackq tokens=1*" %%i in (`wmic cpu get Architecture /value /format:table ^| findstr /r "[1234567890][1234567890]*"`) do (
|
||||||
if not errorlevel 1 (
|
set PHP_SDK_OS_ARCH_NUM=%%i
|
||||||
set PHP_SDK_OS_ARCH=x64
|
|
||||||
) else (
|
|
||||||
if /i "%PHP_SDK_ARCH%"=="x64" (
|
|
||||||
echo 32-bit OS detected, native 64-bit toolchain is unavailable.
|
|
||||||
goto out_error
|
|
||||||
)
|
|
||||||
set PHP_SDK_OS_ARCH=x86
|
|
||||||
)
|
)
|
||||||
set TMPKEY=
|
|
||||||
|
goto os_arch_cases
|
||||||
|
:os_arch_error
|
||||||
|
echo Unsupported OS arch %PHP_SDK_OS_ARCH% >&2
|
||||||
|
goto out_error
|
||||||
|
|
||||||
|
:os_arch_cases
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="0" set PHP_SDK_OS_ARCH=x86
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="1" (set PHP_SDK_OS_ARCH=mips && goto os_arch_error)
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="2" (set PHP_SDK_OS_ARCH=alpha && goto os_arch_error)
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="3" (set PHP_SDK_OS_ARCH=ppc && goto os_arch_error)
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="4" (set PHP_SDK_OS_ARCH=shx && goto os_arch_error)
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="5" (set PHP_SDK_OS_ARCH=arm32 && goto os_arch_error)
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="6" (set PHP_SDK_OS_ARCH=ia64 && goto os_arch_error)
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="7" (set PHP_SDK_OS_ARCH=alpha64 && goto os_arch_error)
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="8" (set PHP_SDK_OS_ARCH=msil && goto os_arch_error)
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="9" set PHP_SDK_OS_ARCH=x64
|
||||||
|
rem wow64
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="10" set PHP_SDK_OS_ARCH=x86
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="11" (set PHP_SDK_OS_ARCH=neutral && goto os_arch_error)
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="12" set PHP_SDK_OS_ARCH=arm64
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="13" (set PHP_SDK_OS_ARCH=arm32 && goto os_arch_error)
|
||||||
|
rem woa64
|
||||||
|
if "%PHP_SDK_OS_ARCH_NUM%"=="14" set PHP_SDK_OS_ARCH=x86
|
||||||
|
if "%PHP_SDK_OS_ARCH%"=="" (
|
||||||
|
goto os_arch_error
|
||||||
|
)
|
||||||
|
|
||||||
|
set PHP_SDK_OS_ARCH_NUM=
|
||||||
|
|
||||||
|
rem cross compile is ok, so we donot need this
|
||||||
|
rem if not /i "%PHP_SDK_ARCH%"=="PHP_SDK_OS_ARCH" (
|
||||||
|
rem echo 32-bit OS detected, native 64-bit toolchain is unavailable.
|
||||||
|
rem goto out_error
|
||||||
|
rem )
|
||||||
|
|
||||||
rem get vc base dir
|
rem get vc base dir
|
||||||
if 15 gtr %PHP_SDK_VS_NUM% (
|
if 15 gtr %PHP_SDK_VS_NUM% (
|
||||||
if /i "%PHP_SDK_OS_ARCH%"=="x64" (
|
rem for arch other than x86, use WOW6432
|
||||||
|
if /i not "%PHP_SDK_OS_ARCH%"=="x86" (
|
||||||
set TMPKEY=HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%PHP_SDK_VS:~2%.0\Setup\VC
|
set TMPKEY=HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%PHP_SDK_VS:~2%.0\Setup\VC
|
||||||
) else (
|
) else (
|
||||||
set TMPKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\%PHP_SDK_VS:~2%.0\Setup\VC
|
set TMPKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\%PHP_SDK_VS:~2%.0\Setup\VC
|
||||||
@@ -85,16 +118,22 @@ if 15 gtr %PHP_SDK_VS_NUM% (
|
|||||||
set /a PHP_SDK_VS_RANGE=PHP_SDK_VS_NUM + 1
|
set /a PHP_SDK_VS_RANGE=PHP_SDK_VS_NUM + 1
|
||||||
set PHP_SDK_VS_RANGE="[%PHP_SDK_VS_NUM%,!PHP_SDK_VS_RANGE%!)"
|
set PHP_SDK_VS_RANGE="[%PHP_SDK_VS_NUM%,!PHP_SDK_VS_RANGE%!)"
|
||||||
|
|
||||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version !PHP_SDK_VS_RANGE! -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do (
|
set APPEND=x86.x64
|
||||||
|
if /i "%PHP_SDK_OS_ARCH%"=="arm64" (
|
||||||
|
set APPEND=ARM64
|
||||||
|
)
|
||||||
|
set VS_VERSION_ARGS="-latest"
|
||||||
|
if "%TOOLSET%"=="" set VS_VERSION_ARGS=-version !PHP_SDK_VS_RANGE!
|
||||||
|
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo !VS_VERSION_ARGS! -requires Microsoft.VisualStudio.Component.VC.Tools.!APPEND! -property installationPath -format text') do (
|
||||||
set PHP_SDK_VC_DIR=%%b\VC
|
set PHP_SDK_VC_DIR=%%b\VC
|
||||||
)
|
)
|
||||||
if not exist "!PHP_SDK_VC_DIR!" (
|
if not exist "!PHP_SDK_VC_DIR!" (
|
||||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version !PHP_SDK_VS_RANGE! -products Microsoft.VisualStudio.Product.BuildTools -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do (
|
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo !VS_VERSION_ARGS! -products Microsoft.VisualStudio.Product.BuildTools -requires Microsoft.VisualStudio.Component.VC.Tools.!APPEND! -property installationPath -format text') do (
|
||||||
set PHP_SDK_VC_DIR=%%b\VC
|
set PHP_SDK_VC_DIR=%%b\VC
|
||||||
)
|
)
|
||||||
if not exist "!PHP_SDK_VC_DIR!" (
|
if not exist "!PHP_SDK_VC_DIR!" (
|
||||||
rem check for a preview release
|
rem check for a preview release
|
||||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version !PHP_SDK_VS_RANGE! -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do (
|
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo !VS_VERSION_ARGS! -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.!APPEND! -property installationPath -format text') do (
|
||||||
set PHP_SDK_VC_DIR=%%b\VC
|
set PHP_SDK_VC_DIR=%%b\VC
|
||||||
)
|
)
|
||||||
if not exist "!PHP_SDK_VC_DIR!" (
|
if not exist "!PHP_SDK_VC_DIR!" (
|
||||||
@@ -105,13 +144,15 @@ if 15 gtr %PHP_SDK_VS_NUM% (
|
|||||||
)
|
)
|
||||||
set VSCMD_ARG_no_logo=nologo
|
set VSCMD_ARG_no_logo=nologo
|
||||||
)
|
)
|
||||||
|
set APPEND=
|
||||||
set TMPKEY=
|
set TMPKEY=
|
||||||
set PHP_SDK_VS_RANGE=
|
set PHP_SDK_VS_RANGE=
|
||||||
|
|
||||||
if 15 gtr %PHP_SDK_VS_NUM% (
|
if 15 gtr %PHP_SDK_VS_NUM% (
|
||||||
rem get sdk dir
|
rem get sdk dir
|
||||||
rem if 10.0 is available, it's ok
|
rem if 10.0 is available, it's ok
|
||||||
if /i "%PHP_SDK_OS_ARCH%"=="x64" (
|
rem for arch other than x86, use WOW6432
|
||||||
|
if /i not "%PHP_SDK_OS_ARCH%"=="x86" (
|
||||||
set TMPKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0
|
set TMPKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v10.0
|
||||||
) else (
|
) else (
|
||||||
set TMPKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0
|
set TMPKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0
|
||||||
@@ -125,7 +166,8 @@ if 15 gtr %PHP_SDK_VS_NUM% (
|
|||||||
)
|
)
|
||||||
|
|
||||||
rem Otherwise 8.1 should be available anyway
|
rem Otherwise 8.1 should be available anyway
|
||||||
if /i "%PHP_SDK_OS_ARCH%"=="x64" (
|
rem for arch other than x86, use WOW6432
|
||||||
|
if /i not "%PHP_SDK_OS_ARCH%"=="x86" (
|
||||||
set TMPKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1
|
set TMPKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v8.1
|
||||||
) else (
|
) else (
|
||||||
set TMPKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1
|
set TMPKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1
|
||||||
@@ -143,19 +185,39 @@ if 15 gtr %PHP_SDK_VS_NUM% (
|
|||||||
)
|
)
|
||||||
|
|
||||||
if /i "%PHP_SDK_ARCH%"=="x64" (
|
if /i "%PHP_SDK_ARCH%"=="x64" (
|
||||||
if 15 gtr %PHP_SDK_VS_NUM% (
|
set TARGET_ARCH_NAME=amd64
|
||||||
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" amd64
|
|
||||||
) else (
|
|
||||||
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" amd64
|
|
||||||
)
|
|
||||||
) else (
|
) else (
|
||||||
if 15 gtr %PHP_SDK_VS_NUM% (
|
set TARGET_ARCH_NAME=%PHP_SDK_ARCH%
|
||||||
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" x86
|
|
||||||
) else (
|
|
||||||
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" x86
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if /i "%PHP_SDK_OS_ARCH%"=="x64" (
|
||||||
|
set HOST_ARCH_NAME=amd64
|
||||||
|
) else (
|
||||||
|
set HOST_ARCH_NAME=%PHP_SDK_ARCH%
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%HOST_ARCH_NAME%"=="%TARGET_ARCH_NAME%" (
|
||||||
|
set VCVARSALL_ARCH_NAME=%HOST_ARCH_NAME%
|
||||||
|
) else if "%HOST_ARCH_NAME%_%TARGET_ARCH_NAME%"=="amd64_x86" (
|
||||||
|
set VCVARSALL_ARCH_NAME=%TARGET_ARCH_NAME%
|
||||||
|
) else (
|
||||||
|
set VCVARSALL_ARCH_NAME=%HOST_ARCH_NAME%_%TARGET_ARCH_NAME%
|
||||||
|
)
|
||||||
|
if 15 gtr %PHP_SDK_VS_NUM% (
|
||||||
|
if NOT "%TOOLSET%"=="" (
|
||||||
|
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" !VCVARSALL_ARCH_NAME! -vcvars_ver=%TOOLSET%
|
||||||
|
) else (
|
||||||
|
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" !VCVARSALL_ARCH_NAME!
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
if NOT "%TOOLSET%"=="" (
|
||||||
|
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" !VCVARSALL_ARCH_NAME! -vcvars_ver=%TOOLSET%
|
||||||
|
) else (
|
||||||
|
set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" !VCVARSALL_ARCH_NAME!
|
||||||
|
)
|
||||||
|
)
|
||||||
|
set VCVARSALL_ARCH_NAME=
|
||||||
|
|
||||||
rem echo Visual Studio VC path %PHP_SDK_VC_DIR%
|
rem echo Visual Studio VC path %PHP_SDK_VC_DIR%
|
||||||
rem echo Windows SDK path %PHP_SDK_WIN_SDK_DIR%
|
rem echo Windows SDK path %PHP_SDK_WIN_SDK_DIR%
|
||||||
|
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
BIN
Binary file not shown.
@@ -18,7 +18,7 @@ rem netsh advfirewall set allprofiles state off
|
|||||||
|
|
||||||
rem NGINX
|
rem NGINX
|
||||||
netsh advfirewall firewall add rule name="NGINX for PGO" dir=in action=allow program="C:\php-snap-build\php-sdk\pgo\work\server\nginx\nginx.exe" profile=private
|
netsh advfirewall firewall add rule name="NGINX for PGO" dir=in action=allow program="C:\php-snap-build\php-sdk\pgo\work\server\nginx\nginx.exe" profile=private
|
||||||
for \l %%p in (8081, 1, 8091) do (
|
for /l %%p in (8081, 1, 8091) do (
|
||||||
netsh advfirewall firewall add rule name="Open Port %%p for PHP PGO" dir=in action=allow protocol=TCP localport=%%p profile=private
|
netsh advfirewall firewall add rule name="Open Port %%p for PHP PGO" dir=in action=allow protocol=TCP localport=%%p profile=private
|
||||||
netsh advfirewall firewall add rule name="Open Port %%p for PHP PGO" dir=in action=allow protocol=UDP localport=%%p profile=private
|
netsh advfirewall firewall add rule name="Open Port %%p for PHP PGO" dir=in action=allow protocol=UDP localport=%%p profile=private
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -8,13 +8,23 @@ class Fetcher
|
|||||||
{
|
{
|
||||||
use FileOps;
|
use FileOps;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $host;
|
protected $host;
|
||||||
protected $port;
|
|
||||||
protected $stability;
|
|
||||||
protected $arch;
|
|
||||||
protected $series;
|
|
||||||
protected $scheme;
|
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
|
protected $port;
|
||||||
|
|
||||||
|
/** @var ?string */
|
||||||
|
protected $stability;
|
||||||
|
|
||||||
|
/** @var ?string */
|
||||||
|
protected $arch;
|
||||||
|
|
||||||
|
/** @var Series */
|
||||||
|
protected $series;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected $scheme;
|
||||||
|
|
||||||
public function __construct(string $host, int $port, string $scheme = "https", string $arch = NULL, string $stability = NULL, Series $series = NULL)
|
public function __construct(string $host, int $port, string $scheme = "https", string $arch = NULL, string $stability = NULL, Series $series = NULL)
|
||||||
{/*{{{*/
|
{/*{{{*/
|
||||||
|
|||||||
@@ -8,12 +8,25 @@ class Manager
|
|||||||
{
|
{
|
||||||
use FileOps;
|
use FileOps;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $stability;
|
protected $stability;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $arch;
|
protected $arch;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $path;
|
protected $path;
|
||||||
|
|
||||||
|
/** @var Cache */
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
|
/** @var Series */
|
||||||
protected $series;
|
protected $series;
|
||||||
|
|
||||||
|
/** @var Fetcher */
|
||||||
protected $fetcher;
|
protected $fetcher;
|
||||||
|
|
||||||
|
/** @var ?bool */
|
||||||
protected $updatesFlag = NULL;
|
protected $updatesFlag = NULL;
|
||||||
|
|
||||||
public function __construct(string $path, string $stability, string $arch)
|
public function __construct(string $path, string $stability, string $arch)
|
||||||
|
|||||||
@@ -8,9 +8,16 @@ class Package
|
|||||||
{
|
{
|
||||||
use FileOps;
|
use FileOps;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $name;
|
protected $name;
|
||||||
|
|
||||||
|
/** @var Series */
|
||||||
protected $series;
|
protected $series;
|
||||||
|
|
||||||
|
/** @var Fetcher */
|
||||||
protected $fetcher;
|
protected $fetcher;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $filepath;
|
protected $filepath;
|
||||||
|
|
||||||
public function __construct(string $name, Series $series, Fetcher $fetcher)
|
public function __construct(string $name, Series $series, Fetcher $fetcher)
|
||||||
|
|||||||
@@ -8,10 +8,19 @@ use SDK\Exception;
|
|||||||
|
|
||||||
class Series
|
class Series
|
||||||
{
|
{
|
||||||
|
/** @var ?Fetcher */
|
||||||
protected $fetcher;
|
protected $fetcher;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $stability;
|
protected $stability;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $arch;
|
protected $arch;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $rawData;
|
protected $rawData;
|
||||||
|
|
||||||
|
/** @var Cache */
|
||||||
protected $cache;
|
protected $cache;
|
||||||
|
|
||||||
public function __construct(string $stability, string $arch, Cache $cache, Fetcher $fetcher = NULL)
|
public function __construct(string $stability, string $arch, Cache $cache, Fetcher $fetcher = NULL)
|
||||||
@@ -59,6 +68,7 @@ class Series
|
|||||||
return "$base/series/$file";
|
return "$base/series/$file";
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
|
/** @return array<string>|string */
|
||||||
public function getData(bool $raw = false, bool $cache = true)
|
public function getData(bool $raw = false, bool $cache = true)
|
||||||
{/*{{{*/
|
{/*{{{*/
|
||||||
if ($cache && $this->rawData) {
|
if ($cache && $this->rawData) {
|
||||||
|
|||||||
@@ -7,13 +7,25 @@ use SDK\{Config as SDKConfig, Exception};
|
|||||||
|
|
||||||
abstract class PHP
|
abstract class PHP
|
||||||
{
|
{
|
||||||
|
/** @var string */
|
||||||
protected $php_root;
|
protected $php_root;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $php_ext_root;
|
protected $php_ext_root;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $opcache_file_cache;
|
protected $opcache_file_cache;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $id;
|
protected $id;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $scenario;
|
protected $scenario;
|
||||||
|
|
||||||
|
/** @var \SDK\Build\PGO\Config */
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
protected function setupPaths()
|
protected function setupPaths()
|
||||||
{
|
{
|
||||||
$this->php_root = $this->getRootDir();
|
$this->php_root = $this->getRootDir();
|
||||||
@@ -30,12 +42,15 @@ abstract class PHP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract public function getExeFilename() : string;
|
||||||
|
|
||||||
/* TODO Might be improved. */
|
/* TODO Might be improved. */
|
||||||
public function isDist() : bool
|
public function isDist() : bool
|
||||||
{
|
{
|
||||||
return !file_exists("Makefile") && file_exists("php.exe");
|
return !file_exists("Makefile") && file_exists("php.exe");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return array<string,string> */
|
||||||
protected function createEnv() : array
|
protected function createEnv() : array
|
||||||
{
|
{
|
||||||
$env = getenv();
|
$env = getenv();
|
||||||
@@ -96,7 +111,7 @@ abstract class PHP
|
|||||||
public function getVersion(bool $short = false) : string
|
public function getVersion(bool $short = false) : string
|
||||||
{
|
{
|
||||||
$ret = NULL;
|
$ret = NULL;
|
||||||
$cli = new CLI($this->conf, $this->scenario);
|
$cli = new CLI($this->conf);
|
||||||
|
|
||||||
$out = shell_exec($cli->getExeFilename() . " -n -v");
|
$out = shell_exec($cli->getExeFilename() . " -n -v");
|
||||||
|
|
||||||
@@ -119,7 +134,7 @@ abstract class PHP
|
|||||||
|
|
||||||
public function isThreadSafe() : bool
|
public function isThreadSafe() : bool
|
||||||
{
|
{
|
||||||
$cli = new CLI($this->conf, $this->scenario);
|
$cli = new CLI($this->conf);
|
||||||
|
|
||||||
$out = shell_exec($cli->getExeFilename() . " -n -v");
|
$out = shell_exec($cli->getExeFilename() . " -n -v");
|
||||||
|
|
||||||
@@ -131,6 +146,7 @@ abstract class PHP
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Need to cleanup it somewhere. */
|
/* Need to cleanup it somewhere. */
|
||||||
|
/** @return string */
|
||||||
public function getIniFilename()
|
public function getIniFilename()
|
||||||
{
|
{
|
||||||
$ret = tempnam(sys_get_temp_dir(), "ini");
|
$ret = tempnam(sys_get_temp_dir(), "ini");
|
||||||
@@ -163,6 +179,7 @@ abstract class PHP
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return string */
|
||||||
protected function getIniTplFilename()
|
protected function getIniTplFilename()
|
||||||
{
|
{
|
||||||
$tpl_path = $this->conf->getTplDir("php");
|
$tpl_path = $this->conf->getTplDir("php");
|
||||||
@@ -178,6 +195,7 @@ abstract class PHP
|
|||||||
return $construct;
|
return $construct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param array<string,string> $extra_env */
|
||||||
public function exec(string $php_cmd, string $args = NULL, array $extra_env = array()) : int
|
public function exec(string $php_cmd, string $args = NULL, array $extra_env = array()) : int
|
||||||
{
|
{
|
||||||
$env = $this->createEnv();
|
$env = $this->createEnv();
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ use SDK\Build\PGO\Interfaces;
|
|||||||
|
|
||||||
abstract class Server
|
abstract class Server
|
||||||
{
|
{
|
||||||
|
/** @var string */
|
||||||
|
protected $name;
|
||||||
|
|
||||||
|
/** @var Interfaces\PHP */
|
||||||
|
protected $php;
|
||||||
|
|
||||||
public function getName() : string
|
public function getName() : string
|
||||||
{
|
{
|
||||||
return $this->name;
|
return $this->name;
|
||||||
|
|||||||
@@ -3,19 +3,27 @@
|
|||||||
namespace SDK\Build\PGO\Abstracts;
|
namespace SDK\Build\PGO\Abstracts;
|
||||||
|
|
||||||
use SDK\FileOps;
|
use SDK\FileOps;
|
||||||
|
use SDK\Build\PGO\Interfaces;
|
||||||
use SDK\Build\PGO\Tool;
|
use SDK\Build\PGO\Tool;
|
||||||
|
|
||||||
abstract class TrainingCase
|
abstract class TrainingCase implements Interfaces\TrainingCase
|
||||||
{
|
{
|
||||||
use FileOps;
|
use FileOps;
|
||||||
|
|
||||||
const TYPE_WEB = "web";
|
const TYPE_WEB = "web";
|
||||||
const TYPE_CLI = "cli";
|
const TYPE_CLI = "cli";
|
||||||
|
|
||||||
|
/** @var array<mixed> */
|
||||||
protected $stat = array();
|
protected $stat = array();
|
||||||
|
|
||||||
/** @var \SDK\Build\PGO\Config */
|
/** @var \SDK\Build\PGO\Config */
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
|
/** @var mixed */
|
||||||
|
protected $php;
|
||||||
|
|
||||||
|
abstract public function getName() : string;
|
||||||
|
|
||||||
public function getType() : string
|
public function getType() : string
|
||||||
{
|
{
|
||||||
$type = $this->conf->getSectionItem($this->getName(), "type");
|
$type = $this->conf->getSectionItem($this->getName(), "type");
|
||||||
|
|||||||
@@ -11,11 +11,22 @@ class Config
|
|||||||
const MODE_REINIT = 2; /* currently unused */
|
const MODE_REINIT = 2; /* currently unused */
|
||||||
const MODE_CHECK_INIT = 3;
|
const MODE_CHECK_INIT = 3;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
protected $mode;
|
protected $mode;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
protected $last_port = 8081;
|
protected $last_port = 8081;
|
||||||
|
|
||||||
|
/** @var array<string,mixed> */
|
||||||
protected $sections = array();
|
protected $sections = array();
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $scenario = "default";
|
protected $scenario = "default";
|
||||||
|
|
||||||
|
/** @var array<mixed> */
|
||||||
protected $tpl_vars = array();
|
protected $tpl_vars = array();
|
||||||
|
|
||||||
|
/** @var array<mixed> */
|
||||||
protected $srv = array();
|
protected $srv = array();
|
||||||
|
|
||||||
public function __construct(int $mode = self::MODE_RUN)
|
public function __construct(int $mode = self::MODE_RUN)
|
||||||
@@ -67,6 +78,7 @@ class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return bool */
|
||||||
public function isInitialized()
|
public function isInitialized()
|
||||||
{
|
{
|
||||||
/* XXX Could be some better check. */
|
/* XXX Could be some better check. */
|
||||||
@@ -161,6 +173,7 @@ class Config
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param string ...$args */
|
||||||
public function sectionItemExists(...$args) : bool
|
public function sectionItemExists(...$args) : bool
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@@ -178,6 +191,10 @@ class Config
|
|||||||
return $i == count($args);
|
return $i == count($args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string ...$args
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
public function getSectionItem(...$args)
|
public function getSectionItem(...$args)
|
||||||
{
|
{
|
||||||
$i = 0;
|
$i = 0;
|
||||||
@@ -199,6 +216,7 @@ class Config
|
|||||||
return $it;
|
return $it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param string|int ...$args */
|
||||||
public function setSectionItem(...$args) : void
|
public function setSectionItem(...$args) : void
|
||||||
{
|
{
|
||||||
$val = array_pop($args);
|
$val = array_pop($args);
|
||||||
@@ -238,6 +256,7 @@ class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param string ...$args */
|
||||||
public function buildTplVarName(...$args) : string
|
public function buildTplVarName(...$args) : string
|
||||||
{
|
{
|
||||||
$tpl_k = array("PHP_SDK_PGO");
|
$tpl_k = array("PHP_SDK_PGO");
|
||||||
@@ -249,6 +268,7 @@ class Config
|
|||||||
return implode("_", $tpl_k);
|
return implode("_", $tpl_k);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param array<string,mixed> $section */
|
||||||
protected function importTplVars(string $section_name, array $section) : void
|
protected function importTplVars(string $section_name, array $section) : void
|
||||||
{
|
{
|
||||||
foreach($section as $k0 => $v0) {
|
foreach($section as $k0 => $v0) {
|
||||||
@@ -266,6 +286,7 @@ class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param array<mixed> $additional_vars */
|
||||||
public function processTpl(string $s, array $additional_vars = array()) : string
|
public function processTpl(string $s, array $additional_vars = array()) : string
|
||||||
{
|
{
|
||||||
$vars = array_merge($this->tpl_vars, $additional_vars);
|
$vars = array_merge($this->tpl_vars, $additional_vars);
|
||||||
@@ -275,6 +296,7 @@ class Config
|
|||||||
return $s;
|
return $s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param array<mixed> $additional_vars */
|
||||||
public function processTplFile(string $tpl_fn, string $dst_fn, array $additional_vars = array()) : void
|
public function processTplFile(string $tpl_fn, string $dst_fn, array $additional_vars = array()) : void
|
||||||
{
|
{
|
||||||
if (!file_exists($tpl_fn)) {
|
if (!file_exists($tpl_fn)) {
|
||||||
@@ -293,6 +315,7 @@ class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return string */
|
||||||
public function getWorkSectionsFilename()
|
public function getWorkSectionsFilename()
|
||||||
{
|
{
|
||||||
return $this->getWorkDir() . DIRECTORY_SEPARATOR . "phpsdk_pgo.json";
|
return $this->getWorkDir() . DIRECTORY_SEPARATOR . "phpsdk_pgo.json";
|
||||||
@@ -338,6 +361,10 @@ class Config
|
|||||||
return getenv("PHP_SDK_PHP_CMD");
|
return getenv("PHP_SDK_PHP_CMD");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Interfaces\Server $item
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function addSrv($item) : void
|
public function addSrv($item) : void
|
||||||
{
|
{
|
||||||
$name = strtolower($item->getName());
|
$name = strtolower($item->getName());
|
||||||
@@ -350,6 +377,7 @@ class Config
|
|||||||
$this->srv[$name] = $item;
|
$this->srv[$name] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return array<string,Interfaces\Server>|Interfaces\Server|null */
|
||||||
public function getSrv(?string $name = NULL)
|
public function getSrv(?string $name = NULL)
|
||||||
{
|
{
|
||||||
$ret = NULL;
|
$ret = NULL;
|
||||||
|
|||||||
@@ -13,11 +13,19 @@ use SDK\Build\PGO\Tool\{PGO, PackageWorkman};
|
|||||||
|
|
||||||
class Controller
|
class Controller
|
||||||
{
|
{
|
||||||
|
/** @var string */
|
||||||
protected $cmd;
|
protected $cmd;
|
||||||
|
|
||||||
|
/** @var ?string */
|
||||||
protected $scenario;
|
protected $scenario;
|
||||||
|
|
||||||
|
/** @var PGOConfig */
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
|
/** @var array<string>|null */
|
||||||
protected $cases;
|
protected $cases;
|
||||||
|
|
||||||
|
/** @param array<string>|null $cases */
|
||||||
public function __construct(string $cmd, ?string $scenario, ?array $cases)
|
public function __construct(string $cmd, ?string $scenario, ?array $cases)
|
||||||
{
|
{
|
||||||
$this->cmd = $cmd;
|
$this->cmd = $cmd;
|
||||||
@@ -29,6 +37,7 @@ class Controller
|
|||||||
$this->cases = $cases;
|
$this->cases = $cases;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return mixed */
|
||||||
protected function vitalizeSrv()
|
protected function vitalizeSrv()
|
||||||
{
|
{
|
||||||
$all = $this->conf->getSrv("all");
|
$all = $this->conf->getSrv("all");
|
||||||
@@ -47,12 +56,15 @@ class Controller
|
|||||||
return $all;
|
return $all;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $cmd
|
||||||
|
* @return PGOConfig
|
||||||
|
*/
|
||||||
protected function setupConfig($cmd)
|
protected function setupConfig($cmd)
|
||||||
{
|
{
|
||||||
switch ($cmd) {
|
switch ($cmd) {
|
||||||
default:
|
default:
|
||||||
throw new Exception("Unknown action '{$cmd}'.");
|
throw new Exception("Unknown action '{$cmd}'.");
|
||||||
break;
|
|
||||||
case "check_init":
|
case "check_init":
|
||||||
$cnf = new PGOConfig(PGOConfig::MODE_CHECK_INIT);
|
$cnf = new PGOConfig(PGOConfig::MODE_CHECK_INIT);
|
||||||
break;
|
break;
|
||||||
@@ -69,6 +81,10 @@ class Controller
|
|||||||
return $cnf;
|
return $cnf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool $force
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function handle($force)
|
public function handle($force)
|
||||||
{
|
{
|
||||||
/*$mode = (int)("init" !== $this->cmd);
|
/*$mode = (int)("init" !== $this->cmd);
|
||||||
@@ -80,7 +96,6 @@ class Controller
|
|||||||
switch ($this->cmd) {
|
switch ($this->cmd) {
|
||||||
default:
|
default:
|
||||||
throw new Exception("Unknown action '{$this->cmd}'.");
|
throw new Exception("Unknown action '{$this->cmd}'.");
|
||||||
break;
|
|
||||||
case "init":
|
case "init":
|
||||||
$lk = new Lock("pgo_init");
|
$lk = new Lock("pgo_init");
|
||||||
if (!$lk->locked()) {
|
if (!$lk->locked()) {
|
||||||
@@ -140,7 +155,6 @@ class Controller
|
|||||||
if (!file_exists($composer) || $force) {
|
if (!file_exists($composer) || $force) {
|
||||||
/* XXX this needs to go into the config, specifically for composer maybe even separate class. */
|
/* XXX this needs to go into the config, specifically for composer maybe even separate class. */
|
||||||
$url = "https://getcomposer.org/installer";
|
$url = "https://getcomposer.org/installer";
|
||||||
/* XXX remove the explicit version option when symfony demo is fixed. */
|
|
||||||
$tool = $this->conf->getToolsDir() . DIRECTORY_SEPARATOR . "composer-setup.php";
|
$tool = $this->conf->getToolsDir() . DIRECTORY_SEPARATOR . "composer-setup.php";
|
||||||
$pw->fetch($url, $tool, $force);
|
$pw->fetch($url, $tool, $force);
|
||||||
$php->exec("$tool --install-dir=" . $this->conf->getToolsDir());
|
$php->exec("$tool --install-dir=" . $this->conf->getToolsDir());
|
||||||
@@ -148,6 +162,7 @@ class Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
public function init(bool $force = false)
|
public function init(bool $force = false)
|
||||||
{
|
{
|
||||||
echo "\nInitializing PGO training environment.\n\n";
|
echo "\nInitializing PGO training environment.\n\n";
|
||||||
@@ -181,11 +196,13 @@ class Controller
|
|||||||
echo "PGO training environment Initialization complete.\n";
|
echo "PGO training environment Initialization complete.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return bool */
|
||||||
public function isInitialized()
|
public function isInitialized()
|
||||||
{
|
{
|
||||||
return $this->conf->isinitialized();
|
return $this->conf->isinitialized();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
public function train()
|
public function train()
|
||||||
{
|
{
|
||||||
if (!$this->isInitialized()) {
|
if (!$this->isInitialized()) {
|
||||||
@@ -234,6 +251,7 @@ class Controller
|
|||||||
echo "PGO training complete.\n";
|
echo "PGO training complete.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
public function up()
|
public function up()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -242,7 +260,7 @@ class Controller
|
|||||||
}
|
}
|
||||||
echo "\nStarting up PGO environment.\n\n";
|
echo "\nStarting up PGO environment.\n\n";
|
||||||
|
|
||||||
foreach ($this->vitalizeSrv("all") as $srv) {
|
foreach ($this->vitalizeSrv() as $srv) {
|
||||||
$srv->up();
|
$srv->up();
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
@@ -252,6 +270,7 @@ class Controller
|
|||||||
echo "The PGO environment is up.\n";
|
echo "The PGO environment is up.\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
public function down(bool $force = false)
|
public function down(bool $force = false)
|
||||||
{
|
{
|
||||||
if (!$this->isInitialized()) {
|
if (!$this->isInitialized()) {
|
||||||
@@ -260,7 +279,7 @@ class Controller
|
|||||||
/* XXX check it was started of course. */
|
/* XXX check it was started of course. */
|
||||||
echo "\nShutting down PGO environment.\n\n";
|
echo "\nShutting down PGO environment.\n\n";
|
||||||
|
|
||||||
foreach ($this->vitalizeSrv("all") as $srv) {
|
foreach ($this->vitalizeSrv() as $srv) {
|
||||||
$srv->down($force);
|
$srv->down($force);
|
||||||
echo "\n";
|
echo "\n";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,4 +12,7 @@ interface Server
|
|||||||
public function up() : void;
|
public function up() : void;
|
||||||
public function down(bool $force = false) : void;
|
public function down(bool $force = false) : void;
|
||||||
public function getName() : string;
|
public function getName() : string;
|
||||||
|
|
||||||
|
/** @return \SDK\Build\PGO\Interfaces\PHP */
|
||||||
|
public function getPhp();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,5 +9,10 @@ interface HTTP extends Interfaces\Server
|
|||||||
{
|
{
|
||||||
public function __construct(Config $conf, Interfaces\PHP $php);
|
public function __construct(Config $conf, Interfaces\PHP $php);
|
||||||
public function getPhp() : Interfaces\PHP;
|
public function getPhp() : Interfaces\PHP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array<mixed> $tpl_vars
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function addServer(string $part_tpl_fn, array $tpl_vars = array());
|
public function addServer(string $part_tpl_fn, array $tpl_vars = array());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class FCGI extends Abstracts\PHP implements Interfaces\PHP
|
|||||||
{
|
{
|
||||||
use FileOps;
|
use FileOps;
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
protected $is_tcp;
|
protected $is_tcp;
|
||||||
|
|
||||||
public function __construct(PGOConfig $conf, bool $is_tcp)
|
public function __construct(PGOConfig $conf, bool $is_tcp)
|
||||||
|
|||||||
@@ -12,8 +12,13 @@ class MariaDB extends Server implements DB
|
|||||||
{
|
{
|
||||||
use FileOps;
|
use FileOps;
|
||||||
|
|
||||||
|
/** @var PGOConfig */
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $base;
|
protected $base;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $name = "MariaDB";
|
protected $name = "MariaDB";
|
||||||
|
|
||||||
public function __construct(PGOConfig $conf)
|
public function __construct(PGOConfig $conf)
|
||||||
@@ -22,6 +27,7 @@ class MariaDB extends Server implements DB
|
|||||||
$this->base = $conf->getSrvDir(strtolower($this->name));
|
$this->base = $conf->getSrvDir(strtolower($this->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
protected function setupDist()
|
protected function setupDist()
|
||||||
{
|
{
|
||||||
/* pass */
|
/* pass */
|
||||||
|
|||||||
@@ -12,9 +12,16 @@ class NGINX extends Abstracts\Server implements Interfaces\Server\HTTP
|
|||||||
{
|
{
|
||||||
use FileOps;
|
use FileOps;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $name = "NGINX";
|
protected $name = "NGINX";
|
||||||
|
|
||||||
|
/** @var PGOConfig */
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $base;
|
protected $base;
|
||||||
|
|
||||||
|
/** @var Interfaces\PHP */
|
||||||
protected $php;
|
protected $php;
|
||||||
|
|
||||||
public function __construct(PGOConfig $conf, Interfaces\PHP $php)
|
public function __construct(PGOConfig $conf, Interfaces\PHP $php)
|
||||||
@@ -76,7 +83,7 @@ class NGINX extends Abstracts\Server implements Interfaces\Server\HTTP
|
|||||||
$h = popen("start /b .\\nginx.exe 2>&1", "r");
|
$h = popen("start /b .\\nginx.exe 2>&1", "r");
|
||||||
if (!is_resource($h)) {
|
if (!is_resource($h)) {
|
||||||
chdir($cwd);
|
chdir($cwd);
|
||||||
throw new Exception("Failed to start MariaDB.");
|
throw new Exception("Failed to start NGINX.");
|
||||||
}
|
}
|
||||||
sleep(3);
|
sleep(3);
|
||||||
|
|
||||||
@@ -125,6 +132,10 @@ class NGINX extends Abstracts\Server implements Interfaces\Server\HTTP
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Use only for init phase! */
|
/* Use only for init phase! */
|
||||||
|
/**
|
||||||
|
* @param array<mixed> $tpl_vars
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function addServer(string $part_tpl_fn, array $tpl_vars = array())
|
public function addServer(string $part_tpl_fn, array $tpl_vars = array())
|
||||||
{
|
{
|
||||||
if (!file_exists($part_tpl_fn)) {
|
if (!file_exists($part_tpl_fn)) {
|
||||||
|
|||||||
@@ -12,9 +12,16 @@ class PostgreSQL extends Server implements DB
|
|||||||
{
|
{
|
||||||
use FileOps;
|
use FileOps;
|
||||||
|
|
||||||
|
/** @var PGOConfig */
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $base;
|
protected $base;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $data_dir;
|
protected $data_dir;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $name = "PostgreSQL";
|
protected $name = "PostgreSQL";
|
||||||
|
|
||||||
public function __construct(PGOConfig $conf)
|
public function __construct(PGOConfig $conf)
|
||||||
@@ -24,6 +31,7 @@ class PostgreSQL extends Server implements DB
|
|||||||
$this->data_dir = $this->base . DIRECTORY_SEPARATOR . "data";
|
$this->data_dir = $this->base . DIRECTORY_SEPARATOR . "data";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
protected function setupDist()
|
protected function setupDist()
|
||||||
{
|
{
|
||||||
$user = $this->conf->getSectionItem($this->name, "user");
|
$user = $this->conf->getSectionItem($this->name, "user");
|
||||||
|
|||||||
@@ -8,8 +8,13 @@ use SDK\Build\PGO\Interfaces;
|
|||||||
|
|
||||||
class PGO
|
class PGO
|
||||||
{
|
{
|
||||||
|
/** @var Interfaces\PHP */
|
||||||
protected $php;
|
protected $php;
|
||||||
|
|
||||||
|
/** @var PGOConfig */
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
protected $idx = 0;
|
protected $idx = 0;
|
||||||
|
|
||||||
public function __construct(PGOConfig $conf, Interfaces\PHP $php)
|
public function __construct(PGOConfig $conf, Interfaces\PHP $php)
|
||||||
@@ -34,6 +39,7 @@ class PGO
|
|||||||
return $dn . DIRECTORY_SEPARATOR . $bn . ".pgd";
|
return $dn . DIRECTORY_SEPARATOR . $bn . ".pgd";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return array<string> */
|
||||||
protected function getWorkItems() : array
|
protected function getWorkItems() : array
|
||||||
{
|
{
|
||||||
$exe = glob($this->php->getRootDir() . DIRECTORY_SEPARATOR . "*.exe");
|
$exe = glob($this->php->getRootDir() . DIRECTORY_SEPARATOR . "*.exe");
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ class PackageWorkman
|
|||||||
{
|
{
|
||||||
use FileOps;
|
use FileOps;
|
||||||
|
|
||||||
|
/** @var PGOConfig */
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
public function __construct(PGOConfig $conf)
|
public function __construct(PGOConfig $conf)
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ use SDK\Build\PGO\Interfaces\TrainingCase;
|
|||||||
|
|
||||||
class Training
|
class Training
|
||||||
{
|
{
|
||||||
|
/** @var PGOConfig */
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
|
/** @var TrainingCase */
|
||||||
protected $t_case;
|
protected $t_case;
|
||||||
|
|
||||||
public function __construct(PGOConfig $conf, TrainingCase $t_case)
|
public function __construct(PGOConfig $conf, TrainingCase $t_case)
|
||||||
@@ -27,6 +30,7 @@ class Training
|
|||||||
return $this->t_case;
|
return $this->t_case;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @param array<string,mixed> $stat */
|
||||||
public function runWeb(int $max_runs, ?array &$stat = array()) : void
|
public function runWeb(int $max_runs, ?array &$stat = array()) : void
|
||||||
{
|
{
|
||||||
$url_list_fn = $this->t_case->getJobFilename();
|
$url_list_fn = $this->t_case->getJobFilename();
|
||||||
@@ -105,6 +109,7 @@ class Training
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* TODO Extend with number runs. */
|
/* TODO Extend with number runs. */
|
||||||
|
/** @param array<string,mixed> $stat */
|
||||||
public function run(int $max_runs = 1, ?array &$stat = array()) : void
|
public function run(int $max_runs = 1, ?array &$stat = array()) : void
|
||||||
{
|
{
|
||||||
$type = $this->t_case->getType();
|
$type = $this->t_case->getType();
|
||||||
|
|||||||
@@ -4,12 +4,21 @@ namespace SDK\Build\PGO;
|
|||||||
|
|
||||||
use SDK\Build\PGO\Config as PGOConfig;
|
use SDK\Build\PGO\Config as PGOConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @implements \Iterator<?string,Interfaces\TrainingCase>
|
||||||
|
*/
|
||||||
class TrainingCaseIterator implements \Iterator
|
class TrainingCaseIterator implements \Iterator
|
||||||
{
|
{
|
||||||
|
/** @var PGOConfig */
|
||||||
protected $conf;
|
protected $conf;
|
||||||
|
|
||||||
|
/** @var array<string> */
|
||||||
protected $items = array();
|
protected $items = array();
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
protected $idx;
|
protected $idx;
|
||||||
|
|
||||||
|
/** @var object */
|
||||||
protected $el;
|
protected $el;
|
||||||
|
|
||||||
public function __construct(PGOConfig $conf)
|
public function __construct(PGOConfig $conf)
|
||||||
@@ -50,6 +59,7 @@ class TrainingCaseIterator implements \Iterator
|
|||||||
return $base . DIRECTORY_SEPARATOR . "TrainingCaseHandler.php";
|
return $base . DIRECTORY_SEPARATOR . "TrainingCaseHandler.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function current()
|
public function current()
|
||||||
{
|
{
|
||||||
$base = $this->items[$this->idx];
|
$base = $this->items[$this->idx];
|
||||||
@@ -73,21 +83,25 @@ class TrainingCaseIterator implements \Iterator
|
|||||||
return $this->el;
|
return $this->el;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function next()
|
public function next()
|
||||||
{
|
{
|
||||||
$this->idx++;
|
$this->idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function rewind()
|
public function rewind()
|
||||||
{
|
{
|
||||||
$this->idx = 0;
|
$this->idx = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function valid()
|
public function valid()
|
||||||
{
|
{
|
||||||
return $this->idx < count($this->items);
|
return $this->idx < count($this->items);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\ReturnTypeWillChange]
|
||||||
public function key()
|
public function key()
|
||||||
{
|
{
|
||||||
if (!is_object($this->el)) {
|
if (!is_object($this->el)) {
|
||||||
|
|||||||
@@ -4,7 +4,10 @@ namespace SDK;
|
|||||||
|
|
||||||
class Cache
|
class Cache
|
||||||
{
|
{
|
||||||
|
/** @var string */
|
||||||
protected $id;
|
protected $id;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $hash;
|
protected $hash;
|
||||||
|
|
||||||
public function __construct(string $id)
|
public function __construct(string $id)
|
||||||
@@ -79,7 +82,7 @@ class Cache
|
|||||||
{/*{{{*/
|
{/*{{{*/
|
||||||
$p = $this->getCacheablePath($path, $relative);
|
$p = $this->getCacheablePath($path, $relative);
|
||||||
|
|
||||||
if ($this->isFileCached($p)) {
|
if (file_exists($p)) {
|
||||||
return file_get_contents($p);
|
return file_get_contents($p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,20 +7,40 @@ use SDK\Build\Dependency\Fetcher;
|
|||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
/* Config variables. */
|
/* Config variables. */
|
||||||
protected static $depsHost = 'windows.php.net';
|
|
||||||
|
/** @var string */
|
||||||
|
protected static $depsHost = 'downloads.php.net';
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
protected static $depsPort = 443;
|
protected static $depsPort = 443;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected static $depsUriScheme = "https";
|
protected static $depsUriScheme = "https";
|
||||||
protected static $depsBaseUri = "/downloads/php-sdk/deps";
|
|
||||||
|
|
||||||
/* protected static $sdkNugetFeedUrl = "http://127.0.0.1/sdk/nuget"; */
|
/** @var string */
|
||||||
|
protected static $depsBaseUri = "/~windows/php-sdk/deps";
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
|
protected static $sdkNugetFeedUrl = "http://127.0.0.1/sdk/nuget"; // experimental?
|
||||||
|
|
||||||
|
/** @var array<mixed> */
|
||||||
protected static $knownBranches = array ();
|
protected static $knownBranches = array ();
|
||||||
|
|
||||||
/* Helper props and methods. */
|
/* Helper props and methods. */
|
||||||
|
|
||||||
|
/** @var ?string */
|
||||||
protected static $currentBranchName = NULL;
|
protected static $currentBranchName = NULL;
|
||||||
|
|
||||||
|
/** @var ?string */
|
||||||
protected static $currentArchName = NULL;
|
protected static $currentArchName = NULL;
|
||||||
|
|
||||||
|
/** @var ?string */
|
||||||
protected static $currentCrtName = NULL;
|
protected static $currentCrtName = NULL;
|
||||||
|
|
||||||
|
/** @var ?string */
|
||||||
protected static $currentStabilityName = NULL;
|
protected static $currentStabilityName = NULL;
|
||||||
|
|
||||||
|
/** @var ?string */
|
||||||
protected static $depsLocalPath = NULL;
|
protected static $depsLocalPath = NULL;
|
||||||
|
|
||||||
public static function getDepsHost() : string
|
public static function getDepsHost() : string
|
||||||
@@ -28,7 +48,7 @@ class Config
|
|||||||
return self::$depsHost;
|
return self::$depsHost;
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
public static function getDepsPort() : string
|
public static function getDepsPort() : int
|
||||||
{/*{{{*/
|
{/*{{{*/
|
||||||
return self::$depsPort;
|
return self::$depsPort;
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
@@ -47,8 +67,8 @@ class Config
|
|||||||
{/*{{{*/
|
{/*{{{*/
|
||||||
$arch = strtolower($arch);
|
$arch = strtolower($arch);
|
||||||
|
|
||||||
if ("x64" != $arch && "x86" != $arch) {
|
if ("x64" != $arch && "x86" != $arch && "arm64" != $arch) {
|
||||||
throw new Exception("Unknown arch keyword, either x86 or x64 is accepted");
|
throw new Exception("Unknown arch keyword, x86 or x64 or arm64 is accepted");
|
||||||
}
|
}
|
||||||
|
|
||||||
self::$currentArchName = $arch;
|
self::$currentArchName = $arch;
|
||||||
@@ -72,6 +92,8 @@ class Config
|
|||||||
self::setCurrentArchName("x64");
|
self::setCurrentArchName("x64");
|
||||||
} elseif (preg_match(",x86,", $out[0])) {
|
} elseif (preg_match(",x86,", $out[0])) {
|
||||||
self::setCurrentArchName("x86");
|
self::setCurrentArchName("x86");
|
||||||
|
} elseif (preg_match(",arm64,", $out[0])) {
|
||||||
|
self::setCurrentArchName("arm64");
|
||||||
} else {
|
} else {
|
||||||
throw new Exception("Couldn't determine Arch.");
|
throw new Exception("Couldn't determine Arch.");
|
||||||
}
|
}
|
||||||
@@ -132,6 +154,7 @@ class Config
|
|||||||
return self::$currentStabilityName;
|
return self::$currentStabilityName;
|
||||||
} /*}}}*/
|
} /*}}}*/
|
||||||
|
|
||||||
|
/** @return array<mixed> */
|
||||||
public static function getKnownBranches() : array
|
public static function getKnownBranches() : array
|
||||||
{/*{{{*/
|
{/*{{{*/
|
||||||
if (empty(self::$knownBranches)) {
|
if (empty(self::$knownBranches)) {
|
||||||
@@ -144,9 +167,9 @@ class Config
|
|||||||
$fetcher = new Fetcher(self::$depsHost, self::$depsPort, self::$depsUriScheme);
|
$fetcher = new Fetcher(self::$depsHost, self::$depsPort, self::$depsUriScheme);
|
||||||
|
|
||||||
$tmp = $fetcher->getByUri(self::$depsBaseUri . "/series/");
|
$tmp = $fetcher->getByUri(self::$depsBaseUri . "/series/");
|
||||||
if (false !== $tmp) {
|
if ("" !== $tmp) {
|
||||||
$data = array();
|
$data = array();
|
||||||
if (preg_match_all(",/packages-(.+)-(v[cs]\d+)-(x86|x64)-(stable|staging)\.txt,U", $tmp, $m, PREG_SET_ORDER)) {
|
if (preg_match_all(",packages-(.+)-(v[cs]\d+)-(x86|x64|arm64)-(stable|staging)\.txt,Us", $tmp, $m, PREG_SET_ORDER)) {
|
||||||
foreach ($m as $b) {
|
foreach ($m as $b) {
|
||||||
if (!isset($data[$b[1]])) {
|
if (!isset($data[$b[1]])) {
|
||||||
$data[$b[1]] = array();
|
$data[$b[1]] = array();
|
||||||
@@ -252,6 +275,7 @@ class Config
|
|||||||
return self::$currentBranchName;
|
return self::$currentBranchName;
|
||||||
}/*}}}*/
|
}/*}}}*/
|
||||||
|
|
||||||
|
/** @return array<mixed> */
|
||||||
public static function getCurrentBranchData() : array
|
public static function getCurrentBranchData() : array
|
||||||
{/*{{{*/
|
{/*{{{*/
|
||||||
$ret = array();
|
$ret = array();
|
||||||
@@ -262,6 +286,7 @@ class Config
|
|||||||
throw new Exception("Unknown branch '$current_branch_name'");
|
throw new Exception("Unknown branch '$current_branch_name'");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$crt = null;
|
||||||
$cur_crt = Config::getCurrentCrtName();
|
$cur_crt = Config::getCurrentCrtName();
|
||||||
if (count($branches[$current_branch_name]) > 1) {
|
if (count($branches[$current_branch_name]) > 1) {
|
||||||
if (NULL === $cur_crt) {
|
if (NULL === $cur_crt) {
|
||||||
@@ -276,7 +301,7 @@ class Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!$cur_crt_usable) {
|
if (!$cur_crt_usable) {
|
||||||
throw new Exception("The passed CRT '$cur_crt' doesn't match any availbale for branch '$current_branch_name'");
|
throw new Exception("The passed CRT '$cur_crt' doesn't match any available for branch '$current_branch_name'");
|
||||||
}
|
}
|
||||||
$data = $branches[$current_branch_name][$cur_crt];
|
$data = $branches[$current_branch_name][$cur_crt];
|
||||||
} else {
|
} else {
|
||||||
@@ -284,7 +309,7 @@ class Config
|
|||||||
$crt = key($branches[$current_branch_name]);
|
$crt = key($branches[$current_branch_name]);
|
||||||
$data = $branches[$current_branch_name][$crt];
|
$data = $branches[$current_branch_name][$crt];
|
||||||
if ($crt != $cur_crt) {
|
if ($crt != $cur_crt) {
|
||||||
throw new Exception("The passed CRT '$cur_crt' doesn't match any availbale for branch '$current_branch_name'");
|
throw new Exception("The passed CRT '$cur_crt' doesn't match any available for branch '$current_branch_name'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ trait FileOps
|
|||||||
|
|
||||||
if ($item->isFile()) {
|
if ($item->isFile()) {
|
||||||
if (!call_user_func($cb, $src_path, $dst_path)) {
|
if (!call_user_func($cb, $src_path, $dst_path)) {
|
||||||
|
assert(is_string($cb));
|
||||||
throw new Exception("Unable to $cb '$src_path' to '$dst_path'");
|
throw new Exception("Unable to $cb '$src_path' to '$dst_path'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -137,6 +138,9 @@ retry:
|
|||||||
curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName());
|
curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName());
|
||||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||||
|
|
||||||
|
// workaround for <https://github.com/microsoft/php-sdk-binary-tools/issues/69>
|
||||||
|
curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
|
||||||
|
|
||||||
$ret = curl_exec($ch);
|
$ret = curl_exec($ch);
|
||||||
|
|
||||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||||
|
|||||||
@@ -4,10 +4,19 @@ namespace SDK;
|
|||||||
|
|
||||||
class Lock
|
class Lock
|
||||||
{
|
{
|
||||||
|
/** @var ?resource */
|
||||||
protected $fd;
|
protected $fd;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
protected $fn;
|
protected $fn;
|
||||||
|
|
||||||
|
/** @var bool */
|
||||||
protected $locked = false;
|
protected $locked = false;
|
||||||
|
|
||||||
|
/** @var bool|int */
|
||||||
protected $wouldBlock = false;
|
protected $wouldBlock = false;
|
||||||
|
|
||||||
|
/** @var bool|int */
|
||||||
protected $shared = false;
|
protected $shared = false;
|
||||||
|
|
||||||
public function __construct(string $tag, bool $auto = true, bool $autoShared = false)
|
public function __construct(string $tag, bool $auto = true, bool $autoShared = false)
|
||||||
|
|||||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+1402
-1525
File diff suppressed because it is too large
Load Diff
+1402
-1525
File diff suppressed because it is too large
Load Diff
+1463
-1818
File diff suppressed because it is too large
Load Diff
@@ -11,9 +11,16 @@ use SDK\Build\PGO\Tool;
|
|||||||
|
|
||||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||||
{
|
{
|
||||||
|
/** @var string */
|
||||||
protected $base;
|
protected $base;
|
||||||
|
|
||||||
|
/** @var ?Interfaces\Server $nginx */
|
||||||
protected $nginx;
|
protected $nginx;
|
||||||
|
|
||||||
|
/** @var mixed */
|
||||||
protected $php;
|
protected $php;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
protected $max_runs = 8;
|
protected $max_runs = 8;
|
||||||
|
|
||||||
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $maria)
|
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $maria)
|
||||||
@@ -65,6 +72,7 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
|||||||
$this->nginx->addServer($tpl_fn, $vars);
|
$this->nginx->addServer($tpl_fn, $vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
public function setupUrls()
|
public function setupUrls()
|
||||||
{
|
{
|
||||||
$this->nginx->up();
|
$this->nginx->up();
|
||||||
|
|||||||
@@ -11,10 +11,19 @@ use SDK\Build\PGO\Tool;
|
|||||||
|
|
||||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||||
{
|
{
|
||||||
|
/** @var string */
|
||||||
protected $base;
|
protected $base;
|
||||||
|
|
||||||
|
/** @var ?Interfaces\Server $nginx */
|
||||||
protected $nginx;
|
protected $nginx;
|
||||||
|
|
||||||
|
/** @var mixed */
|
||||||
protected $php;
|
protected $php;
|
||||||
|
|
||||||
|
/** @var ?Interfaces\Server\DB */
|
||||||
protected $maria;
|
protected $maria;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
protected $max_runs = 4;
|
protected $max_runs = 4;
|
||||||
|
|
||||||
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $maria)
|
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $maria)
|
||||||
@@ -99,6 +108,7 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
|||||||
$this->maria->down(true);
|
$this->maria->down(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
public function setupUrls()
|
public function setupUrls()
|
||||||
{
|
{
|
||||||
$this->maria->up();
|
$this->maria->up();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"joomla_zip_url": "https://github.com/joomla/joomla-cms/releases/download/3.8.11/Joomla_3.8.11-Stable-Full_Package.zip",
|
"joomla_zip_url": "https://github.com/joomla/joomla-cms/releases/download/3.9.13/Joomla_3.9.13-Stable-Full_Package.zip",
|
||||||
"type": "web",
|
"type": "web",
|
||||||
"srv_http": "nginx",
|
"srv_http": "nginx",
|
||||||
"srv_db": "mariadb"
|
"srv_db": "mariadb"
|
||||||
|
|||||||
@@ -11,9 +11,16 @@ use SDK\Build\PGO\Tool;
|
|||||||
|
|
||||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||||
{
|
{
|
||||||
|
/** @var string */
|
||||||
protected $base;
|
protected $base;
|
||||||
|
|
||||||
|
/** @var ?Interfaces\Server $nginx */
|
||||||
protected $nginx;
|
protected $nginx;
|
||||||
|
|
||||||
|
/** @var mixed */
|
||||||
protected $php;
|
protected $php;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
protected $max_runs = 4;
|
protected $max_runs = 4;
|
||||||
|
|
||||||
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $srv_db)
|
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $srv_db)
|
||||||
@@ -82,6 +89,7 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
|||||||
$php->exec($cmd);
|
$php->exec($cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
public function setupUrls()
|
public function setupUrls()
|
||||||
{
|
{
|
||||||
$this->nginx->up();
|
$this->nginx->up();
|
||||||
|
|||||||
@@ -11,10 +11,19 @@ use SDK\Build\PGO\Tool;
|
|||||||
|
|
||||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||||
{
|
{
|
||||||
|
/** @var string */
|
||||||
protected $base;
|
protected $base;
|
||||||
|
|
||||||
|
/** @var ?Interfaces\Server $nginx */
|
||||||
protected $nginx;
|
protected $nginx;
|
||||||
|
|
||||||
|
/** @var ?Interfaces\Server\DB */
|
||||||
protected $maria;
|
protected $maria;
|
||||||
|
|
||||||
|
/** @var mixed */
|
||||||
protected $php;
|
protected $php;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
protected $max_runs = 12;
|
protected $max_runs = 12;
|
||||||
|
|
||||||
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $maria)
|
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $maria)
|
||||||
@@ -97,6 +106,18 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
|||||||
$class = preg_replace(",function Faculty,", "function __construct", $class);
|
$class = preg_replace(",function Faculty,", "function __construct", $class);
|
||||||
file_put_contents($fl, $class);
|
file_put_contents($fl, $class);
|
||||||
|
|
||||||
|
// patch <https://github.com/intel/php_pgo_training_scripts/pull/4>
|
||||||
|
$fl = $htdocs . DIRECTORY_SEPARATOR . "standard_calls.php";
|
||||||
|
$standard_calls = file_get_contents($fl);
|
||||||
|
$standard_calls = preg_replace(",parse_str\(\\\$var1\),", "parse_str(\$var1, \$dummy)", $standard_calls);
|
||||||
|
file_put_contents($fl, $standard_calls);
|
||||||
|
|
||||||
|
// patch <https://github.com/intel/php_pgo_training_scripts/pull/5>
|
||||||
|
$fl = $htdocs . DIRECTORY_SEPARATOR . "init.php";
|
||||||
|
$standard_calls = file_get_contents($fl);
|
||||||
|
$standard_calls = preg_replace(",^initDB\(\);$,m", "mysqli_report(MYSQLI_REPORT_OFF);\n$0", $standard_calls);
|
||||||
|
file_put_contents($fl, $standard_calls);
|
||||||
|
|
||||||
//$php->exec($cmd, NULL, $env);
|
//$php->exec($cmd, NULL, $env);
|
||||||
/* TODO check status or switch to cli. */
|
/* TODO check status or switch to cli. */
|
||||||
$out = file_get_contents("http://$http_host:$http_port/init.php");
|
$out = file_get_contents("http://$http_host:$http_port/init.php");
|
||||||
@@ -107,6 +128,7 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
public function setupUrls()
|
public function setupUrls()
|
||||||
{
|
{
|
||||||
$url = "http://" . $this->getHttpHost() . ":" . $this->getHttpPort();
|
$url = "http://" . $this->getHttpHost() . ":" . $this->getHttpPort();
|
||||||
|
|||||||
@@ -11,9 +11,16 @@ use SDK\Build\PGO\Tool;
|
|||||||
|
|
||||||
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\TrainingCase
|
||||||
{
|
{
|
||||||
|
/** @var string */
|
||||||
protected $base;
|
protected $base;
|
||||||
|
|
||||||
|
/** @var ?Interfaces\Server $nginx */
|
||||||
protected $nginx;
|
protected $nginx;
|
||||||
|
|
||||||
|
/** @var mixed */
|
||||||
protected $php;
|
protected $php;
|
||||||
|
|
||||||
|
/** @var int */
|
||||||
protected $max_runs = 4;
|
protected $max_runs = 4;
|
||||||
|
|
||||||
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $srv_db)
|
public function __construct(Config $conf, ?Interfaces\Server $nginx, ?Interfaces\Server\DB $srv_db)
|
||||||
@@ -61,6 +68,7 @@ class TrainingCaseHandler extends Abstracts\TrainingCase implements Interfaces\T
|
|||||||
$this->nginx->addServer($tpl_fn, $vars);
|
$this->nginx->addServer($tpl_fn, $vars);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @return void */
|
||||||
public function setupUrls()
|
public function setupUrls()
|
||||||
{
|
{
|
||||||
$this->nginx->up();
|
$this->nginx->up();
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user