Files
static-php-cli/assets/en_develop_package-model.md.D5wiXvya.js
2026-05-11 05:18:54 +00:00

161 lines
42 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{_ as i,c as a,o as n,aj as e}from"./chunks/framework.C2AwuPrQ.js";const c=JSON.parse('{"title":"Package Model","description":"","frontmatter":{},"headers":[],"relativePath":"en/develop/package-model.md","filePath":"en/develop/package-model.md"}'),t={name:"en/develop/package-model.md"};function l(p,s,h,k,r,d){return n(),a("div",null,[...s[0]||(s[0]=[e(`<h1 id="package-model" tabindex="-1">Package Model <a class="header-anchor" href="#package-model" aria-label="Permalink to “Package Model”"></a></h1><h2 id="package-definition" tabindex="-1">Package Definition <a class="header-anchor" href="#package-definition" aria-label="Permalink to “Package Definition”"></a></h2><p>A Package is the core concept in StaticPHP&#39;s build system, representing a buildable/installable unit such as a PHP extension, library, or build target.</p><p>Each Package contains build information, dependencies, and build logic, forming StaticPHP&#39;s build model. Package definitions are primarily implemented through YAML/JSON configuration files. The package configuration files for the <code>core</code> registry are located in the <code>config/pkg/</code> directory, and the corresponding build classes are in the <code>src/Package/</code> directory.</p><p>Packages are primarily divided into four types:</p><ul><li><strong>php-extension</strong>: A PHP extension package containing build information and logic for a PHP extension.</li><li><strong>library</strong>: A library package containing build information and logic for build tools, dependency libraries, etc.</li><li><strong>target</strong>: A build target package representing the final build artifact, such as a PHP binary or curl binary. Inherits from the <code>library</code> package type.</li><li><strong>virtual-target</strong>: A virtual build target package representing an abstract build target that doesn&#39;t directly correspond to a build artifact, primarily used for dependency management and build scheduling.</li></ul><div class="language-yaml"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="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><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">pkg-name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">pkg-type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span>
<span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> ...</span></span></code></pre></div><h2 id="artifact-definition" tabindex="-1">Artifact Definition <a class="header-anchor" href="#artifact-definition" aria-label="Permalink to “Artifact Definition”"></a></h2><p>An Artifact is a definition independent of Packages. It contains the source archive file or pre-built binary for building packages. Each Artifact defines download URLs, extraction methods, and build artifact file paths. Packages can reference one or more Artifacts via the <code>artifact</code> field to obtain the source or binaries needed for building.</p><p>In simple terms, by default one Package corresponds to one Artifact; if multiple Packages share the same source, you can define a single Artifact for multiple Packages to reference. Artifact definitions are located in the <code>config/artifact/</code> directory, and the corresponding custom download/extract logic classes are in the <code>src/Package/Artifact/</code> directory. For special package types like virtual targets and PHP built-in extensions, a Package may also omit the Artifact field entirely.</p><p>Assuming <code>example-library-package</code> is a dependency library whose source archive is hosted at <code>https://example.com/example-library.tar.gz</code>, its Package and Artifact definitions would look like this:</p><div class="language-yaml"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="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><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">example-library-package</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">library</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> artifact</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> source</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">url</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> url</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;https://example.com/example-library.tar.gz&#39;</span></span></code></pre></div><p>For more on Artifact definitions, see the <a href="./artifact-model.html">Artifact Model</a> chapter.</p><h2 id="php-extension-package-type" tabindex="-1">php-extension Package Type <a class="header-anchor" href="#php-extension-package-type" aria-label="Permalink to “php-extension Package Type”"></a></h2><p>A php-extension package represents a PHP extension. Its configuration file is located in the <code>config/pkg/ext/</code> directory, and its build class inherits from <code>PhpExtensionPackage</code> in the <code>src/Package/Extension/</code> directory. PHP extension package configurations include extension name, version, dependencies, build options, and more.</p><div class="language-yaml"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="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><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">ext-lz4</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">php-extension</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> artifact</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> source</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">git</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> url</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;https://github.com/kjdev/php-ext-lz4.git&#39;</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> rev</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">master</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> extract</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">php-src/ext/lz4</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> metadata</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> license-files</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">LICENSE</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> license</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">MIT</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> depends</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">liblz4</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> php-extension</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> arg-type@unix</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;--enable-lz4=@shared_suffix@ --with-lz4-includedir=@build_root_path@&#39;</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> arg-type@windows</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;--enable-lz4&#39;</span></span></code></pre></div><p>Allowed fields for <code>php-extension</code>:</p><div class="language-yaml"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="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><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">ext-{ext-name}</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Package name must start with ext- prefix</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">php-extension</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # ── Common Fields ────────────────────────────────────────────────────────</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> description</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;..&#39;</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Optional, human-readable package description</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> lang</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">c</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Optional, implementation language of the extension (c / c++ etc.)</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> frameworks</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [] </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Optional, list of related macOS framework dependencies</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> artifact</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;{artifact-name}&#39;</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Optional; when a string, references an Artifact definition</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # with the same name; when an object, is an inline Artifact</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # (built-in extensions don&#39;t need this field)</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # depends / suggests support @windows / @unix / @linux / @macos suffixes</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> depends</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [] </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Optional, hard dependency list (library names as-is, PHP extensions need ext- prefix)</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> depends@unix</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [] </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Optional, hard dependencies only effective on Unix platforms</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> depends@windows</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [] </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Optional, hard dependencies only effective on Windows platforms</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> suggests</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [] </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Optional, optional dependency list (same format as depends)</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> suggests@unix</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: []</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # ── php-extension Specific Fields (nested under php-extension: object) ────</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> php-extension</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # arg-type determines the form of arguments passed to ./configure, supports platform suffixes</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Supported platform suffixes: @unix (Linux + macOS), @linux, @macos, @windows</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Priority (using Linux as example): arg-type@linux &gt; arg-type@unix &gt; arg-type (no suffix)</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Built-in keywords:</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # enable → --enable-{extname} (default value, used when not configured)</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # enable-path → --enable-{extname}={buildroot}</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # with → --with-{extname}</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # with-path → --with-{extname}={buildroot}</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # custom/none → Pass no arguments (handled by the #[CustomPhpConfigureArg] method in the PHP class)</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # You can also write the full argument string directly, supporting the following placeholders:</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # @build_root_path@ → BUILD_ROOT_PATH (absolute path of buildroot)</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # @shared_suffix@ → Expands to =shared in shared builds, empty in static builds</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # @shared_path_suffix@ → Expands to =shared,{buildroot} in shared builds,</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # expands to ={buildroot} in static builds</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> arg-type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">enable</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> arg-type@unix</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;--enable-{extname}=@shared_suffix@&#39;</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> arg-type@windows</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">with-path</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> zend-extension</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">false</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Optional, true indicates this is a Zend extension (e.g., opcache, xdebug)</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> build-shared</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Optional, whether building as a shared extension (.so) is allowed, default true</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> build-static</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Optional, whether inline static building (compiled into PHP) is allowed, default true</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> build-with-php</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Optional, true means the extension is built together via the PHP source tree</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # (used for built-in extensions)</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # display-name affects the php --ri argument in smoke tests and the license export display name</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # If not set, defaults to the extension name (the part after ext-); if set to empty string, skips --ri check</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> display-name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;My Extension&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # os restricts the extension to be available only on specified platforms;</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # platforms not in the list will be rejected for building</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Allowed values: Linux, Darwin, Windows</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> os</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">Linux</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">, </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">Darwin</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span></code></pre></div><h2 id="library-package-type" tabindex="-1">library Package Type <a class="header-anchor" href="#library-package-type" aria-label="Permalink to “library Package Type”"></a></h2><p>A library package represents a dependency library that needs to be compiled from source (such as openssl, zlib, etc.). Its configuration file is located in the <code>config/pkg/lib/</code> directory, and its build class inherits from <code>LibraryPackage</code> in the <code>src/Package/Library/</code> directory.</p><p>Taking openssl as an example:</p><div class="language-yaml"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="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><span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;">openssl</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">library</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> artifact</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> source</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">ghrel</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> repo</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">openssl/openssl</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> match</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">openssl.+\\.tar\\.gz</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> prefer-stable</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> binary</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">hosted</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> metadata</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> license-files</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">LICENSE.txt</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">]</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> license</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">OpenSSL</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> depends</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">zlib</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> depends@windows</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">zlib</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">jom</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> headers</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">openssl</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> static-libs@unix</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">libssl.a</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">libcrypto.a</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> static-libs@windows</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">libssl.lib</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">libcrypto.lib</span></span></code></pre></div><p>Allowed fields for <code>library</code>:</p><div class="language-yaml"><button title="Copy Code" class="copy"></button><span class="lang">yaml</span><pre class="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><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">lib-name</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> type</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">library</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # library or target (target inherits all fields from library)</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # ── Common Fields ─────────────────────────────────────────────────────────</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> description</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;..&#39;</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Optional, human-readable package description</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> license</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">MIT</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Optional, SPDX license identifier (for license export)</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> lang</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">c</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Optional, implementation language of the library (c / c++ etc.)</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> frameworks</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [] </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Optional, list of related framework tags</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> artifact</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;{artifact-name}&#39;</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Required; when a string, references an Artifact definition</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # with the same name; when an object, is an inline Artifact</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # depends / suggests support @windows / @unix / @linux / @macos suffixes</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> depends</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [] </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Optional, hard dependency list (library names or PHP extension names with ext- prefix)</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> depends@unix</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: []</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> depends@windows</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: []</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> suggests</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [] </span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Optional, optional dependency list (same format as depends)</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # ── library / target Specific Fields ───────────────────────────────────────</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # The following fields are used to verify that artifacts have been correctly</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # installed after the build. They support @unix / @windows / @linux / @macos suffixes.</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Verify that specified header files or directories exist under buildroot/include/</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Relative paths are based on buildroot/include/, absolute paths are used directly</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> headers</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">openssl</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Corresponds to buildroot/include/openssl/</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">zlib.h</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Corresponds to buildroot/include/zlib.h</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> headers@unix</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">ffi.h</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Verify that specified static library files exist under buildroot/lib/</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Relative paths are based on buildroot/lib/, absolute paths are used directly</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> static-libs@unix</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">libssl.a</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> static-libs@windows</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">libssl.lib</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Verify that specified .pc files exist under buildroot/lib/pkgconfig/</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Only checked on non-Windows platforms (pkg-config is not applicable on Windows)</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> pkg-configs</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">openssl</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Corresponds to buildroot/lib/pkgconfig/openssl.pc</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">libssl</span><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Auto-completes .pc suffix</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Verify that specified executable files exist under buildroot/bin/</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Relative paths are based on buildroot/bin/, absolute paths are used directly</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> static-bins</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">my-tool</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # List of directories injected into the global PATH after the package is installed.</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Path placeholders are supported (see below for details).</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> path</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> - </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;{pkg_root_path}/rust/bin&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Environment variables set after the package is installed (overwrites existing values).</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Path placeholders are supported.</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> env</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> MY_VAR</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39;{build_root_path}/lib&#39;</span></span>
<span class="line"></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Values appended to the end of existing environment variables after the package is installed.</span></span>
<span class="line"><span style="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # Path placeholders are supported.</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> append-env</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">:</span></span>
<span class="line"><span style="--shiki-light:#22863A;--shiki-dark:#85E89D;"> CFLAGS</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&#39; -I{build_root_path}/include&#39;</span></span></code></pre></div><p>The following path placeholders are supported in string values of the <code>path</code>, <code>env</code>, and <code>append-env</code> fields:</p><table tabindex="0"><thead><tr><th>Placeholder</th><th>Actual Path</th></tr></thead><tbody><tr><td><code>{build_root_path}</code></td><td>buildroot directory (<code>buildroot/</code>)</td></tr><tr><td><code>{pkg_root_path}</code></td><td>pkgroot directory (<code>pkgroot/</code>)</td></tr><tr><td><code>{working_dir}</code></td><td>Working directory (project root)</td></tr><tr><td><code>{download_path}</code></td><td>Download cache directory (<code>downloads/</code>)</td></tr><tr><td><code>{source_path}</code></td><td>Extracted source directory (<code>source/</code>)</td></tr><tr><td><code>{php_sdk_path}</code></td><td>Windows PHP SDK directory</td></tr></tbody></table><h2 id="target-package-type" tabindex="-1">target Package Type <a class="header-anchor" href="#target-package-type" aria-label="Permalink to “target Package Type”"></a></h2><p>A <code>target</code> package represents a final build artifact. It inherits from <code>library</code>, so it includes all definition fields of <code>library</code>. The configuration file for <code>target</code> packages is located in the <code>config/pkg/target/</code> directory, and its build class inherits from <code>TargetPackage</code> in the <code>src/Package/Target/</code> directory.</p><p>The only difference from <code>library</code> is that a <code>target</code> package can be registered as a build target and automatically registers the build command <code>spc build:{target-name}</code>.</p><h2 id="virtual-target-package-type" tabindex="-1">virtual-target Package Type <a class="header-anchor" href="#virtual-target-package-type" aria-label="Permalink to “virtual-target Package Type”"></a></h2><p>Unlike <code>target</code>, a <code>virtual-target</code> may not include an <code>artifact</code>, meaning it doesn&#39;t directly correspond to a buildable entity but is instead an abstract build target, primarily used for dependency management and build scheduling. The configuration file for <code>virtual-target</code> is located in the <code>config/pkg/target/</code> directory, and its build class inherits from <code>TargetPackage</code> in the <code>src/Package/Target/</code> directory. Its definition is essentially the same as <code>target</code>, but the <code>artifact</code> field is optional and typically not set. <code>virtual-target</code> is primarily used in the following scenarios:</p><ul><li>Defining an abstract build target for other packages to depend on, without directly corresponding to a buildable entity.</li><li>Serving as a common dependency for multiple <code>target</code> packages, simplifying dependency management.</li></ul><p>A typical example is the <code>php-cli</code>, <code>php-fpm</code> build targets for PHP. They have no independent source code and depend on <code>php-src</code>, with the final build outcome (CLI or FPM binary) determined through build scheduling.</p>`,33)])])}const g=i(t,[["render",l]]);export{c as __pageData,g as default};