<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">SPC_CONCURRENCY</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">4</span><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;"> bin/spc</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> build</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> mbstring,pcntl</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --build-cli</span></span></code></pre></div><p>Or, if you need to modify an environment variable for a long time, you can modify the <code>config/env.ini</code> file.</p><p><code>config/env.ini</code> is divided into three sections, <code>[global]</code> is globally effective, <code>[windows]</code>, <code>[macos]</code>, <code>[linux]</code> are only effective for the corresponding operating system.</p><p>For example, if you need to modify the <code>./configure</code> command for compiling PHP, you can find the <code>SPC_CMD_PREFIX_PHP_CONFIGURE</code> environment variable in the <code>config/env.ini</code> file, and then modify its value.</p><p>If your build conditions are more complex and require multiple <code>env.ini</code> files to switch, we recommend that you use the <code>config/env.custom.ini</code> file. In this way, you can specify your environment variables by writing additional override items without modifying the default <code>config/env.ini</code> file.</p><divclass="language-ini"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">ini</span><preclass="shiki shiki-themes github-light github-dark"style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;"tabindex="0"dir="ltr"><code><spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">; This is an example of `config/env.custom.ini` file, </span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;">; we modify the `SPC_CONCURRENCY` and linux default CFLAGS passing to libs and PHP</span></span>
<spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">SPC_DEFAULT_C_FLAGS</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">=</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"-O3"</span></span></code></pre></div><h2id="library-environment-variables-unix-only"tabindex="-1">Library environment variables (Unix only) <aclass="header-anchor"href="#library-environment-variables-unix-only"aria-label="Permalink to “Library environment variables (Unix only)”"></a></h2><p>Starting from 2.2.0, static-php-cli supports custom environment variables for all compilation dependent library commands of macOS, Linux, FreeBSD and other Unix systems.</p><p>In this way, you can adjust the behavior of compiling dependent libraries through environment variables at any time. For example, you can set the optimization parameters for compiling the xxx library through <code>xxx_CFLAGS=-O0</code>.</p><p>Of course, not every library supports the injection of environment variables. We currently provide three wildcard environment variables with the suffixes:</p><ul><li><code>_CFLAGS</code>: CFLAGS for the compiler</li><li><code>_LDFLAGS</code>: LDFLAGS for the linker</li><li><code>_LIBS</code>: LIBS for the linker</li></ul><p>The prefix is the name of the dependent library, and the specific name of the library is subject to <code>lib.json</code>. Among them, the library name with <code>-</code> needs to replace <code>-</code> with <code>_</code>.</p><p>Here is an example of an optimization option that replaces the openssl library compilation:</p><divclass="language-shell"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">shell</span><preclass="shiki shiki-themes github-light github-dark"style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;"tabindex="0"dir="ltr"><code><spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">openssl_CFLAGS</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"-O0"</span></span></code></pre></div><p>The library name uses the same name listed in <code>lib.json</code> and is case-sensitive.</p><divclass="tip custom-block"><pclass="custom-block-title custom-block-title-default">TIP</p><p>When no relevant environment variables are specified, except for the following variables, the remaining values are empty by default:</p><tabletabindex="0"><thead><tr><th>var name</th><th>var default value</th></tr></thead><tbody><tr><td><code>pkg_config_CFLAGS</code></td><td>macOS: <code>$SPC_DEFAULT_C_FLAGS -Wimplicit-function-declaration -Wno-int-conversion</code>, Other: empty</td></tr><tr><td><code>pkg_config_LDFLAGS</code></td><td>Linux: <code>--static</code>, Other: empty</td></tr><tr><td><code>imagemagick_LDFLAGS</code></td><td>Linux: <code>-static</code>, Other: empty</td></tr><tr><td><code>imagemagick_LIBS</code></td><td>macOS: <code>-liconv</code>, Other: empty</td></tr><tr><td><code>ldap_LDFLAGS</code></td><td><code>-L$BUILD_LIB_PATH</code></td></tr><tr><td><code>openssl_CFLAGS</code></td><td>Linux: <code>$SPC_DEFAULT_C_FLAGS</code>, Other: empty</td></tr><tr><td>others...</td><td>empty</td></tr></tbody></table></div><p>The following table is a list of library names that support customizing the above three variables:</p><tabletabindex="0"><thead><tr><th>lib name</th></tr></thead><tbody><tr><td>brotli</td></tr><tr><td>bzip</td></tr><tr><td>curl</td></tr><tr><td>freetype</td></tr><tr><td>gettext</td></tr><tr><td>gmp</td></tr><tr><td>imagemagick</td></tr><tr><td>ldap</td></tr><tr><td>libargon2</td></tr><tr><td>libavif</td></tr><tr><td>libcares</td></tr><tr><td>libevent</td></tr><tr><td>openssl</td></tr></tbody></table><divclass="tip custom-block"><pclass="custom-block-title custom-block-title-default">TIP</p><p>Because adapting custom environment variables to each library is a particularly tedious task, and in most cases you do not need custom environment variables for these libraries,