mirror of
https://github.com/php-win-ext/php-sdk-binary-tools.git
synced 2026-03-24 17:12:12 +01:00
Compare commits
88 Commits
php-sdk-2.
...
php-sdk-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d552f7118b | ||
|
|
f77a7e791a | ||
|
|
024c694807 | ||
|
|
5c7c222e8f | ||
|
|
9fe493edf7 | ||
|
|
5d51577cd5 | ||
|
|
cad50539cf | ||
|
|
6b50dabf00 | ||
|
|
f5f5620c55 | ||
|
|
139ea9a86d | ||
|
|
cf054fd362 | ||
|
|
2635a7936a | ||
|
|
9414d3a55c | ||
|
|
36f67d7cce | ||
|
|
e5b9fb320c | ||
|
|
edb52f1c34 | ||
|
|
aeeddd2e34 | ||
|
|
0236c6ec39 | ||
|
|
7eaaa4b6e9 | ||
|
|
72c2c103bc | ||
|
|
71bf098e04 | ||
|
|
b693b485b7 | ||
|
|
a4ab6b98d8 | ||
|
|
833eb864e8 | ||
|
|
b56aa4c288 | ||
|
|
9dc14d6f1e | ||
|
|
9134ee4718 | ||
|
|
2849ea89a8 | ||
|
|
c84a5d8303 | ||
|
|
e350e99ba6 | ||
|
|
67bf1f579a | ||
|
|
8fadf1d33d | ||
|
|
f7d859266b | ||
|
|
c6c77737aa | ||
|
|
5ccc58cab5 | ||
|
|
9c3d40ab02 | ||
|
|
c0941efae5 | ||
|
|
49217155a3 | ||
|
|
b0f5cef8bd | ||
|
|
18d0b098ff | ||
|
|
fc185fd315 | ||
|
|
94ff7b53cf | ||
|
|
217647a68e | ||
|
|
52df9f9f4e | ||
|
|
4fb69d4c23 | ||
|
|
e99ec6722c | ||
|
|
8fecd7c279 | ||
|
|
97b62b2182 | ||
|
|
2d4aa4d54b | ||
|
|
0267758ff1 | ||
|
|
ca2ccd968a | ||
|
|
422073f540 | ||
|
|
08fbbc7cd2 | ||
|
|
182f988f92 | ||
|
|
022eaba41e | ||
|
|
2a403e1820 | ||
|
|
07efa67e87 | ||
|
|
e74a98e253 | ||
|
|
04aaf65cda | ||
|
|
33c82a766f | ||
|
|
efb77f4589 | ||
|
|
cddbe84fe3 | ||
|
|
6326bba7a1 | ||
|
|
fdf6827c51 | ||
|
|
feb2b675cb | ||
|
|
b60fd588d5 | ||
|
|
4af7617b84 | ||
|
|
7395237e33 | ||
|
|
2bd2595a16 | ||
|
|
3c204136a2 | ||
|
|
ac205e153f | ||
|
|
71f60852f8 | ||
|
|
5999098add | ||
|
|
9f8cf17928 | ||
|
|
496a4498a1 | ||
|
|
1162213596 | ||
|
|
c8e1563cd4 | ||
|
|
9b139a61c8 | ||
|
|
bf84962182 | ||
|
|
d87c132a7e | ||
|
|
c781649433 | ||
|
|
bd8b82579f | ||
|
|
d6b76e7f7d | ||
|
|
7f0015a68c | ||
|
|
23a3eb2473 | ||
|
|
296be1b3b4 | ||
|
|
3ec0ac9d0b | ||
|
|
baf09da395 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -14,3 +14,7 @@ logs
|
||||
PFTT
|
||||
\.tmp
|
||||
\.cache
|
||||
oracle
|
||||
# either these two become submodules, or uncomment them
|
||||
#pgo-build
|
||||
#rmtools*
|
||||
|
||||
96
README.md
96
README.md
@@ -4,53 +4,107 @@ PHP SDK is a tool kit for Windows PHP builds
|
||||
|
||||
# License
|
||||
|
||||
BSD
|
||||
The PHP SDK itself and the SDK own tools are licensed under the BSD 2-Clause license. With the usage of the other tools, you accept the respective licenses.
|
||||
|
||||
# Notes
|
||||
# Overview
|
||||
|
||||
This reworked SDK is compatible with PHP 7.0 and above. The compatibility with php-sdk-binary-tools-20110915.zip available from windows.php.net is kept, though some irrelevant tools was removed. Though, newer tools and workflows are now possible, and the work is in progress. The toolset consists on a mix of the hand written scripts, selected MSYS2 parts and standalone programs.
|
||||
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. 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.
|
||||
|
||||
## SDK tools
|
||||
# Requirements
|
||||
|
||||
- `Visual C++ 2015` or `Visual C++ 2017` must be installed prior SDK usage
|
||||
- if `Cygwin` 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
|
||||
|
||||
# Tools
|
||||
|
||||
All the tools included are either scripts or 32-bit binaries. They are therefore runable on any of x86 or x64 Windows system.
|
||||
|
||||
## SDK
|
||||
|
||||
- starter scripts, named phpsdk-<crt>-<arch>.bat
|
||||
- `phpsdk_buildtree` - initialize the development filesystem structure
|
||||
- `phpsdk_deps` - check and handle dependency libraries
|
||||
- `phpsdk_deps` - handle dependency libraries
|
||||
- `phpsdk_version` - show SDK version
|
||||
- `phpsdk_dllmap` - create a JSON listing of DLLs contained in zip files
|
||||
- `task.exe` - wrapper to hide the given command line
|
||||
|
||||
## Other available tools
|
||||
## Other tools
|
||||
|
||||
- `bison` 3.0.2, `re2c` 0.15.3
|
||||
- `bison` 3.0.2, `re2c` 0.15.3, `lemon`
|
||||
- `awk`, `gawk`, `sed`, `grep`
|
||||
- `diff`, `diff3`, `patch`
|
||||
- `md5sum`, `sha1sum`, `sha224sum`, `sha256sum`, `sha384sum`, `sha512sum`
|
||||
- `7za`, `zip`, `unzip`
|
||||
- `7za`, `zip`, `unzip`, `unzipsfx`
|
||||
- `wget`
|
||||
|
||||
## Not included
|
||||
## Optional, not included
|
||||
|
||||
These are not included with the PHP SDK, but might be useful for the compilation and other tasks. While Visual C++ is the only required, the others might enable some additional functionality. Care yourself about making them available on your system.
|
||||
These are not included with the PHP SDK, but might be useful. While Visual C++ is the only required, the others might enable some additional functionality. Care yourself about making them available on your system, if relevant.
|
||||
|
||||
- Visual C++
|
||||
- clang
|
||||
- ICC
|
||||
- Git
|
||||
- Cppcheck
|
||||
- `Git` - useful for PHP source management
|
||||
- `Cppcheck` - used for static analysis
|
||||
- `clang` - useful for experimental builds and for static analysis
|
||||
- `ICC` - useful for experimental builds
|
||||
|
||||
# Usage
|
||||
|
||||
## Basic usage
|
||||
The PHP SDK should be unzipped into the shortest possible path, preferrably 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.
|
||||
|
||||
It is not required to hold the source in the PHP SDK directory. It could be useful, for example, to simplify the SDK updates.
|
||||
|
||||
## Basic usage example
|
||||
|
||||
- `git clone https://github.com/OSTC/php-sdk-binary-tools.git c:\php-sdk`
|
||||
- `cd c:\php-sdk`
|
||||
- `git checkout new_binary_tools`
|
||||
- `cd` to c:\php-sdk and click one of the `phpsdk-*.bat` files in the SDK root, depending on the desired build parameters
|
||||
- `phpsdk_buildtree && git clone https://github.com/php/php-src.git`, or fetch a zipball from windows.php.net
|
||||
- while in php-src, run `phpsdk_deps --update --branch YOUR_BRANCH_NAME`
|
||||
- invoke `phpsdk-vc14-x64.bat`
|
||||
- `phpsdk_buildtree phpmaster`
|
||||
- `git clone https://github.com/php/php-src.git && cd php-src`, or fetch a zipball
|
||||
- `phpsdk_deps --update --branch master`
|
||||
- do the build, eg. `buildconf && configure --enable-cli && nmake`
|
||||
|
||||
TODO more extensive documentation on the wiki
|
||||
TODO more extensive documentation on the wiki.
|
||||
|
||||
## Staying compatible with the older version of the SDK
|
||||
## The old way
|
||||
|
||||
- `git clone https://github.com/OSTC/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
|
||||
|
||||
## Custom environment setup
|
||||
|
||||
A sript called phpsdk-local.bat has to be put into the PHP SDK root. If present, it will be automatically picked up by the starter script. A template for such a script is included with the PHP SDK. This allows to automatically meet any required preparations, that are not foreseen by the standard PHP SDK startup. Be careful while creating your own phpsdk-local. It's your responsibility to ensure the regular PHP SDK startup isn't broken after phpsdk-local was injected into the startup sequence.
|
||||
|
||||
## Console emulator integration
|
||||
|
||||
The starter scripts can be also easy integrated with the consoles other than standard cmd.exe. For the reference, here's an example ConEmu task
|
||||
|
||||
`C:\php-sdk\phpsdk-vc14-x64.bat -cur_console:d:C:\php-sdk\php70\vc14\x64\php-src`
|
||||
|
||||
## Unattended builds
|
||||
|
||||
An elementary functionality to run unattended builds is included. See an example on how to setup a simple unattended build task in the doc directory.
|
||||
|
||||
# Upgrading
|
||||
|
||||
- backup phpsdk-local.bat
|
||||
- backup the source trees and any other custom files in the PHP SDK root
|
||||
- move the PHP SDK folder into trash
|
||||
- download, unpack and the new PHP SDK version under the same path
|
||||
- move the custom files back into their respective places
|
||||
|
||||
# Extending
|
||||
|
||||
The SDK tools are based on the KISS principle and should be kept so. Basic tools are implemented as simple batch script. The minimalistic `PHP` is available for internal SDK purposes. It can be used, if more complexity is required. If you have an idea for some useful tool or workflow, please open a ticket or PR, so it can be discussed, implemented and added to the SDK. By contributing an implementation, you should also accept the SDK license.
|
||||
|
||||
# Pitfalls
|
||||
|
||||
- SDK or PHP sources put into paths including spaces might cause issue.
|
||||
- SDK or PHP sources put into too long paths, will cause an issue.
|
||||
- If Cygwin is installed, it might cause issues. If it's unavoidable, to have Cygwin on the same machine, ensure SDK preceeds it on the PATH.
|
||||
- Tools, based on MSYS2, only accept paths with forward slashes.
|
||||
|
||||
|
||||
BIN
bin/deplister.exe
Normal file
BIN
bin/deplister.exe
Normal file
Binary file not shown.
BIN
bin/lemon.exe
Normal file
BIN
bin/lemon.exe
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/php/ext/php_mbstring.dll
Normal file
BIN
bin/php/ext/php_mbstring.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/php/php.exe
BIN
bin/php/php.exe
Binary file not shown.
@@ -3,4 +3,9 @@ extension=php_curl.dll
|
||||
extension=php_ftp.dll
|
||||
extension=php_sqlite3.dll
|
||||
extension=php_openssl.dll
|
||||
memory_limit=1G
|
||||
extension=php_mbstring.dll
|
||||
memory_limit=1G
|
||||
|
||||
error_reporting=-1
|
||||
display_errors=1
|
||||
display_startup_errors=1
|
||||
|
||||
BIN
bin/php/php7.dll
BIN
bin/php/php7.dll
Binary file not shown.
Binary file not shown.
@@ -4,33 +4,29 @@ IF "%1" EQU "" GOTO Help
|
||||
IF "%2" NEQ "" SET _=%2\%1
|
||||
IF "%2" EQU "" SET _=%CD%\%1
|
||||
|
||||
MD %_%\vc9\x86\deps\bin
|
||||
MD %_%\vc9\x86\deps\lib
|
||||
MD %_%\vc9\x86\deps\include
|
||||
MD %_%\vc9\x64\deps\bin
|
||||
MD %_%\vc9\x64\deps\lib
|
||||
MD %_%\vc9\x64\deps\include
|
||||
rem if we're in the starter script shell, create the only struct that corresponds to the current env
|
||||
rem otherwise - retain the old behavior, create structs for all the known build combinations and don't cd
|
||||
|
||||
MD %_%\vc11\x86\deps\bin
|
||||
MD %_%\vc11\x86\deps\lib
|
||||
MD %_%\vc11\x86\deps\include
|
||||
MD %_%\vc11\x64\deps\bin
|
||||
MD %_%\vc11\x64\deps\lib
|
||||
MD %_%\vc11\x64\deps\include
|
||||
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%
|
||||
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
|
||||
)
|
||||
|
||||
MD %_%\vc12\x86\deps\bin
|
||||
MD %_%\vc12\x86\deps\lib
|
||||
MD %_%\vc12\x86\deps\include
|
||||
MD %_%\vc12\x64\deps\bin
|
||||
MD %_%\vc12\x64\deps\lib
|
||||
MD %_%\vc12\x64\deps\include
|
||||
|
||||
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
|
||||
set _=
|
||||
|
||||
GOTO EXIT
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
@echo off
|
||||
|
||||
if "%PHP_SDK_PHP_CMD%"=="" (
|
||||
echo PHP SDK is not setup
|
||||
exit 3
|
||||
call %~dp0phpsdk_setvars.bat
|
||||
if "!PHP_SDK_PHP_CMD!"=="" (
|
||||
echo PHP SDK is not setup
|
||||
exit /b 3
|
||||
)
|
||||
)
|
||||
|
||||
call %PHP_SDK_PHP_CMD% %PHP_SDK_BIN_PATH%\phpsdk_deps.php %*
|
||||
|
||||
@@ -224,3 +224,11 @@ function msg(string $s, int $code = 0) {
|
||||
|
||||
exit(0);
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
@echo off
|
||||
|
||||
if "%PHP_SDK_PHP_CMD%"=="" (
|
||||
echo PHP SDK is not setup
|
||||
exit 3
|
||||
call %~dp0phpsdk_setvars.bat
|
||||
if "!PHP_SDK_PHP_CMD!"=="" (
|
||||
echo PHP SDK is not setup
|
||||
exit /b 3
|
||||
)
|
||||
)
|
||||
|
||||
call %PHP_SDK_PHP_CMD% %PHP_SDK_BIN_PATH%\phpsdk_dllmap.php %*
|
||||
|
||||
@@ -102,3 +102,11 @@ foreach ($dirs as $path) {
|
||||
|
||||
echo json_encode($out);
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
@echo off
|
||||
|
||||
if "%PHP_SDK_OS_ARCH%"=="" (
|
||||
echo PHP SDK is not setup
|
||||
exit /b 3
|
||||
)
|
||||
|
||||
echo.
|
||||
|
||||
call %PHP_SDK_BIN_PATH%\phpsdk_version.bat
|
||||
echo.
|
||||
|
||||
@@ -16,7 +23,7 @@ if "%PHP_SDK_ARCH%"=="x64" (
|
||||
)
|
||||
|
||||
echo Visual C++: %PHP_SDK_VC:~2%
|
||||
echo PHP-SDK path: %PHP_SDK_PATH%
|
||||
echo PHP-SDK path: %PHP_SDK_ROOT_PATH%
|
||||
|
||||
|
||||
exit /b
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
@echo off
|
||||
|
||||
if not defined PHP_SDK_RUN_FROM_ROOT (
|
||||
echo phpsdk_shell.bat should not be run directly, use starter scripts in the PHP SDK root
|
||||
echo This script should not be run directly.
|
||||
echo Use starter scripts looking like phpsdk-^<crt^>-^<arch^>.bat in the PHP SDK root instead.
|
||||
goto out_error
|
||||
)
|
||||
|
||||
@@ -13,8 +14,10 @@ if "%1"=="--help" goto :help
|
||||
if "%2"=="" goto :help
|
||||
|
||||
if /i not "%1"=="vc14" (
|
||||
if /i not "%1"=="vc15" (
|
||||
echo Unsupported runtime "%1"
|
||||
goto out_error
|
||||
)
|
||||
)
|
||||
|
||||
if /i not "%2"=="x64" (
|
||||
@@ -42,41 +45,56 @@ if not errorlevel 1 (
|
||||
set TMPKEY=
|
||||
|
||||
rem get vc base dir
|
||||
if /i "%PHP_SDK_OS_ARCH%"=="x64" (
|
||||
set TMPKEY=HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%PHP_SDK_VC:~2%.0\Setup\VC
|
||||
) else (
|
||||
set TMPKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\%PHP_SDK_VC:~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
|
||||
goto out_error;
|
||||
)
|
||||
for /f "tokens=2*" %%a in ('reg query !TMPKEY! /v ProductDir') do set PHP_SDK_VC_DIR=%%b
|
||||
set TMPKEY=
|
||||
|
||||
rem get sdk dir
|
||||
if /i "%PHP_SDK_OS_ARCH%"=="x64" (
|
||||
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
|
||||
)
|
||||
for /f "tokens=2*" %%a in ('reg query "!TMPKEY!" /v InstallationFolder') do (
|
||||
if exist "%%b\Include\um\Windows.h" (
|
||||
set PHP_SDK_WIN_SDK_DIR=%%b
|
||||
if /i "%1"=="vc14" (
|
||||
if /i "%PHP_SDK_OS_ARCH%"=="x64" (
|
||||
set TMPKEY=HKLM\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%PHP_SDK_VC:~2%.0\Setup\VC
|
||||
) else (
|
||||
set TMPKEY=HKLM\SOFTWARE\Microsoft\VisualStudio\%PHP_SDK_VC:~2%.0\Setup\VC
|
||||
)
|
||||
)
|
||||
if not defined PHP_SDK_WIN_SDK_DIR (
|
||||
echo Windows SDK not found.
|
||||
goto out_error;
|
||||
reg query !TMPKEY! /v ProductDir >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Couldn't determine VC%PHP_SDK_VC:~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 15 -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text') do set PHP_SDK_VC_DIR=%%b\VC
|
||||
set VSCMD_ARG_no_logo=nologo
|
||||
)
|
||||
set TMPKEY=
|
||||
|
||||
if /i "%PHP_SDK_VC%"=="vc14" (
|
||||
rem get sdk dir
|
||||
if /i "%PHP_SDK_OS_ARCH%"=="x64" (
|
||||
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
|
||||
)
|
||||
for /f "tokens=2*" %%a in ('reg query "!TMPKEY!" /v InstallationFolder') do (
|
||||
if exist "%%b\Include\um\Windows.h" (
|
||||
set PHP_SDK_WIN_SDK_DIR=%%b
|
||||
)
|
||||
)
|
||||
if not defined PHP_SDK_WIN_SDK_DIR (
|
||||
echo Windows SDK not found.
|
||||
goto out_error;
|
||||
)
|
||||
set TMPKEY=
|
||||
)
|
||||
|
||||
if /i "%PHP_SDK_ARCH%"=="x64" (
|
||||
set PHP_SDK_VC_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" amd64
|
||||
if /i "%1"=="vc14" (
|
||||
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
|
||||
)
|
||||
) else (
|
||||
set PHP_SDK_VC_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" x86
|
||||
if /i "%1"=="vc14" (
|
||||
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
|
||||
)
|
||||
)
|
||||
|
||||
rem echo Visual Studio path %PHP_SDK_VC_DIR%
|
||||
|
||||
@@ -6,11 +6,11 @@ set PHP_SDK_BIN_PATH=%~dp0
|
||||
rem remove trailing slash
|
||||
set PHP_SDK_BIN_PATH=%PHP_SDK_BIN_PATH:~0,-1%
|
||||
|
||||
for %%a in ("%PHP_SDK_BIN_PATH%") do set PHP_SDK_PATH=%%~dpa
|
||||
for %%a in ("%PHP_SDK_BIN_PATH%") do set PHP_SDK_ROOT_PATH=%%~dpa
|
||||
rem remove trailing slash
|
||||
set PHP_SDK_PATH=%PHP_SDK_PATH:~0,-1%
|
||||
set PHP_SDK_ROOT_PATH=%PHP_SDK_ROOT_PATH:~0,-1%
|
||||
|
||||
set PHP_SDK_MSYS2_PATH=%PHP_SDK_PATH%\msys2\usr\bin
|
||||
set PHP_SDK_MSYS2_PATH=%PHP_SDK_ROOT_PATH%\msys2\usr\bin
|
||||
set PHP_SDK_PHP_CMD=%PHP_SDK_BIN_PATH%\php\do_php.bat
|
||||
|
||||
set PATH=%PHP_SDK_BIN_PATH%;%PHP_SDK_MSYS2_PATH%;%PATH%
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
@echo off
|
||||
|
||||
%PHP_SDK_PHP_CMD% -r "echo 'PHP SDK ' . file_get_contents(getenv('PHP_SDK_PATH') . '\\VERSION');"
|
||||
if "%PHP_SDK_PHP_CMD%"=="" (
|
||||
call %~dp0phpsdk_setvars.bat
|
||||
if "!PHP_SDK_PHP_CMD!"=="" (
|
||||
echo PHP SDK is not setup
|
||||
exit /b 3
|
||||
)
|
||||
)
|
||||
|
||||
%PHP_SDK_PHP_CMD% -r "echo 'PHP SDK ' . file_get_contents(getenv('PHP_SDK_ROOT_PATH') . '\\VERSION');"
|
||||
|
||||
exit /b
|
||||
|
||||
|
||||
BIN
bin/task.exe
Normal file
BIN
bin/task.exe
Normal file
Binary file not shown.
BIN
bin/vswhere.exe
Normal file
BIN
bin/vswhere.exe
Normal file
Binary file not shown.
20
doc/phpsdk-local.bat.example
Normal file
20
doc/phpsdk-local.bat.example
Normal file
@@ -0,0 +1,20 @@
|
||||
@echo off
|
||||
|
||||
set PGSQL_TEST_CONNSTR=host=127.0.0.1 dbname=test port=5432 user=test password=test
|
||||
set PDO_PGSQL_TEST_DSN=pgsql:host=127.0.0.1 port=5432 dbname=test user=test password=test
|
||||
|
||||
set PHP_SDK_FIREBIRD_PATH=
|
||||
if "%PHP_SDK_ARCH%"=="x64" (
|
||||
set PHP_SDK_FIREBIRD_PATH=E:\local_programs\Firebird-2.5.5.26952-0_x64\bin;
|
||||
set PDO_FIREBIRD_TEST_DSN=firebird:dbname=127.0.0.1:E:\local_programs\Firebird-2.5.5.26952-0_x64\examples\empbuild\EMPLOYEE.FDB
|
||||
set PDO_FIREBIRD_TEST_USER=SYSDBA
|
||||
set PDO_FIREBIRD_TEST_PASS=masterkey
|
||||
)
|
||||
set PATH=%PHP_SDK_FIREBIRD_PATH%%PATH%
|
||||
|
||||
set ODBC_TEST_USER=php_test2
|
||||
set ODBC_TEST_PASS=php_test2
|
||||
set ODBC_TEST_DSN=Driver={SQL Server};Server={W530-PHP-DEV\TEST2014};Database={php_test2};uid=%ODBC_TEST_USER%;pwd=%ODBC_TEST_PASS%
|
||||
|
||||
set PDOTEST_DSN=odbc:%ODBC_TEST_DSN%
|
||||
|
||||
72
doc/task.c
Normal file
72
doc/task.c
Normal file
@@ -0,0 +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;
|
||||
}
|
||||
|
||||
26
doc/unattended-build-task.bat.example
Normal file
26
doc/unattended-build-task.bat.example
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
rem Task batch example.
|
||||
rem Create a task, put an action with the following data:
|
||||
rem Action: start a program
|
||||
rem Program/script: C:\php-sdk\bin\task.exe
|
||||
rem Add arguments: "C:\php-sdk\phpsdk-starter.bat -c vc14 -a x64 -t C:\php-sdk\unattended-build-task.bat"
|
||||
rem Run the task
|
||||
|
||||
set LOG_NAME=%PHP_SDK_VC%-%PHP_SDK_ARCH%-task.log
|
||||
|
||||
pushd C:\php-sdk\php70\vc14\x64\php-src
|
||||
|
||||
git pull --rebase > %LOG_NAME% 2>&1
|
||||
|
||||
call phpsdk_deps -u -s staging >> %LOG_NAME% 2>&1
|
||||
|
||||
call buildconf >> %LOG_NAME% 2>&1
|
||||
call configure --enable-snapshot-build --enable-debug-pack >> %LOG_NAME% 2>&1
|
||||
|
||||
nmake clean >> %LOG_NAME% 2>&1
|
||||
nmake >> %LOG_NAME% 2>&1
|
||||
|
||||
popd
|
||||
|
||||
exit
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace SDK\Dependency;
|
||||
namespace SDK;
|
||||
|
||||
use SDK\Config;
|
||||
use SDK\Cache;
|
||||
use SDK\Exception;
|
||||
|
||||
class Cache
|
||||
@@ -11,14 +12,14 @@ class Cache
|
||||
protected $hash;
|
||||
|
||||
public function __construct(string $id)
|
||||
{
|
||||
{/*{{{*/
|
||||
$this->id = $id;
|
||||
$this->hash = md5($id);
|
||||
/* XXX pass as arg, fine for now. */
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
protected function getCacheablePath(string $path, bool $relative = false) : string
|
||||
{
|
||||
{/*{{{*/
|
||||
if ($relative) {
|
||||
$dir = Config::getCacheDir();
|
||||
$name = $path;
|
||||
@@ -28,15 +29,15 @@ class Cache
|
||||
}
|
||||
|
||||
return $dir . DIRECTORY_SEPARATOR . $this->hash . "." . $name;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function fileIsCached(string $path, bool $relative = false) : bool
|
||||
{
|
||||
{/*{{{*/
|
||||
return file_exists($this->getCacheablePath($path, $relative));
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function cachedContentDiffers(string $path, string $content, bool $relative = false) : bool
|
||||
{
|
||||
{/*{{{*/
|
||||
$p = $this->getCacheablePath($path, $relative);
|
||||
|
||||
if (!file_exists($p)) {
|
||||
@@ -47,19 +48,19 @@ class Cache
|
||||
$new_sum = md5($content);
|
||||
|
||||
return $old_sum != $new_sum;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function cacheContent(string $path, string $content, bool $relative = false)
|
||||
{
|
||||
{/*{{{*/
|
||||
$p = $this->getCacheablePath($path, $relative);
|
||||
|
||||
if (strlen($content) !== file_put_contents($p, $content)) {
|
||||
throw new Exception("Couldn't cache '$p'");
|
||||
}
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function getCachedContent(string $path, bool $relative = false)
|
||||
{
|
||||
{/*{{{*/
|
||||
$p = $this->getCacheablePath($path, $relative);
|
||||
|
||||
if ($this->isFileCached($p)) {
|
||||
@@ -67,6 +68,14 @@ class Cache
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
}/*}}}*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace SDK;
|
||||
|
||||
use SDK\Dependency\Fetcher;
|
||||
use SDK\Dependency\Cache;
|
||||
use SDK\Cache;
|
||||
use SDK\Exception;
|
||||
|
||||
class Config
|
||||
@@ -25,50 +25,52 @@ class Config
|
||||
protected static $depsLocalPath = NULL;
|
||||
|
||||
public static function getDepsHost() : string
|
||||
{
|
||||
{/*{{{*/
|
||||
return self::$depsHost;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function getDepsPort() : string
|
||||
{
|
||||
{/*{{{*/
|
||||
return self::$depsPort;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function getDepsBaseUri() : string
|
||||
{
|
||||
{/*{{{*/
|
||||
return self::$depsBaseUri;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function setCurrentArchName(string $arch)
|
||||
{
|
||||
{/*{{{*/
|
||||
self::$currentArchName = $arch;
|
||||
}
|
||||
} /*}}}*/
|
||||
|
||||
public static function getCurrentArchName()
|
||||
{
|
||||
{/*{{{*/
|
||||
return self::$currentArchName;
|
||||
}
|
||||
} /*}}}*/
|
||||
|
||||
public static function setCurrentCrtName(string $crt)
|
||||
{
|
||||
{/*{{{*/
|
||||
self::$currentCrtName = $crt;
|
||||
}
|
||||
} /*}}}*/
|
||||
|
||||
public static function getCurrentCrtName()
|
||||
{
|
||||
{/*{{{*/
|
||||
return self::$currentCrtName;
|
||||
}
|
||||
} /*}}}*/
|
||||
|
||||
public static function setCurrentStabilityName(string $stability)
|
||||
{
|
||||
{/*{{{*/
|
||||
self::$currentStabilityName = $stability;
|
||||
}
|
||||
} /*}}}*/
|
||||
|
||||
public static function getCurrentStabilityName()
|
||||
{
|
||||
{/*{{{*/
|
||||
return self::$currentStabilityName;
|
||||
}
|
||||
} /*}}}*/
|
||||
|
||||
public static function getKnownBranches() : array
|
||||
{
|
||||
{/*{{{*/
|
||||
if (empty(self::$knownBranches)) {
|
||||
$cache_file = "known_branches.txt";
|
||||
$cache = new Cache(self::getDepsLocalPath());
|
||||
@@ -101,24 +103,24 @@ class Config
|
||||
}
|
||||
|
||||
return self::$knownBranches;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function setCurrentBranchName(string $name)
|
||||
{
|
||||
{/*{{{*/
|
||||
if (!array_key_exists($name, self::getKnownBranches())) {
|
||||
// throw new Exception("Unsupported branch '$name'");
|
||||
}
|
||||
|
||||
self::$currentBranchName = $name;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function getCurrentBranchName()
|
||||
{
|
||||
{/*{{{*/
|
||||
return self::$currentBranchName;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function getCurrentBranchData() : array
|
||||
{
|
||||
{/*{{{*/
|
||||
$ret = array();
|
||||
$branches = self::getKnownBranches();
|
||||
|
||||
@@ -132,8 +134,14 @@ class Config
|
||||
throw new Exception("More than one CRT is available for branch '" . self::$currentBranchName . "', pass one explicitly.");
|
||||
}
|
||||
|
||||
$crt = array_keys($branches[self::$currentBranchName])[0];
|
||||
if ($cur_crt != $crt) {
|
||||
$cur_crt_usable = false;
|
||||
foreach (array_keys($branches[self::$currentBranchName]) as $crt) {
|
||||
if ($cur_crt == $crt) {
|
||||
$cur_crt_usable = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$cur_crt_usable) {
|
||||
throw new Exception("The passed CRT '$cur_crt' doesn't match any availbale for branch '" . self::$currentBranchName . "'");
|
||||
}
|
||||
$data = $branches[self::$currentBranchName][$cur_crt];
|
||||
@@ -166,19 +174,19 @@ class Config
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function getSdkNugetFeedUrl() : string
|
||||
{
|
||||
{/*{{{*/
|
||||
return self::$sdkNugetFeedUrl;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function getSdkPath()
|
||||
{
|
||||
$path = getenv("PHP_SDK_PATH");
|
||||
{/*{{{*/
|
||||
$path = getenv("PHP_SDK_ROOT_PATH");
|
||||
|
||||
if (!$path) {
|
||||
throw new Exception("PHP_SDK_PATH isn't set!");
|
||||
throw new Exception("PHP_SDK_ROOT_PATH isn't set!");
|
||||
}
|
||||
|
||||
$path = realpath($path);
|
||||
@@ -187,10 +195,10 @@ class Config
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function getSdkVersion() : string
|
||||
{
|
||||
{/*{{{*/
|
||||
$path = self::getSdkPath() . DIRECTORY_SEPARATOR . "VERSION";
|
||||
|
||||
if (!file_exists($path)) {
|
||||
@@ -198,20 +206,20 @@ class Config
|
||||
}
|
||||
|
||||
return file_get_contents($path);
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function getDepsLocalPath()
|
||||
{
|
||||
{/*{{{*/
|
||||
return self::$depsLocalPath;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function setDepsLocalPath(string $path)
|
||||
{
|
||||
{/*{{{*/
|
||||
self::$depsLocalPath = $path;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function getCacheDir() : string
|
||||
{
|
||||
{/*{{{*/
|
||||
$path = self::getSdkPath() . DIRECTORY_SEPARATOR . ".cache";
|
||||
|
||||
if (!file_exists($path)) {
|
||||
@@ -221,10 +229,10 @@ class Config
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public static function getTmpDir() : string
|
||||
{
|
||||
{/*{{{*/
|
||||
$path = self::getSdkPath() . DIRECTORY_SEPARATOR . ".tmp";
|
||||
|
||||
if (!file_exists($path)) {
|
||||
@@ -234,6 +242,14 @@ class Config
|
||||
}
|
||||
|
||||
return $path;
|
||||
}
|
||||
}/*}}}*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
|
||||
@@ -15,27 +15,27 @@ class Fetcher
|
||||
|
||||
|
||||
public function __construct(string $host, int $port, string $arch = NULL, string $stability = NULL, Series $series = NULL)
|
||||
{
|
||||
{/*{{{*/
|
||||
$this->stability = $stability;
|
||||
$this->arch = $arch;
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function getSeries() : Series
|
||||
{
|
||||
{/*{{{*/
|
||||
return $this->series;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function setSeries(Series $series)
|
||||
{
|
||||
{/*{{{*/
|
||||
$this->series = $series;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
/* TODO more robust implementation. */
|
||||
/* TODO implement indicator. */
|
||||
public function getByUri($uri) : string
|
||||
{
|
||||
{/*{{{*/
|
||||
$url = "http://{$this->host}:{$this->port}$uri";
|
||||
$s = file_get_contents($url);
|
||||
|
||||
@@ -44,7 +44,7 @@ class Fetcher
|
||||
}
|
||||
|
||||
return $s;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
/*protected function fetch($uri) : string
|
||||
{
|
||||
@@ -80,3 +80,11 @@ class Fetcher
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
namespace SDK\Dependency;
|
||||
|
||||
use SDK\Config;
|
||||
use SDK\Cache;
|
||||
use SDK\Exception;
|
||||
use SDK\FileOps;
|
||||
|
||||
class Manager
|
||||
{
|
||||
use FileOps;
|
||||
|
||||
protected $stability;
|
||||
protected $arch;
|
||||
protected $path;
|
||||
@@ -14,7 +18,7 @@ class Manager
|
||||
protected $fetcher;
|
||||
|
||||
public function __construct(string $path, string $stability, string $arch)
|
||||
{
|
||||
{/*{{{*/
|
||||
$this->stability = $stability;
|
||||
$this->arch = $arch;
|
||||
$this->path = $path;
|
||||
@@ -29,21 +33,22 @@ class Manager
|
||||
|
||||
$this->fetcher = $fetcher;
|
||||
$this->series = $series;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
protected function getTmpSeriesPath()
|
||||
{
|
||||
{/*{{{*/
|
||||
return Config::getTmpDir() . DIRECTORY_SEPARATOR . $this->series->getname();
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function updatesAvailable() : bool
|
||||
{
|
||||
{/*{{{*/
|
||||
return $this->series->updatesAvailable();
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
/* TODO and implement --force. */
|
||||
/* FIXME implement rollback */
|
||||
public function performUpdate(string &$msg = NULL)
|
||||
{
|
||||
{/*{{{*/
|
||||
if (!$this->updatesAvailable()) {
|
||||
$msg = "No updates are available";
|
||||
return;
|
||||
@@ -51,12 +56,9 @@ class Manager
|
||||
|
||||
$series_data = $this->series->getData();
|
||||
|
||||
$tmp_dir = Config::getTmpDir() . DIRECTORY_SEPARATOR . md5(uniqid());
|
||||
$tmp_dir_packs = $tmp_dir . DIRECTORY_SEPARATOR . "packs";
|
||||
$tmp_dir_deps = $tmp_dir . DIRECTORY_SEPARATOR . "deps";
|
||||
mkdir($tmp_dir);
|
||||
mkdir($tmp_dir_packs);
|
||||
mkdir($tmp_dir_deps);
|
||||
$tmp_dir = $this->md("", true);
|
||||
$tmp_dir_packs = $this->md($tmp_dir . DIRECTORY_SEPARATOR . "packs");
|
||||
$tmp_dir_deps = $this->md($tmp_dir . DIRECTORY_SEPARATOR . "deps");
|
||||
|
||||
foreach ($series_data as $item) {
|
||||
echo "Processing package $item", PHP_EOL;
|
||||
@@ -69,46 +71,53 @@ class Manager
|
||||
unset($pkg);
|
||||
}
|
||||
|
||||
if (file_exists($this->path)) {
|
||||
$suffix = date("YmdHi");
|
||||
$new_path = "{$this->path}.$suffix";
|
||||
if (!rename($this->path, $new_path)) {
|
||||
throw new Exception("Unable to rename '{$this->path}' to '$new_path'");
|
||||
}
|
||||
} else {
|
||||
$up = dirname($this->path);
|
||||
if (!file_exists($up)) {
|
||||
if (!mkdir($up, 0755, true)) {
|
||||
throw new Exception("Unable to create '{$this->path}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Clear, it is an extra handling. So far it's the only case, doing it this way. And, we have
|
||||
no package definitions ATM to handle it otherwise. */
|
||||
$extra = $tmp_dir_deps . DIRECTORY_SEPARATOR . "openssl.cnf";
|
||||
if (file_exists($extra)) {
|
||||
$tdir = $tmp_dir_deps . DIRECTORY_SEPARATOR . "template" . DIRECTORY_SEPARATOR . "ssl";
|
||||
|
||||
mkdir($tdir, 0755, true);
|
||||
rename($extra, $tdir . DIRECTORY_SEPARATOR . "openssl.cnf");
|
||||
$this->md($tdir);
|
||||
$this->mv($extra, $tdir . DIRECTORY_SEPARATOR . "openssl.cnf");
|
||||
}
|
||||
|
||||
if (!rename($tmp_dir_deps, $this->path)) {
|
||||
throw new Exception("Unable to rename '$tmp_dir_deps' to '{$this->path}'");
|
||||
if (file_exists($this->path)) {
|
||||
$suffix = date("YmdHi");
|
||||
$new_path = "{$this->path}.$suffix";
|
||||
|
||||
/* This is fine, it's gonna be on the same drive. */
|
||||
if (!$this->mv($this->path, $new_path)) {
|
||||
throw new Exception("Unable to rename '{$this->path}' to '$new_path'");
|
||||
}
|
||||
} else {
|
||||
$up = dirname($this->path);
|
||||
if (!file_exists($up)) {
|
||||
if (!$this->md($up)) {
|
||||
throw new Exception("Unable to create '{$this->path}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rmdir($tmp_dir_packs);
|
||||
rmdir($tmp_dir);
|
||||
$this->mv($tmp_dir_deps, $this->path);
|
||||
|
||||
$this->rm($tmp_dir_packs);
|
||||
$this->rm($tmp_dir);
|
||||
|
||||
$this->series->cache();
|
||||
|
||||
/* save new series file, move the updated deps and backup the old ones, cleanup.*/
|
||||
$msg = "Updates performed successfully. ";
|
||||
$msg .= "Updated dependencies was saved to '{$this->path}'. ";
|
||||
$msg = "Updates performed successfully. " . PHP_EOL;
|
||||
if (isset($new_path)) {
|
||||
$msg .= "Old dependencies dir is moved to '$new_path'.";
|
||||
$msg .= "Old dependencies backed up into '$new_path'.";
|
||||
}
|
||||
}
|
||||
}/*}}}*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
|
||||
@@ -13,23 +13,23 @@ class Package
|
||||
protected $filepath;
|
||||
|
||||
public function __construct(string $name, Series $series, Fetcher $fetcher)
|
||||
{
|
||||
{/*{{{*/
|
||||
$this->name = $name;
|
||||
$this->series = $series;
|
||||
$this->fetcher = $fetcher;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function getUri() : string
|
||||
{
|
||||
{/*{{{*/
|
||||
$base = Config::getDepsBaseUri();
|
||||
$branch_data = Config::getCurrentBranchData();
|
||||
$arch = $this->series->getArch();
|
||||
|
||||
return "$base/{$branch_data['crt']}/$arch/{$this->name}";
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function retrieve(string $path)
|
||||
{
|
||||
{/*{{{*/
|
||||
$this->filepath = $path . DIRECTORY_SEPARATOR . $this->name;
|
||||
|
||||
$cont = $this->fetcher->getByUri($this->getUri());
|
||||
@@ -37,10 +37,10 @@ class Package
|
||||
$fd = fopen($this->filepath, "wb");
|
||||
fwrite($fd, $cont);
|
||||
fclose($fd);
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function unpack(string $path)
|
||||
{
|
||||
{/*{{{*/
|
||||
if (!$this->filepath || !file_exists($this->filepath)) {
|
||||
throw new Exception("Invalid filepath '{$this->filepath}'");
|
||||
}
|
||||
@@ -53,11 +53,19 @@ class Package
|
||||
} else {
|
||||
throw new Exception("Failed to unpack, error code '$ret'");
|
||||
}
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function cleanup()
|
||||
{
|
||||
{/*{{{*/
|
||||
unlink($this->filepath);
|
||||
}
|
||||
}/*}}}*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace SDK\Dependency;
|
||||
|
||||
use SDK\Config;
|
||||
use SDK\Cache;
|
||||
use SDK\Exception;
|
||||
|
||||
class Series
|
||||
@@ -14,53 +15,53 @@ class Series
|
||||
protected $cache;
|
||||
|
||||
public function __construct(string $stability, string $arch, Cache $cache, Fetcher $fetcher = NULL)
|
||||
{
|
||||
{/*{{{*/
|
||||
$this->fetcher = $fetcher;
|
||||
$this->stability = $stability;
|
||||
$this->arch = $arch;
|
||||
$this->cache = $cache;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function getFetcher() : Fetcher
|
||||
{
|
||||
{/*{{{*/
|
||||
return $this->fetcher;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function setFetcher(Fetcher $fetcher)
|
||||
{
|
||||
{/*{{{*/
|
||||
$this->fetcher = $fetcher;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function getArch() : string
|
||||
{
|
||||
{/*{{{*/
|
||||
return $this->arch;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function setArch(string $arch)
|
||||
{
|
||||
{/*{{{*/
|
||||
$this->arch = $arch;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function getName() : string
|
||||
{
|
||||
{/*{{{*/
|
||||
$base = Config::getDepsBaseUri();
|
||||
$branch_data = Config::getCurrentBranchData();
|
||||
|
||||
$file = "packages-" . Config::getCurrentBranchName() . "-{$branch_data['crt']}-{$this->arch}-{$this->stability}.txt";
|
||||
|
||||
return $file;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
protected function getUri() : string
|
||||
{
|
||||
{/*{{{*/
|
||||
$base = Config::getDepsBaseUri();
|
||||
$file = $this->getName();
|
||||
|
||||
return "$base/series/$file";
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function getData(bool $raw = false, bool $cache = true)
|
||||
{
|
||||
{/*{{{*/
|
||||
if ($cache && $this->rawData) {
|
||||
$ret = $this->rawData;
|
||||
} else {
|
||||
@@ -76,28 +77,36 @@ class Series
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function getSavePath()
|
||||
{
|
||||
{/*{{{*/
|
||||
return Config::getCacheDir() . DIRECTORY_SEPARATOR . $this->getname();
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function updatesAvailable()
|
||||
{
|
||||
{/*{{{*/
|
||||
$series_data = $this->getData(true);
|
||||
$series_file = $this->getSavePath();
|
||||
|
||||
return $this->cache->cachedContentDiffers($series_file, $series_data);
|
||||
}
|
||||
}/*}}}*/
|
||||
|
||||
public function cache(string $path = NULL)
|
||||
{
|
||||
{/*{{{*/
|
||||
if (!$path) {
|
||||
$path = $this->getSavePath();
|
||||
}
|
||||
|
||||
$this->cache->cacheContent($path, $this->getData(true));
|
||||
}
|
||||
}/*}}}*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
|
||||
@@ -7,3 +7,11 @@ class Exception extends \Exception
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
|
||||
127
lib/php/libsdk/SDK/FileOps.php
Normal file
127
lib/php/libsdk/SDK/FileOps.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
namespace SDK;
|
||||
|
||||
use SDK\Config;
|
||||
use SDK\Exception;
|
||||
|
||||
trait FileOps
|
||||
{
|
||||
protected function md(string $name = "", bool $tmp = false) : string
|
||||
{/*{{{*/
|
||||
$ret = $name;
|
||||
|
||||
if (!$name) {
|
||||
if ($tmp) {
|
||||
$pre = Config::getTmpDir();
|
||||
$ret = $pre . DIRECTORY_SEPARATOR . md5(uniqid());
|
||||
} else {
|
||||
throw new Exception("Dir name is empty");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!is_dir($ret)) {
|
||||
if (!mkdir($ret, 0755, true)) {
|
||||
throw new Exception("Unable to create '$ret'");
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}/*}}}*/
|
||||
|
||||
/* TODO is link and more checks. */
|
||||
protected function rm(string $path) : bool
|
||||
{/*{{{*/
|
||||
if (!file_exists($path)) {
|
||||
return false;
|
||||
} else if (is_file($path)) {
|
||||
return unlink($path);
|
||||
}
|
||||
|
||||
$ret = true;
|
||||
|
||||
$iterator = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator(
|
||||
$path,
|
||||
\FilesystemIterator::SKIP_DOTS
|
||||
),
|
||||
\RecursiveIteratorIterator::CHILD_FIRST
|
||||
);
|
||||
foreach ($iterator as $item) {
|
||||
if ($item->isDir()) {
|
||||
$ret = $ret && rmdir($item->getPathname());
|
||||
} else {
|
||||
$ret = $ret && unlink($item->getPathname());
|
||||
}
|
||||
}
|
||||
return $ret && rmdir($path);
|
||||
}/*}}}*/
|
||||
|
||||
/* TODO islink and more checks */
|
||||
protected function cp_or_mv(string $src, string $dst, callable $cb) : bool
|
||||
{/*{{{*/
|
||||
if (!file_exists($src)) {
|
||||
return false;
|
||||
} else if (is_file($src)) {
|
||||
return call_user_func($cb, $src, $dst);
|
||||
}
|
||||
|
||||
if (!file_exists($dst)) {
|
||||
$this->md($dst);
|
||||
}
|
||||
|
||||
$iterator = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator(
|
||||
$src,
|
||||
\FilesystemIterator::SKIP_DOTS
|
||||
),
|
||||
\RecursiveIteratorIterator::CHILD_FIRST
|
||||
);
|
||||
$cut_len = strlen($src)+1;
|
||||
foreach ($iterator as $item) {
|
||||
$src_path = $item->getPathname();
|
||||
$sub = substr($src_path, $cut_len);
|
||||
$dst_path = $dst . DIRECTORY_SEPARATOR . $sub;
|
||||
$dst_parent = dirname($dst_path);
|
||||
|
||||
if (!is_dir($dst_parent)) {
|
||||
if (!$this->md($dst_parent)) {
|
||||
throw new Exception("Unable to create '$dst_parent'");
|
||||
}
|
||||
}
|
||||
|
||||
if ($item->isFile()) {
|
||||
if (!call_user_func($cb, $src_path, $dst_path)) {
|
||||
throw new Exception("Unable to $cb '$src_path' to '$dst_path'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}/*}}}*/
|
||||
|
||||
protected function cp(string $src, string $dst) : bool
|
||||
{/*{{{*/
|
||||
return $this->cp_or_mv($src, $dst, "copy");
|
||||
}/*}}}*/
|
||||
|
||||
protected function mv(string $src, string $dst) : bool
|
||||
{/*{{{*/
|
||||
$ret = $this->cp_or_mv($src, $dst, "rename");
|
||||
|
||||
$ret = $ret && $this->rm($src);
|
||||
|
||||
return $ret;
|
||||
}/*}}}*/
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
@@ -5,3 +5,11 @@ function __autoload($name)
|
||||
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . $name . ".php";
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* tab-width: 4
|
||||
* c-basic-offset: 4
|
||||
* End:
|
||||
* vim600: sw=4 ts=4 fdm=marker
|
||||
* vim<600: sw=4 ts=4
|
||||
*/
|
||||
|
||||
BIN
msys2/usr/bin/bsdtar.exe
Normal file
BIN
msys2/usr/bin/bsdtar.exe
Normal file
Binary file not shown.
BIN
msys2/usr/bin/bzip2.exe
Normal file
BIN
msys2/usr/bin/bzip2.exe
Normal file
Binary file not shown.
Binary file not shown.
BIN
msys2/usr/bin/gzip.exe
Normal file
BIN
msys2/usr/bin/gzip.exe
Normal file
Binary file not shown.
BIN
msys2/usr/bin/msys-lzma-5.dll
Normal file
BIN
msys2/usr/bin/msys-lzma-5.dll
Normal file
Binary file not shown.
BIN
msys2/usr/bin/msys-lzo2-2.dll
Normal file
BIN
msys2/usr/bin/msys-lzo2-2.dll
Normal file
Binary file not shown.
BIN
msys2/usr/bin/msys-nettle-6.dll
Normal file
BIN
msys2/usr/bin/msys-nettle-6.dll
Normal file
Binary file not shown.
BIN
msys2/usr/bin/msys-xml2-2.dll
Normal file
BIN
msys2/usr/bin/msys-xml2-2.dll
Normal file
Binary file not shown.
BIN
msys2/usr/bin/tar.exe
Normal file
BIN
msys2/usr/bin/tar.exe
Normal file
Binary file not shown.
BIN
msys2/usr/bin/tee.exe
Normal file
BIN
msys2/usr/bin/tee.exe
Normal file
Binary file not shown.
BIN
msys2/usr/bin/xz.exe
Normal file
BIN
msys2/usr/bin/xz.exe
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
64
phpsdk-starter.bat
Normal file
64
phpsdk-starter.bat
Normal file
@@ -0,0 +1,64 @@
|
||||
@echo off
|
||||
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
|
||||
set IMHERE=%~dp0
|
||||
|
||||
:getopt
|
||||
if /i "%1" equ "-h" goto help
|
||||
if /i "%1" equ "-c" set CRT=%2 & shift
|
||||
if /i "%1" equ "-a" set ARCH=%2 & shift
|
||||
if /i "%1" equ "-t" set TASK=%2 & shift
|
||||
if /i "%1" equ "--task-args" set TASK_ARGS=%2 & shift
|
||||
shift
|
||||
if not (%1)==() goto getopt
|
||||
|
||||
if "%CRT%" equ "" goto help
|
||||
if "%ARCH%" equ "" goto help
|
||||
goto skip_help
|
||||
|
||||
:help
|
||||
echo Usage: phpsdk-starter -c ^<crt^> -a ^<arch^> [-t ^<task_script.bat^>]
|
||||
exit /b 0
|
||||
|
||||
:skip_help
|
||||
|
||||
set CRT=%CRT: =%
|
||||
set ARCH=%ARCH: =%
|
||||
|
||||
set PHP_SDK_RUN_FROM_ROOT=1
|
||||
|
||||
title PHP SDK
|
||||
|
||||
call %IMHERE%bin\phpsdk_setshell.bat %CRT% %ARCH%
|
||||
|
||||
if errorlevel 3 (
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
|
||||
if "%TASK%" neq "" (
|
||||
if exist "%TASK%" (
|
||||
set TASK_ARGS=%TASK_ARGS:"=%
|
||||
|
||||
if exist "%IMHERE%phpsdk-local.bat" (
|
||||
cmd /c "!PHP_SDK_VC_SHELL_CMD! && %IMHERE%\bin\phpsdk_setvars.bat && %IMHERE%\phpsdk-local.bat && %TASK% !TASK_ARGS!"
|
||||
) else (
|
||||
cmd /c "!PHP_SDK_VC_SHELL_CMD! && %IMHERE%\bin\phpsdk_setvars.bat && %TASK% !TASK_ARGS!"
|
||||
)
|
||||
exit /b
|
||||
) else (
|
||||
echo could not find the task file
|
||||
exit /b 3
|
||||
)
|
||||
)
|
||||
|
||||
if exist "%IMHERE%phpsdk-local.bat" (
|
||||
cmd /k "!PHP_SDK_VC_SHELL_CMD! && %IMHERE%\bin\phpsdk_setvars.bat && %IMHERE%\bin\phpsdk_dumpenv.bat && %IMHERE%\phpsdk-local.bat && echo. && set prompt=$P$_$+$$$S"
|
||||
) else (
|
||||
cmd /k "!PHP_SDK_VC_SHELL_CMD! && %IMHERE%\bin\phpsdk_setvars.bat && %IMHERE%\bin\phpsdk_dumpenv.bat && set prompt=$P$_$+$$$S"
|
||||
)
|
||||
|
||||
set PHP_SDK_RUN_FROM_ROOT=
|
||||
|
||||
exit /b
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
@echo off
|
||||
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
call %~dp0phpsdk-starter.bat -c vc14 -a x64 %*
|
||||
|
||||
set PHP_SDK_RUN_FROM_ROOT=1
|
||||
|
||||
call %~dp0bin\phpsdk_setshell.bat vc14 x64
|
||||
|
||||
cmd /k "%PHP_SDK_VC_SHELL_CMD% && %~dp0\bin\phpsdk_setvars.bat && %~dp0\bin\phpsdk_dumpenv.bat"
|
||||
|
||||
set PHP_SDK_RUN_FROM_ROOT=
|
||||
|
||||
exit
|
||||
exit /b
|
||||
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
@echo off
|
||||
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
call %~dp0phpsdk-starter.bat -c vc14 -a x86 %*
|
||||
|
||||
set PHP_SDK_RUN_FROM_ROOT=1
|
||||
|
||||
call %~dp0bin\phpsdk_setshell.bat vc14 x86
|
||||
|
||||
cmd /k "%PHP_SDK_VC_SHELL_CMD% && %~dp0\bin\phpsdk_setvars.bat && %~dp0\bin\phpsdk_dumpenv.bat"
|
||||
|
||||
set PHP_SDK_RUN_FROM_ROOT=
|
||||
|
||||
exit
|
||||
exit /b
|
||||
|
||||
|
||||
6
phpsdk-vc15-x64.bat
Normal file
6
phpsdk-vc15-x64.bat
Normal file
@@ -0,0 +1,6 @@
|
||||
@echo off
|
||||
|
||||
call %~dp0phpsdk-starter.bat -c vc15 -a x64 %*
|
||||
|
||||
exit /b
|
||||
|
||||
6
phpsdk-vc15-x86.bat
Normal file
6
phpsdk-vc15-x86.bat
Normal file
@@ -0,0 +1,6 @@
|
||||
@echo off
|
||||
|
||||
call %~dp0phpsdk-starter.bat -c vc15 -a x86 %*
|
||||
|
||||
exit /b
|
||||
|
||||
Reference in New Issue
Block a user