mirror of
https://github.com/php-win-ext/php-sdk-binary-tools.git
synced 2026-03-24 17:12:12 +01:00
Compare commits
11 Commits
php-sdk-2.
...
php-sdk-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b15cdb1f92 | ||
|
|
91302e8142 | ||
|
|
f655bcf7d1 | ||
|
|
89bc6e0eb8 | ||
|
|
4d9b189d04 | ||
|
|
ff33ae5143 | ||
|
|
3cf0f67f27 | ||
|
|
b0a93f01c5 | ||
|
|
e10c86c2d5 | ||
|
|
20ccc545bd | ||
|
|
0be0ba3a84 |
@@ -66,7 +66,7 @@ It is not required to hold the source in the PHP SDK directory. It could be usef
|
||||
- invoke `phpsdk-vc15-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`, use PHP-X.Y for a non master branch
|
||||
- `phpsdk_deps --update --branch master`, use `phpsdk_deps --update --branch X.Y` for a non master branch
|
||||
- do the build, eg. `buildconf && configure --enable-cli && nmake`
|
||||
|
||||
More extensive documentation can be found on the [wiki](https://wiki.php.net/internals/windows/stepbystepbuild_sdk_2 "PHP wiki page").
|
||||
@@ -123,7 +123,7 @@ As of the version 2.1.0, the SDK includes a tool for the [PGO](https://docs.micr
|
||||
- run `nmake clean-pgo`
|
||||
- rebuild PHP `--with-pgo`
|
||||
|
||||
## Adding custom scenario
|
||||
## Adding custom PGO training scenario
|
||||
|
||||
A custom scenario can be used to produce a custom PHP binary dedicated to an arbitrary application.
|
||||
|
||||
@@ -134,6 +134,8 @@ The existing training cases can be found in [pgo/cases](pgo/cases). Assumed the
|
||||
- create `pgo/cases/myapp/nginx.partial.conf` with a partial NGINX template
|
||||
- create `pgo/cases/myapp/TrainingCaseHandler.php` with a class as defined in the [interface](lib/php/libsdk/SDK/Build/PGO/Interfaces/TrainingCase.php)
|
||||
|
||||
After a training case is implemented and put under `pgo/cases`, the work environment needs to be reinitialized. The tool puts all the training data and necessary applications under `pgo/work`. Rename or remove that directory and rerun `phpsdk_pgo --init`.
|
||||
|
||||
To skip a training case, add a file named `inactive` into the case folder.
|
||||
|
||||
|
||||
@@ -146,6 +148,7 @@ To skip a training case, add a file named `inactive` into the case folder.
|
||||
- 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.
|
||||
- task.exe is not a console application, some systems might not propagate exit code except the batch is explicitly run from `cmd /c`, etc.
|
||||
- `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.
|
||||
|
||||
|
||||
|
||||
BIN
bin/vswhere.exe
BIN
bin/vswhere.exe
Binary file not shown.
@@ -15,12 +15,13 @@ class Fetcher
|
||||
protected $series;
|
||||
|
||||
|
||||
public function __construct(string $host, int $port, string $arch = NULL, string $stability = NULL, Series $series = NULL)
|
||||
public function __construct(string $host, int $port, string $scheme = "https", string $arch = NULL, string $stability = NULL, Series $series = NULL)
|
||||
{/*{{{*/
|
||||
$this->stability = $stability;
|
||||
$this->arch = $arch;
|
||||
$this->host = $host;
|
||||
$this->port = $port;
|
||||
$this->scheme = $scheme;
|
||||
}/*}}}*/
|
||||
|
||||
public function getSeries() : Series
|
||||
@@ -35,11 +36,23 @@ class Fetcher
|
||||
|
||||
/* TODO more robust implementation. */
|
||||
/* TODO implement indicator. */
|
||||
public function getByUri($uri) : string
|
||||
public function getByUri(string $uri, int $retries = 3) : string
|
||||
{/*{{{*/
|
||||
$url = "http://{$this->host}:{$this->port}$uri";
|
||||
$url = "{$this->scheme}://{$this->host}:{$this->port}$uri";
|
||||
$ret = false;
|
||||
|
||||
return $this->download($url);
|
||||
retry:
|
||||
try {
|
||||
$ret = $this->download($url);
|
||||
} catch (Exception $e) {
|
||||
if ($retries > 0) {
|
||||
sleep(1);
|
||||
$retries--;
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}/*}}}*/
|
||||
|
||||
/*protected function fetch($uri) : string
|
||||
|
||||
@@ -13,6 +13,7 @@ class Manager
|
||||
protected $path;
|
||||
protected $series;
|
||||
protected $fetcher;
|
||||
protected $updatesFlag = NULL;
|
||||
|
||||
public function __construct(string $path, string $stability, string $arch)
|
||||
{/*{{{*/
|
||||
@@ -23,7 +24,8 @@ class Manager
|
||||
|
||||
$host = Config::getDepsHost();
|
||||
$port = Config::getDepsPort();
|
||||
$fetcher = new Fetcher($host, $port, $this->arch, $this->stability);
|
||||
$scheme = Config::getDepsUriScheme();
|
||||
$fetcher = new Fetcher($host, $port, $scheme, $this->arch, $this->stability);
|
||||
$series = new Series($this->stability, $this->arch, $this->cache, NULL);
|
||||
$fetcher->setSeries($series);
|
||||
$series->setFetcher($fetcher);
|
||||
@@ -39,7 +41,12 @@ class Manager
|
||||
|
||||
public function updatesAvailable() : bool
|
||||
{/*{{{*/
|
||||
return $this->series->updatesAvailable() || !file_exists(Config::getDepsLocalPath());
|
||||
if (!is_null($this->updatesFlag)) {
|
||||
return $this->updatesFlag;
|
||||
}
|
||||
|
||||
$this->updatesFlag = $this->series->updatesAvailable() || !file_exists(Config::getDepsLocalPath());
|
||||
return $this->updatesFlag;
|
||||
}/*}}}*/
|
||||
|
||||
/* FIXME implement rollback */
|
||||
|
||||
@@ -52,6 +52,7 @@ class Training
|
||||
curl_setopt($ch[$i], CURLOPT_CONNECTTIMEOUT_MS, 500000);
|
||||
curl_setopt($ch[$i], CURLOPT_TIMEOUT_MS, 500000);
|
||||
curl_setopt($ch[$i], CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch[$i], CURLOPT_USERAGENT, SDKConfig::getSdkUserAgentName());
|
||||
/* ??? */
|
||||
/*curl_setopt($ch[$i], CURLOPT_FOLLOWLOCATION, true);*/
|
||||
|
||||
|
||||
@@ -10,7 +10,8 @@ class Config
|
||||
{
|
||||
/* Config variables. */
|
||||
protected static $depsHost = 'windows.php.net';
|
||||
protected static $depsPort = 80;
|
||||
protected static $depsPort = 443;
|
||||
protected static $depsUriScheme = "https";
|
||||
protected static $depsBaseUri = "/downloads/php-sdk/deps";
|
||||
|
||||
/* protected static $sdkNugetFeedUrl = "http://127.0.0.1/sdk/nuget"; */
|
||||
@@ -34,6 +35,11 @@ class Config
|
||||
return self::$depsPort;
|
||||
}/*}}}*/
|
||||
|
||||
public static function getDepsUriScheme() : string
|
||||
{/*{{{*/
|
||||
return self::$depsUriScheme;
|
||||
}/*}}}*/
|
||||
|
||||
public static function getDepsBaseUri() : string
|
||||
{/*{{{*/
|
||||
return self::$depsBaseUri;
|
||||
@@ -125,7 +131,7 @@ class Config
|
||||
if (empty(self::$knownBranches)) {
|
||||
$cache_file = "known_branches.txt";
|
||||
$cache = new Cache(self::getDepsLocalPath());
|
||||
$fetcher = new Fetcher(self::$depsHost, self::$depsPort);
|
||||
$fetcher = new Fetcher(self::$depsHost, self::$depsPort, self::$depsUriScheme);
|
||||
|
||||
$tmp = $fetcher->getByUri(self::$depsBaseUri . "/series/");
|
||||
if (false !== $tmp) {
|
||||
@@ -377,6 +383,11 @@ class Config
|
||||
|
||||
return $path;
|
||||
}/*}}}*/
|
||||
|
||||
public static function getSdkUserAgentName() : string
|
||||
{/*{{{*/
|
||||
return "PHP-SDK-BINARY-TOOLS/" . self::getSdkVersion();
|
||||
}/*}}}*/
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -134,9 +134,13 @@ trait FileOps
|
||||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
curl_setopt($ch, CURLOPT_USERAGENT, Config::getSdkUserAgentName());
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
|
||||
$ret = curl_exec($ch);
|
||||
if (false === $ret) {
|
||||
|
||||
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
if (false === $ret || 200 !== $code) {
|
||||
$err = curl_error($ch);
|
||||
curl_close($ch);
|
||||
if ($dest_fn) {
|
||||
|
||||
Reference in New Issue
Block a user