Compare commits

..

27 Commits

Author SHA1 Message Date
Anatol Belski
b56aa4c288 don't dump env for task build 2016-11-19 19:20:07 +01:00
Anatol Belski
9dc14d6f1e accept also task arguments 2016-11-19 16:49:39 +01:00
Anatol Belski
9134ee4718 upgrade PHP and add ext/mbstring needed for pickle 2016-11-16 20:19:17 +01:00
Anatol Belski
2849ea89a8 rename var for more clarity 2016-11-16 19:44:02 +01:00
Anatol Belski
c84a5d8303 rework the unattended build example 2016-11-16 19:16:21 +01:00
Anatol Belski
e350e99ba6 task could be also run, when the local setup doesn't exist 2016-11-16 18:58:49 +01:00
Anatol Belski
67bf1f579a add bsdtar 2016-11-16 18:48:27 +01:00
Anatol Belski
8fadf1d33d add deplister 2016-11-16 18:37:05 +01:00
Anatol Belski
f7d859266b add the standard set for tar/gz/bz2, etc. 2016-11-16 18:35:37 +01:00
Anatol Belski
c6c77737aa add tee 2016-11-16 17:49:46 +01:00
Anatol Belski
5ccc58cab5 improve wording 2016-11-16 16:47:20 +01:00
Anatol Belski
9c3d40ab02 extend the task script example 2016-11-15 14:10:26 +01:00
Anatol Belski
c0941efae5 extend on upgrading 2016-11-08 12:48:46 +01:00
Anatol Belski
49217155a3 clarify 2016-11-08 12:46:13 +01:00
Anatol Belski
b0f5cef8bd merge sentences 2016-11-08 12:44:14 +01:00
Anatol Belski
18d0b098ff version count up 2016-11-04 02:25:18 +01:00
Anatol Belski
fc185fd315 fix help msg 2016-10-31 19:05:27 +01:00
Anatol Belski
94ff7b53cf fix getopt check with no opt passed 2016-10-31 18:54:54 +01:00
Anatol Belski
217647a68e extend doc 2016-10-31 18:50:14 +01:00
Anatol Belski
52df9f9f4e fix phrase 2016-10-31 18:40:58 +01:00
Anatol Belski
4fb69d4c23 fix some doc 2016-10-31 16:57:41 +01:00
Anatol Belski
e99ec6722c expand on latest features 2016-10-31 16:54:26 +01:00
Anatol Belski
8fecd7c279 the is moved into doc already 2016-10-31 16:43:46 +01:00
Anatol Belski
97b62b2182 move some more stuff into doc 2016-10-31 16:42:50 +01:00
Anatol Belski
2d4aa4d54b bump version 2016-10-31 16:36:43 +01:00
Anatol Belski
0267758ff1 add task.exe tool 2016-10-31 16:36:11 +01:00
Anatol Belski
ca2ccd968a rework phpsdk-starter
- add argument names
- make possible to attach a task script for CI integration
2016-10-31 15:45:56 +01:00
35 changed files with 161 additions and 23 deletions

View File

@@ -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

View File

@@ -1 +1 @@
2.0.0alpha4
2.0.0alpha6

BIN
bin/deplister.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.

Binary file not shown.

Binary file not shown.

View File

@@ -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

Binary file not shown.

Binary file not shown.

View File

@@ -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

View File

@@ -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%

View File

@@ -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

Binary file not shown.

72
doc/task.c Normal file
View 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;
}

View 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

View File

@@ -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

Binary file not shown.

BIN
msys2/usr/bin/bzip2.exe Normal file

Binary file not shown.

BIN
msys2/usr/bin/gzip.exe Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
msys2/usr/bin/tar.exe Normal file

Binary file not shown.

BIN
msys2/usr/bin/tee.exe Normal file

Binary file not shown.

BIN
msys2/usr/bin/xz.exe Normal file

Binary file not shown.

View File

@@ -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=

View File

@@ -1,6 +1,6 @@
@echo off
call %~dp0phpsdk-starter.bat vc14 x64 %*
call %~dp0phpsdk-starter.bat -c vc14 -a x64 %*
exit /b

View File

@@ -1,6 +1,6 @@
@echo off
call %~dp0phpsdk-starter.bat vc14 x86 %*
call %~dp0phpsdk-starter.bat -c vc14 -a x86 %*
exit /b