mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-10 10:25:36 +08:00
deploy: 758b697cee
This commit is contained in:
2
assets/chunks/CliGenerator.CghG5-6u.js
Normal file
2
assets/chunks/CliGenerator.CghG5-6u.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -3,12 +3,13 @@ import{_ as s,c as i,o as a,a1 as e}from"./chunks/framework.CszIUXhs.js";const u
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"ghrel"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "repo"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"libevent/libevent"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "match"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"libevent.+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.tar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.gz"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "license"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "provide-pre-built"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "license"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"file"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "path"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"LICENSE"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>The most important field here is <code>type</code>. Currently, the types it supports are:</p><ul><li><code>url</code>: Directly use URL to download, for example: <code>https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz</code>.</li><li><code>ghrel</code>: Use the GitHub Release API to download, download the artifacts uploaded from the latest version released by maintainers.</li><li><code>ghtar</code>: Use the GitHub Release API to download. Different from <code>ghrel</code>, <code>ghtar</code> is downloaded from the <code>source code (tar.gz)</code> in the latest Release of the project.</li><li><code>ghtagtar</code>: Use GitHub Release API to download. Compared with <code>ghtar</code>, <code>ghtagtar</code> can find the latest one from the <code>tags</code> list and download the source code in <code>tar.gz</code> format (because some projects only use <code>tag</code> release version).</li><li><code>bitbuckettag</code>: Download using BitBucket API, basically the same as <code>ghtagtar</code>, except this one applies to BitBucket.</li><li><code>git</code>: Clone the project directly from a Git address to download sources, applicable to any public Git repository.</li><li><code>filelist</code>: Use a crawler to crawl the Web download site that provides file index, and get the latest version of the file name and download it.</li><li><code>custom</code>: If none of the above download methods are satisfactory, you can write <code>custom</code>, create a new class under <code>src/SPC/store/source/</code>, extends <code>CustomSourceBase</code>, and write the download script yourself.</li></ul><h2 id="source-json-common-parameters" tabindex="-1">source.json Common parameters <a class="header-anchor" href="#source-json-common-parameters" aria-label="Permalink to "source.json Common parameters""></a></h2><p>Each source file in source.json has the following params:</p><ul><li><code>license</code>: the open source license of the source code, see <strong>Open Source License</strong> section below</li><li><code>type</code>: must be one of the types mentioned above</li><li><code>path</code> (optional): release the source code to the specified directory instead of <code>source/{name}</code></li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>The <code>path</code> parameter in <code>source.json</code> can specify a relative or absolute path. When specified as a relative path, the path is based on <code>source/</code>.</p></div><h2 id="download-type-url" tabindex="-1">Download type - url <a class="header-anchor" href="#download-type-url" aria-label="Permalink to "Download type - url""></a></h2><p>URL type sources refer to downloading files directly from the URL.</p><p>The parameters included are:</p><ul><li><code>url</code>: The download address of the file, such as <code>https://example.com/file.tgz</code></li><li><code>filename</code> (optional): The file name saved to the local area. If not specified, the file name of the url will be used.</li></ul><p>Example (download the imagick extension and extract it to the extension storage path of the php source code):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>The most important field here is <code>type</code>. Currently, the types it supports are:</p><ul><li><code>url</code>: Directly use URL to download, for example: <code>https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz</code>.</li><li><code>ghrel</code>: Use the GitHub Release API to download, download the artifacts uploaded from the latest version released by maintainers.</li><li><code>ghtar</code>: Use the GitHub Release API to download. Different from <code>ghrel</code>, <code>ghtar</code> is downloaded from the <code>source code (tar.gz)</code> in the latest Release of the project.</li><li><code>ghtagtar</code>: Use GitHub Release API to download. Compared with <code>ghtar</code>, <code>ghtagtar</code> can find the latest one from the <code>tags</code> list and download the source code in <code>tar.gz</code> format (because some projects only use <code>tag</code> release version).</li><li><code>bitbuckettag</code>: Download using BitBucket API, basically the same as <code>ghtagtar</code>, except this one applies to BitBucket.</li><li><code>git</code>: Clone the project directly from a Git address to download sources, applicable to any public Git repository.</li><li><code>filelist</code>: Use a crawler to crawl the Web download site that provides file index, and get the latest version of the file name and download it.</li><li><code>custom</code>: If none of the above download methods are satisfactory, you can write <code>custom</code>, create a new class under <code>src/SPC/store/source/</code>, extends <code>CustomSourceBase</code>, and write the download script yourself.</li></ul><h2 id="source-json-common-parameters" tabindex="-1">source.json Common parameters <a class="header-anchor" href="#source-json-common-parameters" aria-label="Permalink to "source.json Common parameters""></a></h2><p>Each source file in source.json has the following params:</p><ul><li><code>license</code>: the open source license of the source code, see <strong>Open Source License</strong> section below</li><li><code>type</code>: must be one of the types mentioned above</li><li><code>path</code> (optional): release the source code to the specified directory instead of <code>source/{name}</code></li><li><code>provide-pre-built</code> (optional): whether to provide precompiled binary files. If <code>true</code>, it will automatically try to download precompiled binary files when running <code>bin/spc download</code></li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>The <code>path</code> parameter in <code>source.json</code> can specify a relative or absolute path. When specified as a relative path, the path is based on <code>source/</code>.</p></div><h2 id="download-type-url" tabindex="-1">Download type - url <a class="header-anchor" href="#download-type-url" aria-label="Permalink to "Download type - url""></a></h2><p>URL type sources refer to downloading files directly from the URL.</p><p>The parameters included are:</p><ul><li><code>url</code>: The download address of the file, such as <code>https://example.com/file.tgz</code></li><li><code>filename</code> (optional): The file name saved to the local area. If not specified, the file name of the url will be used.</li></ul><p>Example (download the imagick extension and extract it to the extension storage path of the php source code):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "ext-imagick"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"url"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "url"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://pecl.php.net/get/imagick"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{C as e}from"./chunks/CliGenerator.kmB1Poxd.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.CszIUXhs.js";const i=n('<h1 id="cli-build-command-generator" tabindex="-1">CLI Build Command Generator <a class="header-anchor" href="#cli-build-command-generator" aria-label="Permalink to "CLI Build Command Generator""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>The extensions selected below may contain extensions that are not supported by the selected operating system, which may cause compilation to fail. Please check <a href="./extensions.html">Supported Extensions</a> first.</p></div>',2),u=JSON.parse('{"title":"CLI Build Command Generator","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/cli-generator.md","filePath":"en/guide/cli-generator.md"}'),s={name:"en/guide/cli-generator.md"},h=t({...s,setup(c){return(l,d)=>(r(),a("div",null,[i,o(e,{lang:"en"})]))}});export{u as __pageData,h as default};
|
||||
import{C as e}from"./chunks/CliGenerator.CghG5-6u.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.CszIUXhs.js";const i=n('<h1 id="cli-build-command-generator" tabindex="-1">CLI Build Command Generator <a class="header-anchor" href="#cli-build-command-generator" aria-label="Permalink to "CLI Build Command Generator""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>The extensions selected below may contain extensions that are not supported by the selected operating system, which may cause compilation to fail. Please check <a href="./extensions.html">Supported Extensions</a> first.</p></div>',2),u=JSON.parse('{"title":"CLI Build Command Generator","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/cli-generator.md","filePath":"en/guide/cli-generator.md"}'),s={name:"en/guide/cli-generator.md"},h=t({...s,setup(c){return(l,d)=>(r(),a("div",null,[i,o(e,{lang:"en"})]))}});export{u as __pageData,h as default};
|
||||
@@ -1 +1 @@
|
||||
import{C as e}from"./chunks/CliGenerator.kmB1Poxd.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.CszIUXhs.js";const i=n('<h1 id="cli-build-command-generator" tabindex="-1">CLI Build Command Generator <a class="header-anchor" href="#cli-build-command-generator" aria-label="Permalink to "CLI Build Command Generator""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>The extensions selected below may contain extensions that are not supported by the selected operating system, which may cause compilation to fail. Please check <a href="./extensions.html">Supported Extensions</a> first.</p></div>',2),u=JSON.parse('{"title":"CLI Build Command Generator","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/cli-generator.md","filePath":"en/guide/cli-generator.md"}'),s={name:"en/guide/cli-generator.md"},h=t({...s,setup(c){return(l,d)=>(r(),a("div",null,[i,o(e,{lang:"en"})]))}});export{u as __pageData,h as default};
|
||||
import{C as e}from"./chunks/CliGenerator.CghG5-6u.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.CszIUXhs.js";const i=n('<h1 id="cli-build-command-generator" tabindex="-1">CLI Build Command Generator <a class="header-anchor" href="#cli-build-command-generator" aria-label="Permalink to "CLI Build Command Generator""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>The extensions selected below may contain extensions that are not supported by the selected operating system, which may cause compilation to fail. Please check <a href="./extensions.html">Supported Extensions</a> first.</p></div>',2),u=JSON.parse('{"title":"CLI Build Command Generator","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/cli-generator.md","filePath":"en/guide/cli-generator.md"}'),s={name:"en/guide/cli-generator.md"},h=t({...s,setup(c){return(l,d)=>(r(),a("div",null,[i,o(e,{lang:"en"})]))}});export{u as __pageData,h as default};
|
||||
@@ -52,6 +52,9 @@ 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:#6A737D;--shiki-dark:#6A737D;"># Download only extensions and libraries to be compiled (use extensions, including suggested libraries)</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=openssl,swoole,zip,pcntl,zstd</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Download resources, prefer to download dependencies with pre-built packages (reduce the time to compile dependencies)</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=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"curl,pcntl,xml,mbstring"</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --prefer-pre-built</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Download only the extensions and dependent libraries to be compiled (use extensions, excluding suggested libraries)</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=openssl,swoole,zip,pcntl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --without-suggestions</span></span>
|
||||
<span class="line"></span>
|
||||
@@ -105,7 +108,7 @@ 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;"> micro:combine</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> a.php</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -N</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /path/to/your/custom.ini</span></span></code></pre></div><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>Note, please do not directly use the PHP source code or the <code>php.ini</code> file in the system-installed PHP, it is best to manually write an ini configuration file that you need, for example:</p><div class="language-ini vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ini</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;">; custom.ini</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">curl.cainfo</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=/path/to/your/cafile.pem</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">memory_limit</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=1G</span></span></code></pre></div><p>The ini injection of this command is achieved by appending a special structure after micro.sfx, which is different from the function of inserting hard-coded INI during compilation.</p></div><p>If you want to package phar, just replace <code>a.php</code> with the packaged phar file. But please note that micro.sfx under phar needs extra attention to the path problem, see <a href="./../develop/structure.html#phar-application-directory-issue">Developing - Phar directory issue</a>.</p><h2 id="command-extract" tabindex="-1">Command - extract <a class="header-anchor" href="#command-extract" aria-label="Permalink to "Command - extract""></a></h2><p>Use the command <code>bin/spc extract</code> to unpack and copy the source code required for compilation, including php-src and the source code of various dependent libraries (you need to specify the name of the library to be unpacked).</p><p>For example, after we have downloaded sources, we want to distribute and execute the build process, manually unpack and copy the package to a specified location, and we can use commands.</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;"># Unzip the downloaded compressed package of php-src and libxml2, and store the decompressed source code in the source directory</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> extract</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php-src,libxml2</span></span></code></pre></div><h2 id="dev-command-dev" tabindex="-1">Dev Command - dev <a class="header-anchor" href="#dev-command-dev" aria-label="Permalink to "Dev Command - dev""></a></h2><p>Debug commands refer to a collection of commands that can assist in outputting some information when you use static-php-cli to build PHP or modify and enhance the static-php-cli project itself.</p><ul><li><code>dev:extensions</code>: output all currently supported extension names, or output the specified extension information</li><li><code>dev:php-version</code>: output the currently compiled PHP version (by reading <code>php_version.h</code>)</li><li><code>dev:sort-config</code>: Sort the list of configuration files in the <code>config/</code> directory in alphabetical order</li><li><code>dev:lib-ver <lib-name></code>: Read the version from the source code of the dependency library (only available for specific dependency libraries)</li><li><code>dev:ext-ver <ext-name></code>: Read the corresponding version from the source code of the extension (only available for specific extensions)</li></ul><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;"># output all extensions information</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> extract</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php-src,libxml2</span></span></code></pre></div><h2 id="dev-command-dev" tabindex="-1">Dev Command - dev <a class="header-anchor" href="#dev-command-dev" aria-label="Permalink to "Dev Command - dev""></a></h2><p>Debug commands refer to a collection of commands that can assist in outputting some information when you use static-php-cli to build PHP or modify and enhance the static-php-cli project itself.</p><ul><li><code>dev:extensions</code>: output all currently supported extension names, or output the specified extension information</li><li><code>dev:php-version</code>: output the currently compiled PHP version (by reading <code>php_version.h</code>)</li><li><code>dev:sort-config</code>: Sort the list of configuration files in the <code>config/</code> directory in alphabetical order</li><li><code>dev:lib-ver <lib-name></code>: Read the version from the source code of the dependency library (only available for specific dependency libraries)</li><li><code>dev:ext-ver <ext-name></code>: Read the corresponding version from the source code of the extension (only available for specific extensions)</li><li><code>dev:pack-lib <lib-name></code>: Package the specified library into a tar.gz file (maintainer only)</li><li><code>dev:gen-ext-docs</code>: Generate extension documentation (maintainer only)</li></ul><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;"># output all extensions information</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> dev:extensions</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Output the meta information of the specified extension</span></span>
|
||||
@@ -136,4 +139,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 => /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 => 8G => 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>->getPatchPoint()</code>: Get the current injection point name</li><li><code>->getOption(string $key, $default = null)</code>: Get command line and compile-time options</li><li><code>->getPHPVersionID()</code>: Get the currently compiled PHP version ID</li><li><code>->getPHPVersion()</code>: Get the currently compiled PHP version number</li><li><code>->setOption(string $key, $value)</code>: Set options</li><li><code>->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>`,102),l=[t];function p(o,h,d,c,r,k){return e(),i("div",null,l)}const m=s(n,[["render",p]]);export{g as __pageData,m as default};
|
||||
<span class="line"><span>memory_limit => 8G => 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>->getPatchPoint()</code>: Get the current injection point name</li><li><code>->getOption(string $key, $default = null)</code>: Get command line and compile-time options</li><li><code>->getPHPVersionID()</code>: Get the currently compiled PHP version ID</li><li><code>->getPHPVersion()</code>: Get the currently compiled PHP version number</li><li><code>->setOption(string $key, $value)</code>: Set options</li><li><code>->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 "Multiple builds""></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 <source-name></code> to delete the specified source code, and then use <code>download <source-name></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};
|
||||
@@ -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("",102),l=[t];function p(o,h,d,c,r,k){return e(),i("div",null,l)}const m=s(n,[["render",p]]);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("",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};
|
||||
File diff suppressed because one or more lines are too long
1
assets/style.Da_5SHGr.css
Normal file
1
assets/style.Da_5SHGr.css
Normal file
File diff suppressed because one or more lines are too long
@@ -3,12 +3,13 @@ import{_ as s,c as i,o as a,a1 as t}from"./chunks/framework.CszIUXhs.js";const g
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"ghrel"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "repo"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"libevent/libevent"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "match"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"libevent.+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.tar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.gz"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "provide-pre-built"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "license"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"file"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "path"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"LICENSE"</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>这里最主要的字段是 <code>type</code>,目前它支持的类型有:</p><ul><li><code>url</code>: 直接使用 URL 下载,例如:<code>https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz</code>。</li><li><code>ghrel</code>: 使用 GitHub Release API 下载,即从 GitHub 项目发布的最新版本中上传的附件下载。</li><li><code>ghtar</code>: 使用 GitHub Release API 下载,与 <code>ghrel</code> 不同的是,<code>ghtar</code> 是从项目的最新 Release 中找 <code>source code (tar.gz)</code> 下载的。</li><li><code>ghtagtar</code>: 使用 GitHub Release API 下载,与 <code>ghtar</code> 相比,<code>ghtagtar</code> 可以从 <code>tags</code> 列表找最新的,并下载 <code>tar.gz</code> 格式的源码(因为有些项目只使用了 <code>tag</code> 发布版本)。</li><li><code>bitbuckettag</code>: 使用 BitBucket API 下载,基本和 <code>ghtagtar</code> 相同,只是这个适用于 BitBucket。</li><li><code>git</code>: 直接从一个 Git 地址克隆项目来下载资源,适用于任何公开 Git 仓库。</li><li><code>filelist</code>: 使用爬虫爬取提供文件索引的 Web 下载站点,并获取最新版本的文件名并下载。</li><li><code>custom</code>: 如果以上下载方式都不能满足,你可以编写 <code>custom</code> 后,在 <code>src/SPC/store/source/</code> 下新建一个类,并继承 <code>CustomSourceBase</code>,自己编写下载脚本。</li></ul><h2 id="source-json-通用参数" tabindex="-1">source.json 通用参数 <a class="header-anchor" href="#source-json-通用参数" aria-label="Permalink to "source.json 通用参数""></a></h2><p>source.json 中每个源文件拥有以下字段:</p><ul><li><code>license</code>: 源代码的开源许可证,见下方 <strong>开源许可证</strong> 章节</li><li><code>type</code>: 必须为上面提到的类型之一</li><li><code>path</code>(可选): 释放源码到指定目录而非 <code>source/{name}</code></li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p><code>source.json</code> 中的 <code>path</code> 参数可指定相对路径或绝对路径。当指定为相对路径时,路径基于 <code>source/</code>。</p></div><h2 id="下载类型-url" tabindex="-1">下载类型 - url <a class="header-anchor" href="#下载类型-url" aria-label="Permalink to "下载类型 - url""></a></h2><p>url 类型的资源指的是从 URL 直接下载文件。</p><p>包含的参数有:</p><ul><li><code>url</code>: 文件的下载地址,如 <code>https://example.com/file.tgz</code></li><li><code>filename</code>(可选): 保存到本地的文件名,如不指定,则使用 url 的文件名</li></ul><p>例子(下载 imagick 扩展,并解压缩到 php 源码的扩展存放路径):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>这里最主要的字段是 <code>type</code>,目前它支持的类型有:</p><ul><li><code>url</code>: 直接使用 URL 下载,例如:<code>https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz</code>。</li><li><code>ghrel</code>: 使用 GitHub Release API 下载,即从 GitHub 项目发布的最新版本中上传的附件下载。</li><li><code>ghtar</code>: 使用 GitHub Release API 下载,与 <code>ghrel</code> 不同的是,<code>ghtar</code> 是从项目的最新 Release 中找 <code>source code (tar.gz)</code> 下载的。</li><li><code>ghtagtar</code>: 使用 GitHub Release API 下载,与 <code>ghtar</code> 相比,<code>ghtagtar</code> 可以从 <code>tags</code> 列表找最新的,并下载 <code>tar.gz</code> 格式的源码(因为有些项目只使用了 <code>tag</code> 发布版本)。</li><li><code>bitbuckettag</code>: 使用 BitBucket API 下载,基本和 <code>ghtagtar</code> 相同,只是这个适用于 BitBucket。</li><li><code>git</code>: 直接从一个 Git 地址克隆项目来下载资源,适用于任何公开 Git 仓库。</li><li><code>filelist</code>: 使用爬虫爬取提供文件索引的 Web 下载站点,并获取最新版本的文件名并下载。</li><li><code>custom</code>: 如果以上下载方式都不能满足,你可以编写 <code>custom</code> 后,在 <code>src/SPC/store/source/</code> 下新建一个类,并继承 <code>CustomSourceBase</code>,自己编写下载脚本。</li></ul><h2 id="source-json-通用参数" tabindex="-1">source.json 通用参数 <a class="header-anchor" href="#source-json-通用参数" aria-label="Permalink to "source.json 通用参数""></a></h2><p>source.json 中每个源文件拥有以下字段:</p><ul><li><code>license</code>: 源代码的开源许可证,见下方 <strong>开源许可证</strong> 章节</li><li><code>type</code>: 必须为上面提到的类型之一</li><li><code>path</code>(可选): 释放源码到指定目录而非 <code>source/{name}</code></li><li><code>provide-pre-built</code>(可选): 是否提供预编译的二进制文件,如果为 <code>true</code>,则会在 <code>bin/spc download</code> 时尝试自动下载预编译的二进制文件</li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p><code>source.json</code> 中的 <code>path</code> 参数可指定相对路径或绝对路径。当指定为相对路径时,路径基于 <code>source/</code>。</p></div><h2 id="下载类型-url" tabindex="-1">下载类型 - url <a class="header-anchor" href="#下载类型-url" aria-label="Permalink to "下载类型 - url""></a></h2><p>url 类型的资源指的是从 URL 直接下载文件。</p><p>包含的参数有:</p><ul><li><code>url</code>: 文件的下载地址,如 <code>https://example.com/file.tgz</code></li><li><code>filename</code>(可选): 保存到本地的文件名,如不指定,则使用 url 的文件名</li></ul><p>例子(下载 imagick 扩展,并解压缩到 php 源码的扩展存放路径):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "ext-imagick"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "type"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"url"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> "url"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"https://pecl.php.net/get/imagick"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
|
||||
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{C as e}from"./chunks/CliGenerator.kmB1Poxd.js";import{d as t,c as a,I as o,a1 as r,o as i}from"./chunks/framework.CszIUXhs.js";const c=r('<h1 id="cli-编译命令生成器" tabindex="-1">CLI 编译命令生成器 <a class="header-anchor" href="#cli-编译命令生成器" aria-label="Permalink to "CLI 编译命令生成器""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>下面选择扩展可能包含所选操作系统不支持的扩展,这可能导致编译失败。请先查阅 <a href="./extensions.html">支持的扩展</a>。</p></div>',2),p=JSON.parse('{"title":"CLI 编译命令生成器","description":"","frontmatter":{},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),s={name:"zh/guide/cli-generator.md"},_=t({...s,setup(l){return(n,d)=>(i(),a("div",null,[c,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
import{C as e}from"./chunks/CliGenerator.CghG5-6u.js";import{d as t,c as a,I as o,a1 as r,o as i}from"./chunks/framework.CszIUXhs.js";const c=r('<h1 id="cli-编译命令生成器" tabindex="-1">CLI 编译命令生成器 <a class="header-anchor" href="#cli-编译命令生成器" aria-label="Permalink to "CLI 编译命令生成器""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>下面选择扩展可能包含所选操作系统不支持的扩展,这可能导致编译失败。请先查阅 <a href="./extensions.html">支持的扩展</a>。</p></div>',2),p=JSON.parse('{"title":"CLI 编译命令生成器","description":"","frontmatter":{},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),s={name:"zh/guide/cli-generator.md"},_=t({...s,setup(l){return(n,d)=>(i(),a("div",null,[c,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
@@ -1 +1 @@
|
||||
import{C as e}from"./chunks/CliGenerator.kmB1Poxd.js";import{d as t,c as a,I as o,a1 as r,o as i}from"./chunks/framework.CszIUXhs.js";const c=r('<h1 id="cli-编译命令生成器" tabindex="-1">CLI 编译命令生成器 <a class="header-anchor" href="#cli-编译命令生成器" aria-label="Permalink to "CLI 编译命令生成器""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>下面选择扩展可能包含所选操作系统不支持的扩展,这可能导致编译失败。请先查阅 <a href="./extensions.html">支持的扩展</a>。</p></div>',2),p=JSON.parse('{"title":"CLI 编译命令生成器","description":"","frontmatter":{},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),s={name:"zh/guide/cli-generator.md"},_=t({...s,setup(l){return(n,d)=>(i(),a("div",null,[c,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
import{C as e}from"./chunks/CliGenerator.CghG5-6u.js";import{d as t,c as a,I as o,a1 as r,o as i}from"./chunks/framework.CszIUXhs.js";const c=r('<h1 id="cli-编译命令生成器" tabindex="-1">CLI 编译命令生成器 <a class="header-anchor" href="#cli-编译命令生成器" aria-label="Permalink to "CLI 编译命令生成器""></a></h1><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>下面选择扩展可能包含所选操作系统不支持的扩展,这可能导致编译失败。请先查阅 <a href="./extensions.html">支持的扩展</a>。</p></div>',2),p=JSON.parse('{"title":"CLI 编译命令生成器","description":"","frontmatter":{},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),s={name:"zh/guide/cli-generator.md"},_=t({...s,setup(l){return(n,d)=>(i(),a("div",null,[c,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
@@ -48,6 +48,9 @@ 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:#6A737D;--shiki-dark:#6A737D;"># 下载资源时,忽略部分资源的缓存,强制下载(如切换 PHP 版本)</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=curl,pcntl,xml</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --ignore-cache-sources=php-src</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --with-php=8.3</span></span>
|
||||
<span class="line"></span>
|
||||
<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;"> --for-extensions=</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"curl,pcntl,xml,mbstring"</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --prefer-pre-built</span></span>
|
||||
<span class="line"></span>
|
||||
<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>
|
||||
<span class="line"></span>
|
||||
@@ -104,7 +107,7 @@ 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;"> micro:combine</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> a.php</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -N</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> /path/to/your/custom.ini</span></span></code></pre></div><div class="warning custom-block"><p class="custom-block-title">WARNING</p><p>注意,请不要直接使用 PHP 源码或系统安装的 PHP 中的 <code>php.ini</code> 文件,最好手动编写一个自己需要的参数配置文件,例如:</p><div class="language-ini vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">ini</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;">; custom.ini</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">curl.cainfo</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=/path/to/your/cafile.pem</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">memory_limit</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=1G</span></span></code></pre></div><p>该命令的注入 ini 是通过在 micro.sfx 后追加一段特殊的结构来实现的,和编译时插入硬编码 INI 的功能不同。</p></div><p>如果要打包 phar,只需要将 <code>a.php</code> 替换为打包好的 phar 文件即可。但要注意,phar 下的 micro.sfx 需要额外注意路径问题,见 <a href="./../develop/structure.html#phar-应用目录问题">Developing - Phar 路径问题</a></p><h2 id="命令-extract-手动解压某个库" tabindex="-1">命令 extract - 手动解压某个库 <a class="header-anchor" href="#命令-extract-手动解压某个库" aria-label="Permalink to "命令 extract - 手动解压某个库""></a></h2><p>使用命令 <code>bin/spc extract</code> 可以解包和拷贝编译需要的源代码,包括 php-src 以及依赖的各种库的源码(需要自己指定要解包的库名)。</p><p>例如,我们在下载好资源后,想分布执行构建流程,手动解包和拷贝包到指定位置,可以使用命令。</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;"># 解压 php-src 和 libxml2 的下载压缩包,解压的源码存放在 source 目录</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> extract</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php-src,libxml2</span></span></code></pre></div><h2 id="调试命令-dev-调试命令集合" tabindex="-1">调试命令 dev - 调试命令集合 <a class="header-anchor" href="#调试命令-dev-调试命令集合" aria-label="Permalink to "调试命令 dev - 调试命令集合""></a></h2><p>调试命令指的是你在使用 static-php-cli 构建 PHP 或改造、增强 static-php-cli 项目本身的时候,可以辅助输出一些信息的命令集合。</p><ul><li><code>dev:extensions</code>: 输出目前所有支持的扩展信息,或者输出指定的扩展信息</li><li><code>dev:php-version</code>: 输出当前编译的 PHP 版本(通过读取 <code>php_version.h</code> 实现)</li><li><code>dev:sort-config</code>: 对 <code>config/</code> 目录下的配置文件的列表按照字母表排序</li><li><code>dev:lib-ver <lib-name></code>: 从依赖库的源码中读取版本(仅特定依赖库可用)</li><li><code>dev:ext-ver <ext-name></code>: 从扩展的源码中读取对应版本(仅特定扩展可用)</li></ul><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;"> extract</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> php-src,libxml2</span></span></code></pre></div><h2 id="调试命令-dev-调试命令集合" tabindex="-1">调试命令 dev - 调试命令集合 <a class="header-anchor" href="#调试命令-dev-调试命令集合" aria-label="Permalink to "调试命令 dev - 调试命令集合""></a></h2><p>调试命令指的是你在使用 static-php-cli 构建 PHP 或改造、增强 static-php-cli 项目本身的时候,可以辅助输出一些信息的命令集合。</p><ul><li><code>dev:extensions</code>: 输出目前所有支持的扩展信息,或者输出指定的扩展信息</li><li><code>dev:php-version</code>: 输出当前编译的 PHP 版本(通过读取 <code>php_version.h</code> 实现)</li><li><code>dev:sort-config</code>: 对 <code>config/</code> 目录下的配置文件的列表按照字母表排序</li><li><code>dev:lib-ver <lib-name></code>: 从依赖库的源码中读取版本(仅特定依赖库可用)</li><li><code>dev:ext-ver <ext-name></code>: 从扩展的源码中读取对应版本(仅特定扩展可用)</li><li><code>dev:pack-lib <lib-name></code>: 打包指定的依赖库(仅发布者可用)</li><li><code>dev:gen-ext-docs</code>: 生成扩展文档(仅发布者可用)</li></ul><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;"> dev:extensions</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># 输出指定扩展的信息</span></span>
|
||||
@@ -131,4 +134,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 => /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 => 8G => 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>->getPatchPoint()</code>: 获取当前的注入点名称</li><li><code>->getOption(string $key, $default = null)</code>: 获取命令行和编译时的选项</li><li><code>->getPHPVersionID()</code>: 获取当前编译的 PHP 版本 ID</li><li><code>->getPHPVersion()</code>: 获取当前编译的 PHP 版本号</li><li><code>->setOption(string $key, $value)</code>: 设定选项</li><li><code>->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>`,101),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 => 8G => 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>->getPatchPoint()</code>: 获取当前的注入点名称</li><li><code>->getOption(string $key, $default = null)</code>: 获取命令行和编译时的选项</li><li><code>->getPHPVersionID()</code>: 获取当前编译的 PHP 版本 ID</li><li><code>->getPHPVersion()</code>: 获取当前编译的 PHP 版本号</li><li><code>->setOption(string $key, $value)</code>: 设定选项</li><li><code>->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 "多次构建""></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 <source-name></code> 删除指定的源码,然后使用 <code>download <source-name></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};
|
||||
@@ -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("",101),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("",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};
|
||||
Reference in New Issue
Block a user