mirror of
https://github.com/php-win-ext/php-sdk-binary-tools.git
synced 2026-03-24 09:02:12 +01:00
Compare commits
100 Commits
php-sdk-2.
...
php-sdk-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
cb51b8f716 | ||
|
|
77ae352d49 | ||
|
|
647f367c55 | ||
|
|
3040efb46f | ||
|
|
d584b2f1c5 | ||
|
|
5c7a304e77 | ||
|
|
b3fffba01c | ||
|
|
58a7bdcfa7 | ||
|
|
81aaa702b2 | ||
|
|
ccfc816560 | ||
|
|
cf6ded7cec | ||
|
|
c73ab2dc76 | ||
|
|
06e32545f5 | ||
|
|
b8bf87b831 | ||
|
|
70ed1c2418 | ||
|
|
8d1df4af8c | ||
|
|
7050077f31 | ||
|
|
94c9d6c97d | ||
|
|
2dab4068aa | ||
|
|
bbdc8dd597 | ||
|
|
e28c5e9b96 | ||
|
|
b359404509 | ||
|
|
912853c55f | ||
|
|
806f743f3c | ||
|
|
d13ff857f0 | ||
|
|
217ab7b4ca | ||
|
|
f740aface6 | ||
|
|
f160e68fbc | ||
|
|
9e3fcfdd77 | ||
|
|
51d2eaa463 | ||
|
|
15cc20920a | ||
|
|
df2eb74fee | ||
|
|
f59fd45ee5 | ||
|
|
43107058f8 | ||
|
|
b53316585a | ||
|
|
8b957129bd | ||
|
|
76ede8f900 | ||
|
|
60cfe587d5 | ||
|
|
e6b4a0d34d | ||
|
|
dac0e43fec | ||
|
|
1d69f089ca | ||
|
|
99112657d2 | ||
|
|
7eaeba9e73 | ||
|
|
ad95ee0c7b | ||
|
|
55cdd86d3a | ||
|
|
1045633875 | ||
|
|
c6a2644a57 | ||
|
|
9ffa736cbc | ||
|
|
79fbcfee08 | ||
|
|
f84b056d1c | ||
|
|
0ab9b8ddc6 | ||
|
|
794ef96470 | ||
|
|
cecf3df7f3 | ||
|
|
1e6ee7afaa | ||
|
|
05af1a3b06 | ||
|
|
c748916f5c | ||
|
|
bebb84afd7 | ||
|
|
841065efd4 | ||
|
|
c726890170 | ||
|
|
b2e52e36d8 | ||
|
|
b8713d8543 | ||
|
|
025290f6d3 | ||
|
|
1ed89bbba2 | ||
|
|
1d4f4966af | ||
|
|
a5b1137938 | ||
|
|
908f5eeea7 | ||
|
|
a7cc2823bf |
2
LICENSE
2
LICENSE
@@ -1,4 +1,4 @@
|
||||
Copyright 2017-2018 Anatol Belski
|
||||
Copyright 2017-2019 Anatol Belski
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
|
||||
62
README.md
62
README.md
@@ -8,19 +8,26 @@ The PHP SDK itself and the SDK own tools and code are licensed under the BSD 2-C
|
||||
|
||||
# Overview
|
||||
|
||||
The PHP SDK 2.0+ is compatible with PHP 7.0 and above. The compatibility with [older versions](http://windows.php.net/downloads/php-sdk/php-sdk-binary-tools-20110915.zip "php-sdk-binary-tools-20110915.zip") is kept, also available from the [legacy branch](https://github.com/Microsoft/php-sdk-binary-tools/tree/legacy). The toolset was significantly revamped. Newer tools are now available, better workflows are now possible. The toolset consists on a mix of the hand written scripts, selected MSYS2 parts and standalone programs.
|
||||
The toolset consists on a mix of the hand written scripts, selected MSYS2 parts and standalone programs. It supports any workflows, be it a custom, local or a CI build whatsoever.
|
||||
|
||||
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 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
|
||||
|
||||
- `Visual C++ 2015` or `Visual C++ 2017` must be installed prior SDK usage (be sure to install both the C++ and the Windows SDK components)
|
||||
- A 64-bit build host
|
||||
- Windows 7 or later
|
||||
- `Visual C++ 2017` or `Visual C++ 2019` must be installed prior SDK usage. Required components
|
||||
- C++ dev
|
||||
- Windows SDK
|
||||
- .NET dev
|
||||
- if `Cygwin`, `MingW` or any other cross solution is installed, please read notes in the pitfalls section
|
||||
- if a 64-bit build is intended, a 64-bit system is required. Cross compilation of 64-bit on 32-bit system is not supported at the moment
|
||||
- The PHP SDK was successfully tested on Windows 7 or later, earlier versions might work but are not recommended
|
||||
|
||||
# Tools
|
||||
|
||||
All the tools included are either scripts or 32-bit binaries. They are therefore runable on any of x86 or x64 supported Windows system.
|
||||
|
||||
## SDK
|
||||
|
||||
- starter scripts, named phpsdk-<crt>-<arch>.bat
|
||||
@@ -33,8 +40,8 @@ All the tools included are either scripts or 32-bit binaries. They are therefore
|
||||
|
||||
## Other tools
|
||||
|
||||
- `bison` 3.0.5, `re2c` 1.0.3, `lemon`
|
||||
- `awk`, `gawk`, `sed`, `grep`
|
||||
- `bison` 3.3.2, `re2c` 1.1.1, `lemon`
|
||||
- `awk`, `gawk`, `sed`, `grep`, `jq`
|
||||
- `diff`, `diff3`, `patch`
|
||||
- `md5sum`, `sha1sum`, `sha224sum`, `sha256sum`, `sha384sum`, `sha512sum`
|
||||
- `7za`, `zip`, `unzip`, `unzipsfx`
|
||||
@@ -52,7 +59,7 @@ These are not included with the PHP SDK, but might be useful. While Visual C++ i
|
||||
|
||||
# Usage
|
||||
|
||||
The PHP SDK should be unzipped into the shortest possible path, preferrably somewhere near the drive root.
|
||||
The PHP SDK should be unzipped into the shortest possible path, preferably somewhere near the drive root.
|
||||
|
||||
Usually, the first step to start the PHP SDK is by invoking one of the suitable starter scripts. This automatically puts the console on the correct environment relevant for the desired PHP build configuration.
|
||||
|
||||
@@ -60,9 +67,9 @@ It is not required to hold the source in the PHP SDK directory. It could be usef
|
||||
|
||||
## 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`
|
||||
- `git checkout php-sdk-2.0.12` or later
|
||||
- `git checkout php-sdk-2.1.9` or later
|
||||
- invoke `phpsdk-vc15-x64.bat`
|
||||
- `phpsdk_buildtree phpmaster`
|
||||
- `git clone https://github.com/php/php-src.git && cd php-src`, or fetch a zipball
|
||||
@@ -73,7 +80,7 @@ More extensive documentation can be found on the [wiki](https://wiki.php.net/int
|
||||
|
||||
## 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")
|
||||
|
||||
# Customizing
|
||||
@@ -115,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
|
||||
- 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
|
||||
- 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
|
||||
- compile PHP configured using `--enable-pgi`
|
||||
@@ -192,9 +201,30 @@ previously.
|
||||
- When fetching the binary SDK from git, git `core.autocrlf` configuration directive set to `false` is recommended.
|
||||
- Tools, based on MSYS2, only accept paths with forward slashes.
|
||||
- Both Visual C++ toolset and the Windows SDK components have to be installed for the PHP SDK to work properly.
|
||||
- The VC++ toolset is still requried, even if another compiler, fe. clang, is intended to be used.
|
||||
- The VC++ toolset is still required, even if another compiler, fe. clang, is intended to be used.
|
||||
- `task.exe` is not a console application, some systems might not propagate exit code except the batch is explicitly run from `cmd /c`, etc.
|
||||
- `7za` should be prefered over `unzip` and `zip` for compatibility reasons.
|
||||
- If you experince some strange crashes on MSYS2 tools, try the phpsdk_rebase_msys2 tool. MSYS2 tools might be have unstable
|
||||
- `7za` should be preferred over `unzip` and `zip` for compatibility reasons.
|
||||
- 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.
|
||||
|
||||
# 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
|
||||
|
||||
BIN
bin/jq.exe
Normal file
BIN
bin/jq.exe
Normal file
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.
BIN
bin/php/libcrypto-1_1-x64.dll
Normal file
BIN
bin/php/libcrypto-1_1-x64.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/php/libsqlite3.dll
Normal file
BIN
bin/php/libsqlite3.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/php/libssl-1_1-x64.dll
Normal file
BIN
bin/php/libssl-1_1-x64.dll
Normal file
Binary file not shown.
Binary file not shown.
BIN
bin/php/php.exe
BIN
bin/php/php.exe
Binary file not shown.
@@ -5,7 +5,7 @@ extension=php_sqlite3.dll
|
||||
extension=php_openssl.dll
|
||||
extension=php_mbstring.dll
|
||||
extension=php_mysqli.dll
|
||||
memory_limit=1G
|
||||
memory_limit=4G
|
||||
|
||||
error_reporting=-1
|
||||
display_errors=1
|
||||
|
||||
BIN
bin/php/php7.dll
BIN
bin/php/php7.dll
Binary file not shown.
BIN
bin/php/php8.dll
Normal file
BIN
bin/php/php8.dll
Normal file
Binary file not shown.
Binary file not shown.
@@ -10,22 +10,27 @@ rem otherwise - retain the old behavior, create structs for all the known build
|
||||
cmd /c "exit /b 0"
|
||||
|
||||
if "%PHP_SDK_ARCH%" NEQ "" (
|
||||
if "%PHP_SDK_VC%" NEQ "" (
|
||||
MD %_%\%PHP_SDK_VC%\%PHP_SDK_ARCH%\deps\bin
|
||||
MD %_%\%PHP_SDK_VC%\%PHP_SDK_ARCH%\deps\lib
|
||||
MD %_%\%PHP_SDK_VC%\%PHP_SDK_ARCH%\deps\include
|
||||
cd %_%\%PHP_SDK_VC%\%PHP_SDK_ARCH%
|
||||
if "%PHP_SDK_VS%" NEQ "" (
|
||||
MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\bin
|
||||
MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\lib
|
||||
MD %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%\deps\include
|
||||
cd %_%\%PHP_SDK_VS%\%PHP_SDK_ARCH%
|
||||
goto exit
|
||||
)
|
||||
goto create_all
|
||||
) else (
|
||||
:create_all
|
||||
MD %_%\vc14\x86\deps\bin
|
||||
MD %_%\vc14\x86\deps\lib
|
||||
MD %_%\vc14\x86\deps\include
|
||||
MD %_%\vc14\x64\deps\bin
|
||||
MD %_%\vc14\x64\deps\lib
|
||||
MD %_%\vc14\x64\deps\include
|
||||
for %%i in (vc14 vc15 vs16 vs17) do (
|
||||
MD %_%\%%i\x86\deps\bin
|
||||
MD %_%\%%i\x86\deps\lib
|
||||
MD %_%\%%i\x86\deps\include
|
||||
MD %_%\%%i\x64\deps\bin
|
||||
MD %_%\%%i\x64\deps\lib
|
||||
MD %_%\%%i\x64\deps\include
|
||||
MD %_%\%%i\arm64\deps\bin
|
||||
MD %_%\%%i\arm64\deps\lib
|
||||
MD %_%\%%i\arm64\deps\include
|
||||
)
|
||||
)
|
||||
|
||||
set _=
|
||||
|
||||
@@ -126,17 +126,9 @@ try {
|
||||
usage(3);
|
||||
}
|
||||
/* The current CRT needs to match the config one. */
|
||||
$active_crt = getenv("PHP_SDK_VC");
|
||||
$active_crt = getenv("PHP_SDK_VS");
|
||||
if (Config::getCurrentCrtName() != $active_crt && !$force) {
|
||||
throw new Exception("Active CRT '$active_crt' differs from the branch CRT '" . Config::getCurrentCrtName() . "'.");
|
||||
}
|
||||
|
||||
if (NULL === Config::getCurrentStabilityName()) {
|
||||
if ("master" == Config::getCurrentBranchName()) {
|
||||
Config::setCurrentStabilityName("staging");
|
||||
} else {
|
||||
Config::setCurrentStabilityName("stable");
|
||||
}
|
||||
throw new Exception("Active CRT name '$active_crt' differs from the branch CRT name '" . Config::getCurrentCrtName() . "'.");
|
||||
}
|
||||
|
||||
$branch_data = Config::getCurrentBranchData();
|
||||
@@ -188,7 +180,7 @@ function usage(int $code = -1)
|
||||
echo "Usage: ", PHP_EOL, 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 " -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 " -s --stability One of stable or staging.", PHP_EOL, PHP_EOL;
|
||||
echo "Commands:", PHP_EOL;
|
||||
|
||||
@@ -12,19 +12,9 @@ echo.
|
||||
call %PHP_SDK_BIN_PATH%\phpsdk_version.bat
|
||||
echo.
|
||||
|
||||
if "%PHP_SDK_OS_ARCH%"=="x64" (
|
||||
echo OS architecture: 64-bit
|
||||
) 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_NUM%
|
||||
echo OS architecture: %PHP_SDK_OS_ARCH%
|
||||
echo Build architecture: %PHP_SDK_ARCH%
|
||||
echo Visual C++: %PHP_SDK_VC_TOOLSET_VER%
|
||||
echo PHP-SDK path: %PHP_SDK_ROOT_PATH%
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
@echo off
|
||||
|
||||
if "%PHP_SDK_PHP_CMD%"=="" (
|
||||
call %~dp0phpsdk_setvars.bat
|
||||
if "!PHP_SDK_PHP_CMD!"=="" (
|
||||
echo PHP SDK is not setup
|
||||
exit /b 3
|
||||
)
|
||||
)
|
||||
|
||||
cmd /c %PHP_SDK_PHP_CMD% %PHP_SDK_BIN_PATH%\phpsdk_pgo.php %*
|
||||
|
||||
exit /b %errorlevel%
|
||||
|
||||
@echo off
|
||||
|
||||
if "%PHP_SDK_PHP_CMD%"=="" (
|
||||
call %~dp0phpsdk_setvars.bat
|
||||
if "!PHP_SDK_PHP_CMD!"=="" (
|
||||
echo PHP SDK is not setup
|
||||
exit /b 3
|
||||
)
|
||||
)
|
||||
|
||||
cmd /c %PHP_SDK_PHP_CMD% %PHP_SDK_BIN_PATH%\phpsdk_pgo.php %*
|
||||
|
||||
exit /b %errorlevel%
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
|
||||
set PHPSDK_MSYS2_BASE_ADDR=0x70000000
|
||||
set PHPSDK_MSYS2_BASE_ADDR=0x100400000
|
||||
set PHPSDK_MSYS2_BASE_DYNAMIC=0
|
||||
|
||||
:getopt
|
||||
@@ -33,7 +33,7 @@ GOTO EXIT
|
||||
|
||||
:help
|
||||
echo phpsdk_rebase_msys2 ^<address^>
|
||||
echo Rebase MSYS2 DLLs to the given address. If ommited, default is 0x70000000.
|
||||
echo Rebase MSYS2 DLLs to the given address. If ommited, default is 0x100400000.
|
||||
|
||||
:EXIT
|
||||
exit /b %errorlevel%
|
||||
|
||||
@@ -15,91 +15,144 @@ if "%2"=="" goto :help
|
||||
|
||||
cmd /c "exit /b 0"
|
||||
|
||||
set PHP_SDK_VC=%1
|
||||
if /i not "%PHP_SDK_VC:~0,2%"=="vc" (
|
||||
set PHP_SDK_VS=%1
|
||||
if /i not "%PHP_SDK_VS:~0,2%"=="vc" (
|
||||
if /i not "%PHP_SDK_VS:~0,2%"=="vs" (
|
||||
:malformed_vc_string
|
||||
echo Malformed CRT string "%1"
|
||||
set PHP_SDK_VC=
|
||||
goto out_error
|
||||
echo Malformed CRT string "%1"
|
||||
set PHP_SDK_VS=
|
||||
goto out_error
|
||||
)
|
||||
)
|
||||
if ""=="%PHP_SDK_VC:~2%" (
|
||||
if ""=="%PHP_SDK_VS:~2%" (
|
||||
goto malformed_vc_string
|
||||
)
|
||||
set /a TMP_CHK=%PHP_SDK_VC:~2%
|
||||
set /a TMP_CHK=%PHP_SDK_VS:~2%
|
||||
if 14 gtr %TMP_CHK% (
|
||||
if "0"=="%TMP_CHK%" (
|
||||
if not "0"=="%PHP_SDK_VC:~2%" (
|
||||
if not "0"=="%PHP_SDK_VS:~2%" (
|
||||
set TMP_CHK=
|
||||
goto malformed_vc_string
|
||||
)
|
||||
)
|
||||
|
||||
echo At least vc14 is required
|
||||
set PHP_SDK_VC=
|
||||
set PHP_SDK_VS=
|
||||
set TMP_CHK=
|
||||
goto out_error
|
||||
)
|
||||
set PHP_SDK_VC_NUM=%TMP_CHK%
|
||||
set PHP_SDK_VS_NUM=%TMP_CHK%
|
||||
set TMP_CHK=
|
||||
|
||||
if /i not "%2"=="x64" (
|
||||
if /i not "%2"=="x86" (
|
||||
echo Unsupported arch "%2"
|
||||
goto out_error
|
||||
)
|
||||
rem check target arch
|
||||
if "%2"=="x86" set PHP_SDK_ARCH=%2
|
||||
if "%2"=="x64" set PHP_SDK_ARCH=%2
|
||||
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
|
||||
set TMPKEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion
|
||||
reg query "%TMPKEY%" /v "ProgramFilesDir (x86)" >nul 2>nul
|
||||
if not errorlevel 1 (
|
||||
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
|
||||
rem todo: allow user choose host sdk arch (i.e. x64 target can be compiled at x64(native) or x86(cross))
|
||||
for /f "usebackq tokens=1*" %%i in (`wmic cpu get Architecture /value /format:table ^| findstr /r "[1234567890][1234567890]*"`) do (
|
||||
set PHP_SDK_OS_ARCH_NUM=%%i
|
||||
)
|
||||
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
|
||||
if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
if /i "%PHP_SDK_OS_ARCH%"=="x64" (
|
||||
set TMPKEY=HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%PHP_SDK_VC:~2%.0\Setup\VC
|
||||
if 15 gtr %PHP_SDK_VS_NUM% (
|
||||
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
|
||||
) else (
|
||||
set TMPKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\%PHP_SDK_VC:~2%.0\Setup\VC
|
||||
set TMPKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\%PHP_SDK_VS:~2%.0\Setup\VC
|
||||
)
|
||||
reg query !TMPKEY! /v ProductDir >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Couldn't determine VC%PHP_SDK_VC:~2% directory
|
||||
echo Couldn't determine VC%PHP_SDK_VS:~2% directory
|
||||
goto out_error;
|
||||
)
|
||||
for /f "tokens=2*" %%a in ('reg query !TMPKEY! /v ProductDir') do set PHP_SDK_VC_DIR=%%b
|
||||
) else (
|
||||
rem vc15 support only for now, could parse out and pass on later
|
||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version %PHP_SDK_VC_NUM% -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do set PHP_SDK_VC_DIR=%%b\VC
|
||||
rem build the version range, e.g. "[15,16)"
|
||||
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 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
|
||||
)
|
||||
if not exist "!PHP_SDK_VC_DIR!" (
|
||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version %PHP_SDK_VC_NUM% -products Microsoft.VisualStudio.Product.BuildTools -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do set PHP_SDK_VC_DIR=%%b\VC
|
||||
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
|
||||
)
|
||||
if not exist "!PHP_SDK_VC_DIR!" (
|
||||
rem check for a preview release
|
||||
for /f "tokens=1* delims=: " %%a in ('%~dp0\vswhere -nologo -version %PHP_SDK_VC_NUM% -prerelease -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do set PHP_SDK_VC_DIR=%%b\VC
|
||||
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
|
||||
)
|
||||
if not exist "!PHP_SDK_VC_DIR!" (
|
||||
echo Could not determine '%PHP_SDK_VC%' directory
|
||||
echo Could not determine '%PHP_SDK_VS%' directory
|
||||
goto out_error;
|
||||
)
|
||||
)
|
||||
)
|
||||
set VSCMD_ARG_no_logo=nologo
|
||||
)
|
||||
set APPEND=
|
||||
set TMPKEY=
|
||||
set PHP_SDK_VS_RANGE=
|
||||
|
||||
if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
if 15 gtr %PHP_SDK_VS_NUM% (
|
||||
rem get sdk dir
|
||||
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
|
||||
) else (
|
||||
set TMPKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v10.0
|
||||
@@ -113,7 +166,8 @@ if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
)
|
||||
|
||||
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
|
||||
) else (
|
||||
set TMPKEY=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.1
|
||||
@@ -131,20 +185,40 @@ if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
)
|
||||
|
||||
if /i "%PHP_SDK_ARCH%"=="x64" (
|
||||
if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
set PHP_SDK_VC_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" amd64
|
||||
) else (
|
||||
set PHP_SDK_VC_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" amd64
|
||||
)
|
||||
set TARGET_ARCH_NAME=amd64
|
||||
) else (
|
||||
if 15 gtr %PHP_SDK_VC_NUM% (
|
||||
set PHP_SDK_VC_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" x86
|
||||
) else (
|
||||
set PHP_SDK_VC_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" x86
|
||||
)
|
||||
set TARGET_ARCH_NAME=%PHP_SDK_ARCH%
|
||||
)
|
||||
|
||||
rem echo Visual Studio path %PHP_SDK_VC_DIR%
|
||||
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 Windows SDK path %PHP_SDK_WIN_SDK_DIR%
|
||||
|
||||
|
||||
|
||||
@@ -17,5 +17,12 @@ set PHP_SDK_PHP_CMD=%PHP_SDK_BIN_PATH%\php\do_php.bat
|
||||
|
||||
set PATH=%PHP_SDK_BIN_PATH%;%PHP_SDK_MSYS2_PATH%;%PATH%
|
||||
|
||||
for /f "tokens=1* delims=: " %%a in ('link /?') do (
|
||||
set PHP_SDK_VC_TOOLSET_VER=%%b
|
||||
goto break0
|
||||
)
|
||||
:break0
|
||||
set PHP_SDK_VC_TOOLSET_VER=%PHP_SDK_VC_TOOLSET_VER:~-13%
|
||||
|
||||
exit /b %errorlevel%
|
||||
|
||||
|
||||
BIN
bin/vswhere.exe
BIN
bin/vswhere.exe
Binary file not shown.
@@ -18,7 +18,7 @@ rem netsh advfirewall set allprofiles state off
|
||||
|
||||
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
|
||||
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=UDP localport=%%p profile=private
|
||||
)
|
||||
|
||||
144
doc/task.c
144
doc/task.c
@@ -1,72 +1,72 @@
|
||||
/**
|
||||
* Run the passed command line hidden, suitable for a scheduled task.
|
||||
* Author: Anatol Belski <ab@php.net>
|
||||
* License: BSD 2-Clause
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define CMD_PRE "cmd.exe /c "
|
||||
#define CMD_PRE_LEN (sizeof(CMD_PRE)-1)
|
||||
|
||||
#ifdef DEBUG
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
#else
|
||||
int
|
||||
APIENTRY WinMain(HINSTANCE inst, HINSTANCE prev_inst, LPTSTR in_cmd, int show)
|
||||
#endif
|
||||
{
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
DWORD exit_code;
|
||||
|
||||
char *cmd = NULL;
|
||||
size_t cmd_len = 0, arg_len = 0;
|
||||
char *arg = strchr(GetCommandLine(), ' ');
|
||||
|
||||
if (!arg) {
|
||||
return 3;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("passed cmd: '%s'\n", arg);
|
||||
#endif
|
||||
|
||||
arg_len = strlen(arg);
|
||||
cmd_len = CMD_PRE_LEN + arg_len + 1;
|
||||
|
||||
cmd = malloc(cmd_len * sizeof(char));
|
||||
memmove(cmd, CMD_PRE, CMD_PRE_LEN);
|
||||
memmove(cmd + CMD_PRE_LEN, arg, arg_len);
|
||||
cmd[cmd_len-1] = '\0';
|
||||
#ifdef DEBUG
|
||||
printf("constructed cmd: '%s'\n", cmd);
|
||||
#endif
|
||||
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
si.cb = sizeof(si);
|
||||
si.dwFlags = STARTF_USESHOWWINDOW;
|
||||
si.wShowWindow = SW_HIDE;
|
||||
ZeroMemory( &pi, sizeof(pi) );
|
||||
|
||||
if (CreateProcess(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) {
|
||||
CloseHandle( pi.hThread );
|
||||
} else {
|
||||
free(cmd);
|
||||
printf( "Error: CreatePracess 0x%08lx \n", GetLastError() );
|
||||
return 3;
|
||||
}
|
||||
|
||||
WaitForSingleObject( pi.hProcess, INFINITE );
|
||||
|
||||
GetExitCodeProcess(pi.hProcess, &exit_code);
|
||||
|
||||
CloseHandle( pi.hProcess );
|
||||
|
||||
free(cmd);
|
||||
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the passed command line hidden, suitable for a scheduled task.
|
||||
* Author: Anatol Belski <ab@php.net>
|
||||
* License: BSD 2-Clause
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define CMD_PRE "cmd.exe /c "
|
||||
#define CMD_PRE_LEN (sizeof(CMD_PRE)-1)
|
||||
|
||||
#ifdef DEBUG
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
#else
|
||||
int
|
||||
APIENTRY WinMain(HINSTANCE inst, HINSTANCE prev_inst, LPTSTR in_cmd, int show)
|
||||
#endif
|
||||
{
|
||||
STARTUPINFO si;
|
||||
PROCESS_INFORMATION pi;
|
||||
DWORD exit_code;
|
||||
|
||||
char *cmd = NULL;
|
||||
size_t cmd_len = 0, arg_len = 0;
|
||||
char *arg = strchr(GetCommandLine(), ' ');
|
||||
|
||||
if (!arg) {
|
||||
return 3;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf("passed cmd: '%s'\n", arg);
|
||||
#endif
|
||||
|
||||
arg_len = strlen(arg);
|
||||
cmd_len = CMD_PRE_LEN + arg_len + 1;
|
||||
|
||||
cmd = malloc(cmd_len * sizeof(char));
|
||||
memmove(cmd, CMD_PRE, CMD_PRE_LEN);
|
||||
memmove(cmd + CMD_PRE_LEN, arg, arg_len);
|
||||
cmd[cmd_len-1] = '\0';
|
||||
#ifdef DEBUG
|
||||
printf("constructed cmd: '%s'\n", cmd);
|
||||
#endif
|
||||
|
||||
ZeroMemory( &si, sizeof(si) );
|
||||
si.cb = sizeof(si);
|
||||
si.dwFlags = STARTF_USESHOWWINDOW;
|
||||
si.wShowWindow = SW_HIDE;
|
||||
ZeroMemory( &pi, sizeof(pi) );
|
||||
|
||||
if (CreateProcess(NULL, cmd, NULL, NULL, FALSE, CREATE_NO_WINDOW, NULL, NULL, &si, &pi)) {
|
||||
CloseHandle( pi.hThread );
|
||||
} else {
|
||||
free(cmd);
|
||||
printf( "Error: CreatePracess 0x%08lx \n", GetLastError() );
|
||||
return 3;
|
||||
}
|
||||
|
||||
WaitForSingleObject( pi.hProcess, INFINITE );
|
||||
|
||||
GetExitCodeProcess(pi.hProcess, &exit_code);
|
||||
|
||||
CloseHandle( pi.hProcess );
|
||||
|
||||
free(cmd);
|
||||
|
||||
return exit_code;
|
||||
}
|
||||
|
||||
|
||||
@@ -130,19 +130,6 @@ abstract class PHP
|
||||
return true;
|
||||
}
|
||||
|
||||
public function is64bit() : bool
|
||||
{
|
||||
$cli = new CLI($this->conf, $this->scenario);
|
||||
|
||||
$out = shell_exec($cli->getExeFilename() . " -n -v");
|
||||
|
||||
if (preg_match(",x64,", $out, $m) > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Need to cleanup it somewhere. */
|
||||
public function getIniFilename()
|
||||
{
|
||||
@@ -153,7 +140,7 @@ abstract class PHP
|
||||
$this->conf->buildTplVarName("php", "error_log") => $this->getRootDir() . DIRECTORY_SEPARATOR . "pgo_run_error.log",
|
||||
);
|
||||
|
||||
$k = $this->is64bit() ? "x64" : "x86";
|
||||
$k = SDKConfig::getCurrentArchName();
|
||||
$scenario_vars = (array)$this->conf->getSectionItem("php", "scenario", $this->scenario, "ini", $k);
|
||||
if ($scenario_vars) {
|
||||
foreach ($scenario_vars as $k => $v) {
|
||||
@@ -240,7 +227,7 @@ abstract class PHP
|
||||
return $this->getVersion() . "-"
|
||||
. SDKConfig::getCurrentCrtName() . "-"
|
||||
. ($this->isThreadSafe() ? "ts" : "nts") . "-"
|
||||
. ($this->is64bit() ? "x64" : "x86")
|
||||
. SDKConfig::getCurrentArchName()
|
||||
. "-" . substr(md5(uniqid()), 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ class NGINX extends Abstracts\Server implements Interfaces\Server\HTTP
|
||||
$h = popen("start /b .\\nginx.exe 2>&1", "r");
|
||||
if (!is_resource($h)) {
|
||||
chdir($cwd);
|
||||
throw new Exception("Failed to start MariaDB.");
|
||||
throw new Exception("Failed to start NGINX.");
|
||||
}
|
||||
sleep(3);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class PGO
|
||||
$dll = array_merge($dll, glob($this->php->getExtRootDir() . DIRECTORY_SEPARATOR . "php*.dll"));
|
||||
|
||||
/* find out next index */
|
||||
$tpl = glob($this->php->getRootDir() . DIRECTORY_SEPARATOR . "php7{ts,}.dll", GLOB_BRACE)[0];
|
||||
$tpl = glob($this->php->getRootDir() . DIRECTORY_SEPARATOR . "php{7,8,}{ts,}.dll", GLOB_BRACE)[0];
|
||||
if (!$tpl) {
|
||||
throw new Exception("Couldn't find php7[ts].dll in the PHP root dir.");
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ use SDK\Build\Dependency\Fetcher;
|
||||
class Config
|
||||
{
|
||||
/* Config variables. */
|
||||
protected static $depsHost = 'windows.php.net';
|
||||
protected static $depsHost = 'downloads.php.net';
|
||||
protected static $depsPort = 443;
|
||||
protected static $depsUriScheme = "https";
|
||||
protected static $depsBaseUri = "/downloads/php-sdk/deps";
|
||||
protected static $depsBaseUri = "/~windows/php-sdk/deps";
|
||||
|
||||
/* protected static $sdkNugetFeedUrl = "http://127.0.0.1/sdk/nuget"; */
|
||||
|
||||
@@ -47,8 +47,8 @@ class Config
|
||||
{/*{{{*/
|
||||
$arch = strtolower($arch);
|
||||
|
||||
if ("x64" != $arch && "x86" != $arch) {
|
||||
throw new Exception("Unknown arch keyword, either x86 or x64 is accepted");
|
||||
if ("x64" != $arch && "x86" != $arch && "arm64" != $arch) {
|
||||
throw new Exception("Unknown arch keyword, x86 or x64 or arm64 is accepted");
|
||||
}
|
||||
|
||||
self::$currentArchName = $arch;
|
||||
@@ -57,20 +57,26 @@ class Config
|
||||
public static function getCurrentArchName() : string
|
||||
{/*{{{*/
|
||||
if (NULL === self::$currentArchName) {
|
||||
/* XXX this might be not true for other compilers! */
|
||||
passthru("where cl.exe >nul", $status);
|
||||
if ($status) {
|
||||
throw new Exception("Couldn't execute cl.exe.");
|
||||
}
|
||||
|
||||
exec("cl.exe /? 2>&1", $out);
|
||||
|
||||
if (preg_match(",x64,", $out[0])) {
|
||||
self::setCurrentArchName("x64");
|
||||
} elseif (preg_match(",x86,", $out[0])) {
|
||||
self::setCurrentArchName("x86");
|
||||
if (FALSE !== ($env = getenv('PHP_SDK_ARCH'))) {
|
||||
self::setCurrentArchName($env);
|
||||
} else {
|
||||
throw new Exception("Couldn't determine Arch.");
|
||||
/* XXX this might be not true for other compilers! */
|
||||
passthru("where cl.exe >nul", $status);
|
||||
if ($status) {
|
||||
throw new Exception("Couldn't execute cl.exe.");
|
||||
}
|
||||
|
||||
exec("cl.exe /? 2>&1", $out);
|
||||
|
||||
if (preg_match(",x64,", $out[0])) {
|
||||
self::setCurrentArchName("x64");
|
||||
} elseif (preg_match(",x86,", $out[0])) {
|
||||
self::setCurrentArchName("x86");
|
||||
} elseif (preg_match(",arm64,", $out[0])) {
|
||||
self::setCurrentArchName("arm64");
|
||||
} else {
|
||||
throw new Exception("Couldn't determine Arch.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,18 +91,22 @@ class Config
|
||||
public static function getCurrentCrtName() : ?string
|
||||
{/*{{{*/
|
||||
if (NULL === self::$currentCrtName) {
|
||||
$all_branches = Config::getKnownBranches();
|
||||
if (FALSE !== ($env = getenv('PHP_SDK_VS'))) {
|
||||
self::setCurrentCrtName($env);
|
||||
} else {
|
||||
$all_branches = Config::getKnownBranches();
|
||||
|
||||
if (!isset($all_branches[Config::getCurrentBranchName()])) {
|
||||
throw new Exception("Couldn't find any configuration for branch '" . Config::getCurrentBranchName() . "'");
|
||||
if (!isset($all_branches[Config::getCurrentBranchName()])) {
|
||||
throw new Exception("Couldn't find any configuration for branch '" . Config::getCurrentBranchName() . "'");
|
||||
}
|
||||
|
||||
$branch = $all_branches[Config::getCurrentBranchName()];
|
||||
if (count($branch) > 1) {
|
||||
throw new Exception("Multiple CRTs are available for this branch, please choose one from " . implode(",", array_keys($branch)));
|
||||
}
|
||||
|
||||
self::setCurrentCrtName(array_keys($branch)[0]);
|
||||
}
|
||||
|
||||
$branch = $all_branches[Config::getCurrentBranchName()];
|
||||
if (count($branch) > 1) {
|
||||
throw new Exception("Multiple CRTs are available for this branch, please choose one from " . implode(",", array_keys($branch)));
|
||||
}
|
||||
|
||||
self::setCurrentCrtName(array_keys($branch)[0]);
|
||||
}
|
||||
|
||||
return self::$currentCrtName;
|
||||
@@ -138,7 +148,7 @@ class Config
|
||||
$tmp = $fetcher->getByUri(self::$depsBaseUri . "/series/");
|
||||
if (false !== $tmp) {
|
||||
$data = array();
|
||||
if (preg_match_all(",/packages-(.+)-(vc\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) {
|
||||
if (!isset($data[$b[1]])) {
|
||||
$data[$b[1]] = array();
|
||||
@@ -268,7 +278,7 @@ class Config
|
||||
}
|
||||
}
|
||||
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];
|
||||
} else {
|
||||
@@ -276,7 +286,7 @@ class Config
|
||||
$crt = key($branches[$current_branch_name]);
|
||||
$data = $branches[$current_branch_name][$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'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,10 +303,13 @@ class Config
|
||||
}
|
||||
}
|
||||
|
||||
if (!@$ret["stability"]) {
|
||||
if (!isset($ret["arch"]) || !$ret["arch"]) {
|
||||
throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'");
|
||||
}
|
||||
if (!isset($ret["stability"]) || !$ret["stability"]) {
|
||||
throw new Exception("Failed to find config with stability '" . self::getCurrentStabilityName() . "'");
|
||||
}
|
||||
if (!@$ret["crt"]) {
|
||||
if (!isset($ret["crt"]) || !$ret["crt"]) {
|
||||
throw new Exception("Failed to find config with arch '" . self::getCurrentArchName() . "'");
|
||||
}
|
||||
|
||||
|
||||
@@ -137,6 +137,9 @@ retry:
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName());
|
||||
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);
|
||||
|
||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
|
||||
@@ -66,6 +66,9 @@ class Lock
|
||||
} else {
|
||||
$this->fd = fopen($this->fn, "wb");
|
||||
}
|
||||
if (false === $this->fd) {
|
||||
throw new Exception("Failed to open lock under '$this->fn'");
|
||||
}
|
||||
$this->locked = flock($this->fd, $flags, $this->wouldBlock);
|
||||
return $this->locked;
|
||||
}/*}}}*/
|
||||
|
||||
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
msys2/usr/bin/msys-gcc_s-seh-1.dll
Executable file
BIN
msys2/usr/bin/msys-gcc_s-seh-1.dll
Executable file
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.
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.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user