mirror of
https://github.com/php-win-ext/php-sdk-binary-tools.git
synced 2026-03-24 17:12:12 +01:00
Compare commits
27 Commits
php-sdk-2.
...
php-sdk-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
19
README.md
19
README.md
@@ -27,6 +27,7 @@ All the tools included are either scripts or 32-bit binaries. They are therefore
|
||||
- `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 tools
|
||||
|
||||
@@ -48,7 +49,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 into the drive root.
|
||||
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.
|
||||
|
||||
@@ -59,8 +60,7 @@ It is not required to hold the source in the PHP SDK directory. It could be usef
|
||||
- `git clone https://github.com/OSTC/php-sdk-binary-tools.git c:\php-sdk`
|
||||
- `cd c:\php-sdk`
|
||||
- `git checkout new_binary_tools`
|
||||
- either run or click on `phpsdk-vc14-x64.bat` in the PHP SDK root
|
||||
- `cd` to c:\php-sdk and click on `phpsdk-vc14-x64.bat` in the PHP SDK root
|
||||
- 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`
|
||||
@@ -75,18 +75,27 @@ TODO more extensive documentation on the wiki.
|
||||
|
||||
# Customizing
|
||||
|
||||
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 setup additional environment.
|
||||
## 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, contained in the PHP SDK root
|
||||
- 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
|
||||
|
||||
|
||||
BIN
bin/deplister.exe
Normal file
BIN
bin/deplister.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,5 @@ 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
|
||||
|
||||
BIN
bin/php/php7.dll
BIN
bin/php/php7.dll
Binary file not shown.
Binary file not shown.
@@ -21,7 +21,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
|
||||
|
||||
@@ -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%
|
||||
|
||||
@@ -8,7 +8,7 @@ if "%PHP_SDK_PHP_CMD%"=="" (
|
||||
)
|
||||
)
|
||||
|
||||
%PHP_SDK_PHP_CMD% -r "echo 'PHP SDK ' . file_get_contents(getenv('PHP_SDK_PATH') . '\\VERSION');"
|
||||
%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.
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
|
||||
|
||||
@@ -177,10 +177,10 @@ class Config
|
||||
|
||||
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);
|
||||
|
||||
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.
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.
@@ -2,30 +2,60 @@
|
||||
|
||||
setlocal enableextensions enabledelayedexpansion
|
||||
|
||||
if "%1" equ "" goto help
|
||||
if "%2" equ "" goto help
|
||||
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 ^<crt^> ^<arch^> [^<append_script.bat^>]
|
||||
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 %~dp0bin\phpsdk_setshell.bat %1 %2
|
||||
call %IMHERE%bin\phpsdk_setshell.bat %CRT% %ARCH%
|
||||
|
||||
if errorlevel 3 (
|
||||
exit /b %errorlevel%
|
||||
)
|
||||
|
||||
if exist "%~dp0phpsdk-local.bat" (
|
||||
cmd /k "!PHP_SDK_VC_SHELL_CMD! && %~dp0\bin\phpsdk_setvars.bat && %~dp0\bin\phpsdk_dumpenv.bat && %~dp0\phpsdk-local.bat && echo. && set prompt=$P$_$+$$$S"
|
||||
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 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! && %~dp0\bin\phpsdk_setvars.bat && %~dp0\bin\phpsdk_dumpenv.bat && set prompt=$P$_$+$$$S"
|
||||
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=
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
|
||||
call %~dp0phpsdk-starter.bat vc14 x64 %*
|
||||
call %~dp0phpsdk-starter.bat -c vc14 -a x64 %*
|
||||
|
||||
exit /b
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
|
||||
call %~dp0phpsdk-starter.bat vc14 x86 %*
|
||||
call %~dp0phpsdk-starter.bat -c vc14 -a x86 %*
|
||||
|
||||
exit /b
|
||||
|
||||
|
||||
Reference in New Issue
Block a user