This commit is contained in:
crazywhalecc
2024-09-04 16:01:32 +00:00
parent b39aef4671
commit 85b6dd9c3f
51 changed files with 116 additions and 100 deletions

View File

@@ -73,7 +73,11 @@ import{_ as s,c as i,o as e,a1 as a}from"./chunks/framework.CszIUXhs.js";const g
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --all</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -U</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;php-src:https://downloads.php.net/~eric/php-8.3.0beta1.tar.gz&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Specifying to download an older version of the curl library</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --all</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -U</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;curl:https://curl.se/download/curl-7.88.1.tar.gz&quot;</span></span></code></pre></div><h2 id="command-doctor" tabindex="-1">Command - doctor <a class="header-anchor" href="#command-doctor" aria-label="Permalink to &quot;Command - doctor&quot;"></a></h2><p>If you can run <code>bin/spc</code> normally but cannot compile static PHP or dependent libraries normally, you can run <code>bin/spc doctor</code> first to check whether the system itself lacks dependencies.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Quick check</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --all</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -U</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;curl:https://curl.se/download/curl-7.88.1.tar.gz&quot;</span></span></code></pre></div><p>If the source you download is not a link, but a git repository, you can use <code>-G</code> or <code>--custom-git</code> to rewrite the download link, so that the downloader can force the use of the specified git repository to download packages from this source. The usage method is <code>{source-name}:{branch}:{url}</code>, which can rewrite the download link of multiple libraries at the same time. It is also available when downloading with the <code>--for-extensions</code> option.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Specifying to download the source code of the PHP extension from the specified branch of the git repository</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --for-extensions=redis</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -G</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;php-src:master:https://github.com/php/php-src.git&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Download the latest code from the master branch of the swoole-src repository instead of PECL release version</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --for-extensions=swoole</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -G</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;swoole:master:https://github.com/swoole/swoole-src.git&quot;</span></span></code></pre></div><h2 id="command-doctor" tabindex="-1">Command - doctor <a class="header-anchor" href="#command-doctor" aria-label="Permalink to &quot;Command - doctor&quot;"></a></h2><p>If you can run <code>bin/spc</code> normally but cannot compile static PHP or dependent libraries normally, you can run <code>bin/spc doctor</code> first to check whether the system itself lacks dependencies.</p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Quick check</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> doctor</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Quickly check and fix when it can be automatically repaired (use package management to install dependent packages, only support the above-mentioned operating systems and distributions)</span></span>
@@ -140,4 +144,4 @@ import{_ as s,c as i,o as e,a1 as a}from"./chunks/framework.CszIUXhs.js";const g
<span class="line"><span>Loaded Configuration File =&gt; /Users/jerry/project/git-project/static-php-cli/php.ini</span></span>
<span class="line"><span></span></span>
<span class="line"><span>$ buildroot/bin/php -i | grep memory</span></span>
<span class="line"><span>memory_limit =&gt; 8G =&gt; 8G</span></span></code></pre></div><p>For the objects, methods and interfaces supported by static-php-cli, you can read the source code. Most methods and objects have corresponding comments.</p><p>Commonly used objects and functions using the <code>-P</code> function are:</p><ul><li><code>SPC\\store\\FileSystem</code>: file management class <ul><li><code>::replaceFileStr(string $filename, string $search, $replace)</code>: Replace file string content</li><li><code>::replaceFileStr(string $filename, string $pattern, $replace)</code>: Regularly replace file content</li><li><code>::replaceFileUser(string $filename, $callback)</code>: User-defined function replaces file content</li><li><code>::copyDir(string $from, string $to)</code>: Recursively copy a directory to another location</li><li><code>::convertPath(string $path)</code>: Convert the path delimiter to the current system delimiter</li><li><code>::scanDirFiles(string $dir, bool $recursive = true, bool|string $relative = false, bool $include_dir = false)</code>: Traverse directory files</li></ul></li><li><code>SPC\\builder\\BuilderBase</code>: Build object <ul><li><code>-&gt;getPatchPoint()</code>: Get the current injection point name</li><li><code>-&gt;getOption(string $key, $default = null)</code>: Get command line and compile-time options</li><li><code>-&gt;getPHPVersionID()</code>: Get the currently compiled PHP version ID</li><li><code>-&gt;getPHPVersion()</code>: Get the currently compiled PHP version number</li><li><code>-&gt;setOption(string $key, $value)</code>: Set options</li><li><code>-&gt;setOptionIfNotExists(string $key, $value)</code>: Set option if option does not exist</li></ul></li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>static-php-cli has many open methods, which cannot be listed in the docs, but as long as it is a <code>public function</code> and is not marked as <code>@internal</code>, it theoretically can be called.</p></div><h2 id="multiple-builds" tabindex="-1">Multiple builds <a class="header-anchor" href="#multiple-builds" aria-label="Permalink to &quot;Multiple builds&quot;"></a></h2><p>If you need to build multiple times locally, the following method can save you time downloading resources and compiling.</p><ul><li>If you only switch the PHP version without changing the dependent libraries, you can use <code>bin/spc switch-php-version</code> to quickly switch the PHP version, and then re-run the same <code>build</code> command.</li><li>If you want to rebuild once, but do not re-download the source code, you can first <code>rm -rf buildroot source</code> to delete the compilation directory and source code directory, and then rebuild.</li><li>If you want to update a version of a dependency, you can use <code>bin/spc del-download &lt;source-name&gt;</code> to delete the specified source code, and then use <code>download &lt;source-name&gt;</code> to download it again.</li><li>If you want to update all dependent versions, you can use <code>bin/spc download --clean</code> to delete all downloaded sources, and then download them again.</li></ul>`,105),l=[t];function o(p,d,h,c,r,k){return e(),i("div",null,l)}const m=s(n,[["render",o]]);export{g as __pageData,m as default};
<span class="line"><span>memory_limit =&gt; 8G =&gt; 8G</span></span></code></pre></div><p>For the objects, methods and interfaces supported by static-php-cli, you can read the source code. Most methods and objects have corresponding comments.</p><p>Commonly used objects and functions using the <code>-P</code> function are:</p><ul><li><code>SPC\\store\\FileSystem</code>: file management class <ul><li><code>::replaceFileStr(string $filename, string $search, $replace)</code>: Replace file string content</li><li><code>::replaceFileStr(string $filename, string $pattern, $replace)</code>: Regularly replace file content</li><li><code>::replaceFileUser(string $filename, $callback)</code>: User-defined function replaces file content</li><li><code>::copyDir(string $from, string $to)</code>: Recursively copy a directory to another location</li><li><code>::convertPath(string $path)</code>: Convert the path delimiter to the current system delimiter</li><li><code>::scanDirFiles(string $dir, bool $recursive = true, bool|string $relative = false, bool $include_dir = false)</code>: Traverse directory files</li></ul></li><li><code>SPC\\builder\\BuilderBase</code>: Build object <ul><li><code>-&gt;getPatchPoint()</code>: Get the current injection point name</li><li><code>-&gt;getOption(string $key, $default = null)</code>: Get command line and compile-time options</li><li><code>-&gt;getPHPVersionID()</code>: Get the currently compiled PHP version ID</li><li><code>-&gt;getPHPVersion()</code>: Get the currently compiled PHP version number</li><li><code>-&gt;setOption(string $key, $value)</code>: Set options</li><li><code>-&gt;setOptionIfNotExists(string $key, $value)</code>: Set option if option does not exist</li></ul></li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>static-php-cli has many open methods, which cannot be listed in the docs, but as long as it is a <code>public function</code> and is not marked as <code>@internal</code>, it theoretically can be called.</p></div><h2 id="multiple-builds" tabindex="-1">Multiple builds <a class="header-anchor" href="#multiple-builds" aria-label="Permalink to &quot;Multiple builds&quot;"></a></h2><p>If you need to build multiple times locally, the following method can save you time downloading resources and compiling.</p><ul><li>If you only switch the PHP version without changing the dependent libraries, you can use <code>bin/spc switch-php-version</code> to quickly switch the PHP version, and then re-run the same <code>build</code> command.</li><li>If you want to rebuild once, but do not re-download the source code, you can first <code>rm -rf buildroot source</code> to delete the compilation directory and source code directory, and then rebuild.</li><li>If you want to update a version of a dependency, you can use <code>bin/spc del-download &lt;source-name&gt;</code> to delete the specified source code, and then use <code>download &lt;source-name&gt;</code> to download it again.</li><li>If you want to update all dependent versions, you can use <code>bin/spc download --clean</code> to delete all downloaded sources, and then download them again.</li></ul>`,107),l=[t];function o(p,h,d,c,r,k){return e(),i("div",null,l)}const m=s(n,[["render",o]]);export{g as __pageData,m as default};

View File

@@ -1 +1 @@
import{_ as s,c as i,o as e,a1 as a}from"./chunks/framework.CszIUXhs.js";const g=JSON.parse('{"title":"Build (Linux, macOS, FreeBSD)","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/manual-build.md","filePath":"en/guide/manual-build.md"}'),n={name:"en/guide/manual-build.md"},t=a("",105),l=[t];function o(p,d,h,c,r,k){return e(),i("div",null,l)}const m=s(n,[["render",o]]);export{g as __pageData,m as default};
import{_ as s,c as i,o as e,a1 as a}from"./chunks/framework.CszIUXhs.js";const g=JSON.parse('{"title":"Build (Linux, macOS, FreeBSD)","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/manual-build.md","filePath":"en/guide/manual-build.md"}'),n={name:"en/guide/manual-build.md"},t=a("",107),l=[t];function o(p,h,d,c,r,k){return e(),i("div",null,l)}const m=s(n,[["render",o]]);export{g as __pageData,m as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -71,7 +71,11 @@ import{_ as s,c as i,o as a,a1 as n}from"./chunks/framework.CszIUXhs.js";const g
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --all</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -U</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;php-src:https://downloads.php.net/~eric/php-8.3.0beta1.tar.gz&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 指定下载旧版本的 curl </span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --all</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -U</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;curl:https://curl.se/download/curl-7.88.1.tar.gz&quot;</span></span></code></pre></div><h2 id="-doctor-" tabindex="-1"> doctor - <a class="header-anchor" href="#-doctor-" aria-label="Permalink to &quot; doctor - &quot;"></a></h2><p> <code>bin/spc</code> PHP <code>bin/spc doctor</code> </p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># </span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --all</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -U</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;curl:https://curl.se/download/curl-7.88.1.tar.gz&quot;</span></span></code></pre></div><p> Git 使 <code>-G</code> <code>--custom-git</code> 使 Git source 使 <code>{source-name}:{branch}:{url}</code> 使 <code>--for-extensions</code> </p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># master php-src</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --for-extensions=redis,phar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -G</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;php-src:master:https://github.com/php/php-src.git&quot;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># swoole-src 仓库下载 master 分支的最新代码而不是发行版</span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> download</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --for-extensions=swoole</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -G</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;swoole:master:https://github.com/swoole/swoole-src.git&quot;</span></span></code></pre></div><h2 id="-doctor-" tabindex="-1"> doctor - <a class="header-anchor" href="#-doctor-" aria-label="Permalink to &quot; doctor - &quot;"></a></h2><p> <code>bin/spc</code> PHP <code>bin/spc doctor</code> </p><div class="language-bash vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># </span></span>
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> doctor</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 快速检查并在可以自动修复的时候修复使用包管理安装依赖包仅支持上述提到的操作系统及发行版</span></span>
@@ -134,4 +138,4 @@ import{_ as s,c as i,o as a,a1 as n}from"./chunks/framework.CszIUXhs.js";const g
<span class="line"><span>Loaded Configuration File =&gt; /Users/jerry/project/git-project/static-php-cli/php.ini</span></span>
<span class="line"><span></span></span>
<span class="line"><span>$ buildroot/bin/php -i | grep memory</span></span>
<span class="line"><span>memory_limit =&gt; 8G =&gt; 8G</span></span></code></pre></div><p> static-php-cli </p><p>使 <code>-P</code> </p><ul><li><code>SPC\\store\\FileSystem</code>: <ul><li><code>::replaceFileStr(string $filename, string $search, $replace)</code>: </li><li><code>::replaceFileStr(string $filename, string $pattern, $replace)</code>: </li><li><code>::replaceFileUser(string $filename, $callback)</code>: </li><li><code>::copyDir(string $from, string $to)</code>: </li><li><code>::convertPath(string $path)</code>: </li><li><code>::scanDirFiles(string $dir, bool $recursive = true, bool|string $relative = false, bool $include_dir = false)</code>: </li></ul></li><li><code>SPC\\builder\\BuilderBase</code>: <ul><li><code>-&gt;getPatchPoint()</code>: </li><li><code>-&gt;getOption(string $key, $default = null)</code>: </li><li><code>-&gt;getPHPVersionID()</code>: PHP ID</li><li><code>-&gt;getPHPVersion()</code>: PHP </li><li><code>-&gt;setOption(string $key, $value)</code>: </li><li><code>-&gt;setOptionIfNotExists(string $key, $value)</code>: </li></ul></li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>static-php-cli <code>public function</code> <code>@internal</code></p></div><h2 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h2><p></p><ul><li> PHP 使 <code>bin/spc switch-php-version</code> PHP <code>build</code> </li><li> <code>rm -rf buildroot source</code> </li><li>使 <code>bin/spc del-download &lt;source-name&gt;</code> 使 <code>download &lt;source-name&gt;</code> </li><li>使 <code>bin/spc download --clean</code> </li></ul>`,104),e=[l];function t(h,d,c,k,o,r){return a(),i("div",null,e)}const b=s(p,[["render",t]]);export{g as __pageData,b as default};
<span class="line"><span>memory_limit =&gt; 8G =&gt; 8G</span></span></code></pre></div><p> static-php-cli </p><p>使 <code>-P</code> </p><ul><li><code>SPC\\store\\FileSystem</code>: <ul><li><code>::replaceFileStr(string $filename, string $search, $replace)</code>: </li><li><code>::replaceFileStr(string $filename, string $pattern, $replace)</code>: </li><li><code>::replaceFileUser(string $filename, $callback)</code>: </li><li><code>::copyDir(string $from, string $to)</code>: </li><li><code>::convertPath(string $path)</code>: </li><li><code>::scanDirFiles(string $dir, bool $recursive = true, bool|string $relative = false, bool $include_dir = false)</code>: </li></ul></li><li><code>SPC\\builder\\BuilderBase</code>: <ul><li><code>-&gt;getPatchPoint()</code>: </li><li><code>-&gt;getOption(string $key, $default = null)</code>: </li><li><code>-&gt;getPHPVersionID()</code>: PHP ID</li><li><code>-&gt;getPHPVersion()</code>: PHP </li><li><code>-&gt;setOption(string $key, $value)</code>: </li><li><code>-&gt;setOptionIfNotExists(string $key, $value)</code>: </li></ul></li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>static-php-cli <code>public function</code> <code>@internal</code></p></div><h2 id="" tabindex="-1"> <a class="header-anchor" href="#" aria-label="Permalink to &quot;&quot;"></a></h2><p></p><ul><li> PHP 使 <code>bin/spc switch-php-version</code> PHP <code>build</code> </li><li> <code>rm -rf buildroot source</code> </li><li>使 <code>bin/spc del-download &lt;source-name&gt;</code> 使 <code>download &lt;source-name&gt;</code> </li><li>使 <code>bin/spc download --clean</code> </li></ul>`,106),e=[l];function t(h,d,c,k,o,r){return a(),i("div",null,e)}const b=s(p,[["render",t]]);export{g as __pageData,b as default};

View File

@@ -1 +1 @@
import{_ as s,c as i,o as a,a1 as n}from"./chunks/framework.CszIUXhs.js";const g=JSON.parse('{"title":"本地构建Linux、macOS、FreeBSD","description":"","frontmatter":{},"headers":[],"relativePath":"zh/guide/manual-build.md","filePath":"zh/guide/manual-build.md"}'),p={name:"zh/guide/manual-build.md"},l=n("",104),e=[l];function t(h,d,c,k,o,r){return a(),i("div",null,e)}const b=s(p,[["render",t]]);export{g as __pageData,b as default};
import{_ as s,c as i,o as a,a1 as n}from"./chunks/framework.CszIUXhs.js";const g=JSON.parse('{"title":"本地构建Linux、macOS、FreeBSD","description":"","frontmatter":{},"headers":[],"relativePath":"zh/guide/manual-build.md","filePath":"zh/guide/manual-build.md"}'),p={name:"zh/guide/manual-build.md"},l=n("",106),e=[l];function t(h,d,c,k,o,r){return a(),i("div",null,e)}const b=s(p,[["render",t]]);export{g as __pageData,b as default};