mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-05 07:45:39 +08:00
deploy: 1bc7bc3421
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{C as e}from"./chunks/CliGenerator.gfGtDGTf.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.gjrnbxUT.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":{"aside":false},"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.qklIY23U.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.gjrnbxUT.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":{"aside":false},"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.gfGtDGTf.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.gjrnbxUT.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":{"aside":false},"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.qklIY23U.js";import{d as t,c as a,I as o,a1 as n,o as r}from"./chunks/framework.gjrnbxUT.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":{"aside":false},"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 +0,0 @@
|
||||
import{_ as s,c as i,o as e,a1 as a}from"./chunks/framework.gjrnbxUT.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};
|
||||
@@ -1,4 +1,4 @@
|
||||
import{_ as s,c as i,o as e,a1 as a}from"./chunks/framework.gjrnbxUT.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(`<h1 id="build-linux-macos-freebsd" tabindex="-1">Build (Linux, macOS, FreeBSD) <a class="header-anchor" href="#build-linux-macos-freebsd" aria-label="Permalink to "Build (Linux, macOS, FreeBSD)""></a></h1><p>This section covers the build process for Linux, macOS, and FreeBSD. If you want to build on Windows, also need to read <a href="./build-on-windows.html">Build on Windows</a>.</p><h3 id="build-locally-using-spc-binary-recommended" tabindex="-1">Build locally (using SPC binary) (recommended) <a class="header-anchor" href="#build-locally-using-spc-binary-recommended" aria-label="Permalink to "Build locally (using SPC binary) (recommended)""></a></h3><p>This project provides a binary file of static-php-cli. You can directly download the binary file of the corresponding platform and then use it to build static PHP. Currently, the platforms supported by <code>spc</code> binary are Linux and macOS.</p><p>Here's how to download from self-hosted server:</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;"># Download from self-hosted nightly builds (sync with main branch)</span></span>
|
||||
import{_ as s,c as i,o as e,a1 as a}from"./chunks/framework.gjrnbxUT.js";const u=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(`<h1 id="build-linux-macos-freebsd" tabindex="-1">Build (Linux, macOS, FreeBSD) <a class="header-anchor" href="#build-linux-macos-freebsd" aria-label="Permalink to "Build (Linux, macOS, FreeBSD)""></a></h1><p>This section covers the build process for Linux, macOS, and FreeBSD. If you want to build on Windows, also need to read <a href="./build-on-windows.html">Build on Windows</a>.</p><h3 id="build-locally-using-spc-binary-recommended" tabindex="-1">Build locally (using SPC binary) (recommended) <a class="header-anchor" href="#build-locally-using-spc-binary-recommended" aria-label="Permalink to "Build locally (using SPC binary) (recommended)""></a></h3><p>This project provides a binary file of static-php-cli. You can directly download the binary file of the corresponding platform and then use it to build static PHP. Currently, the platforms supported by <code>spc</code> binary are Linux and macOS.</p><p>Here's how to download from self-hosted server:</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;"># Download from self-hosted nightly builds (sync with main branch)</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># For Linux x86_64</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">curl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -fsSL</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -o</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> https://dl.static-php.dev/static-php-cli/spc-bin/nightly/spc-linux-x86_64</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># For Linux aarch64</span></span>
|
||||
@@ -144,4 +144,36 @@ import{_ as s,c as i,o as e,a1 as a}from"./chunks/framework.gjrnbxUT.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><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>`,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};
|
||||
<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><h2 id="embed-usage" tabindex="-1">embed usage <a class="header-anchor" href="#embed-usage" aria-label="Permalink to "embed usage""></a></h2><p>If you want to embed static-php into other C language programs, you can use <code>--build-embed</code> to build an embed version of PHP.</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:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> {your</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> extensions}</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --build-embed</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --debug</span></span></code></pre></div><p>Under normal circumstances, PHP embed will generate <code>php-config</code> after compilation. For static-php, we provide <code>spc-config</code> to obtain the parameters during compilation. In addition, when using embed SAPI (libphp.a), you need to use the same compiler as libphp, otherwise there will be a link error.</p><p>Here is the basic usage of spc-config:</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;"># output all flags and options</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> spc-config</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> curl,zlib,phar,openssl</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># output libs</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> spc-config</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> curl,zlib,phar,openssl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --libs</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># output includes</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> spc-config</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> curl,zlib,phar,openssl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --includes</span></span></code></pre></div><p>By default, static-php uses the following compilers on different systems:</p><ul><li>macOS: <code>clang</code></li><li>Linux (Alpine Linux): <code>gcc</code></li><li>Linux (glibc based distros, x86_64): <code>/usr/local/musl/bin/x86_64-linux-musl-gcc</code></li><li>Linux (glibc based distros, aarch64): <code>/usr/local/musl/bin/aarch64-linux-musl-gcc</code></li><li>FreeBSD: <code>clang</code></li></ul><p>Here is an example of using embed SAPI:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</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;">// embed.c</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#include</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> <sapi/embed/php_embed.h></span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">int</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">int</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> argc</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">char</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> **</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">argv</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">){</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> PHP_EMBED_START_BLOCK</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(argc,argv)</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> zend_file_handle file_handle;</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> zend_stream_init_filename</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">file_handle,</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"embed.php"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">php_execute_script</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">file_handle) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">==</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> FAILURE){</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> php_printf</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"Failed to execute PHP script.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\n</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"</span><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>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> PHP_EMBED_END_BLOCK</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 0</span><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><div class="language-php vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"><?</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">php</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// embed.php</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">echo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "Hello world!</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\n</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span></code></pre></div><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;"># compile in debian/ubuntu x86_64</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">/usr/local/musl/bin/x86_64-linux-musl-gcc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> embed.c</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> $(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> spc-config</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> bcmath,zlib</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">-static</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -o</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> embed</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># compile in macOS/FreeBSD</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">clang</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> embed.c</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> $(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> spc-config</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> bcmath,zlib</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">-o</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> embed</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./embed</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># out: Hello world!</span></span></code></pre></div>`,119),l=[t];function p(o,h,d,c,r,k){return e(),i("div",null,l)}const F=s(n,[["render",p]]);export{u as __pageData,F as default};
|
||||
1
assets/en_guide_manual-build.md.cuxk79AG.lean.js
Normal file
1
assets/en_guide_manual-build.md.cuxk79AG.lean.js
Normal file
@@ -0,0 +1 @@
|
||||
import{_ as s,c as i,o as e,a1 as a}from"./chunks/framework.gjrnbxUT.js";const u=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("",119),l=[t];function p(o,h,d,c,r,k){return e(),i("div",null,l)}const F=s(n,[["render",p]]);export{u as __pageData,F as default};
|
||||
1
assets/style.BbHOO2s4.css
Normal file
1
assets/style.BbHOO2s4.css
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
import{C as e}from"./chunks/CliGenerator.gfGtDGTf.js";import{d as a,c as t,I as o,a1 as r,o as i}from"./chunks/framework.gjrnbxUT.js";const s=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":{"aside":false},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),c={name:"zh/guide/cli-generator.md"},_=a({...c,setup(l){return(n,d)=>(i(),t("div",null,[s,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
import{C as e}from"./chunks/CliGenerator.qklIY23U.js";import{d as a,c as t,I as o,a1 as r,o as i}from"./chunks/framework.gjrnbxUT.js";const s=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":{"aside":false},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),c={name:"zh/guide/cli-generator.md"},_=a({...c,setup(l){return(n,d)=>(i(),t("div",null,[s,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
@@ -1 +1 @@
|
||||
import{C as e}from"./chunks/CliGenerator.gfGtDGTf.js";import{d as a,c as t,I as o,a1 as r,o as i}from"./chunks/framework.gjrnbxUT.js";const s=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":{"aside":false},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),c={name:"zh/guide/cli-generator.md"},_=a({...c,setup(l){return(n,d)=>(i(),t("div",null,[s,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
import{C as e}from"./chunks/CliGenerator.qklIY23U.js";import{d as a,c as t,I as o,a1 as r,o as i}from"./chunks/framework.gjrnbxUT.js";const s=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":{"aside":false},"headers":[],"relativePath":"zh/guide/cli-generator.md","filePath":"zh/guide/cli-generator.md"}'),c={name:"zh/guide/cli-generator.md"},_=a({...c,setup(l){return(n,d)=>(i(),t("div",null,[s,o(e,{lang:"zh"})]))}});export{p as __pageData,_ as default};
|
||||
@@ -138,4 +138,36 @@ import{_ as s,c as i,o as a,a1 as n}from"./chunks/framework.gjrnbxUT.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><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>`,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};
|
||||
<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><h2 id="embed-使用" tabindex="-1">embed 使用 <a class="header-anchor" href="#embed-使用" aria-label="Permalink to "embed 使用""></a></h2><p>如果你想将 static-php 嵌入到其他 C 语言程序中,可以使用 <code>--build-embed</code> 构建一个 embed 版本的 PHP。</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:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> {your</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> extensions}</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --build-embed</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --debug</span></span></code></pre></div><p>在通常的情况下,PHP embed 编译后会生成 <code>php-config</code>。对于 static-php,我们提供了 <code>spc-config</code>,用于获取编译时的参数。 另外,在使用 embed SAPI(libphp.a)时,你需要使用和编译 libphp 相同的编译器,否则会出现链接错误。</p><p>下面是 spc-config 的基本用法:</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;"># output all flags and options</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> spc-config</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> curl,zlib,phar,openssl</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># output libs</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> spc-config</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> curl,zlib,phar,openssl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --libs</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># output includes</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> spc-config</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> curl,zlib,phar,openssl</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --includes</span></span></code></pre></div><p>默认情况下,static-php 在不同系统使用的编译器分别是:</p><ul><li>macOS: <code>clang</code></li><li>Linux (Alpine Linux): <code>gcc</code></li><li>Linux (glibc based distros, x86_64): <code>/usr/local/musl/bin/x86_64-linux-musl-gcc</code></li><li>Linux (glibc based distros, aarch64): <code>/usr/local/musl/bin/aarch64-linux-musl-gcc</code></li><li>FreeBSD: <code>clang</code></li></ul><p>下面是一个使用 embed SAPI 的例子:</p><div class="language-c vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">c</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;">// embed.c</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">#include</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> <sapi/embed/php_embed.h></span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">int</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> main</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">int</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;"> argc</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">char</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> **</span><span style="--shiki-light:#E36209;--shiki-dark:#FFAB70;">argv</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">){</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> PHP_EMBED_START_BLOCK</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(argc,argv)</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> zend_file_handle file_handle;</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> zend_stream_init_filename</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">file_handle,</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"embed.php"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">);</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> if</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">php_execute_script</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">&</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">file_handle) </span><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;">==</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> FAILURE){</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> php_printf</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">(</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"Failed to execute PHP script.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\n</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"</span><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>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> PHP_EMBED_END_BLOCK</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">()</span></span>
|
||||
<span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"> return</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> 0</span><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><div class="language-php vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">php</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#D73A49;--shiki-dark:#F97583;"><?</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">php</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> </span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;">// embed.php</span></span>
|
||||
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">echo</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> "Hello world!</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\n</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">;</span></span></code></pre></div><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;"># compile in debian/ubuntu x86_64</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">/usr/local/musl/bin/x86_64-linux-musl-gcc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> embed.c</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> $(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> spc-config</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> bcmath,zlib</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">-static</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> -o</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> embed</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># compile in macOS/FreeBSD</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">clang</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> embed.c</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> $(</span><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/spc</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> spc-config</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> bcmath,zlib</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">) </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">-o</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> embed</span></span>
|
||||
<span class="line"></span>
|
||||
<span class="line"><span style="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">./embed</span></span>
|
||||
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># out: Hello world!</span></span></code></pre></div>`,118),e=[l];function t(h,k,d,c,o,r){return a(),i("div",null,e)}const y=s(p,[["render",t]]);export{g as __pageData,y as default};
|
||||
@@ -1 +1 @@
|
||||
import{_ as s,c as i,o as a,a1 as n}from"./chunks/framework.gjrnbxUT.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};
|
||||
import{_ as s,c as i,o as a,a1 as n}from"./chunks/framework.gjrnbxUT.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("",118),e=[l];function t(h,k,d,c,o,r){return a(),i("div",null,e)}const y=s(p,[["render",t]]);export{g as __pageData,y as default};
|
||||
Reference in New Issue
Block a user