source-module.html 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <!DOCTYPE html>
  2. <html lang="en" dir="ltr">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1">
  6. <title>Source module | static-php-cli</title>
  7. <meta name="description" content="Build single static PHP binary, with PHP project together, with popular extensions included.">
  8. <meta name="generator" content="VitePress v1.2.3">
  9. <link rel="preload stylesheet" href="/assets/style.DdViOfjJ.css" as="style">
  10. <script type="module" src="/assets/app.D3H8Y1BO.js"></script>
  11. <link rel="preload" href="/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
  12. <link rel="modulepreload" href="/assets/chunks/framework.gjrnbxUT.js">
  13. <link rel="modulepreload" href="/assets/chunks/theme.5IQMzWyn.js">
  14. <link rel="modulepreload" href="/assets/en_develop_source-module.md.CdOHR0ez.lean.js">
  15. <script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
  16. <script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
  17. </head>
  18. <body>
  19. <div id="app"><div class="Layout" data-v-5d98c3a5><!--[--><!--]--><!--[--><span tabindex="-1" data-v-0f60ec36></span><a href="#VPContent" class="VPSkipLink visually-hidden" data-v-0f60ec36> Skip to content </a><!--]--><!----><header class="VPNav" data-v-5d98c3a5 data-v-ae24b3ad><div class="VPNavBar has-sidebar top" data-v-ae24b3ad data-v-ccf7ddec><div class="wrapper" data-v-ccf7ddec><div class="container" data-v-ccf7ddec><div class="title" data-v-ccf7ddec><div class="VPNavBarTitle has-sidebar" data-v-ccf7ddec data-v-ab179fa1><a class="title" href="/en/" data-v-ab179fa1><!--[--><!--]--><!----><span data-v-ab179fa1>static-php-cli</span><!--[--><!--]--></a></div></div><div class="content" data-v-ccf7ddec><div class="content-body" data-v-ccf7ddec><!--[--><!--]--><div class="VPNavBarSearch search" data-v-ccf7ddec><!----></div><nav aria-labelledby="main-nav-aria-label" class="VPNavBarMenu menu" data-v-ccf7ddec data-v-7f418b0f><span id="main-nav-aria-label" class="visually-hidden" data-v-7f418b0f>Main Navigation</span><!--[--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/en/guide/" tabindex="0" data-v-7f418b0f data-v-9c663999><!--[--><span data-v-9c663999>Guide</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/en/develop/" tabindex="0" data-v-7f418b0f data-v-9c663999><!--[--><span data-v-9c663999>Advanced</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/en/contributing/" tabindex="0" data-v-7f418b0f data-v-9c663999><!--[--><span data-v-9c663999>Contributing</span><!--]--></a><!--]--><!--[--><a class="VPLink link VPNavBarMenuLink" href="/en/faq/" tabindex="0" data-v-7f418b0f data-v-9c663999><!--[--><span data-v-9c663999>FAQ</span><!--]--></a><!--]--><!--]--></nav><div class="VPFlyout VPNavBarTranslations translations" data-v-ccf7ddec data-v-88af2de4 data-v-b6c34ac9><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="Change language" data-v-b6c34ac9><span class="text" data-v-b6c34ac9><span class="vpi-languages option-icon" data-v-b6c34ac9></span><!----><span class="vpi-chevron-down text-icon" data-v-b6c34ac9></span></span></button><div class="menu" data-v-b6c34ac9><div class="VPMenu" data-v-b6c34ac9 data-v-e7ea1737><!----><!--[--><!--[--><div class="items" data-v-88af2de4><p class="title" data-v-88af2de4>English</p><!--[--><div class="VPMenuLink" data-v-88af2de4 data-v-43f1e123><a class="VPLink link" href="/zh/develop/source-module.html" data-v-43f1e123><!--[-->简体中文<!--]--></a></div><!--]--></div><!--]--><!--]--></div></div></div><div class="VPNavBarAppearance appearance" data-v-ccf7ddec data-v-e6aabb21><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-e6aabb21 data-v-d1f28634 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-d1f28634></span><span class="vpi-moon moon" data-v-d1f28634></span><!--]--></span></span></button></div><div class="VPSocialLinks VPNavBarSocialLinks social-links" data-v-ccf7ddec data-v-0394ad82 data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com/crazywhalecc/static-php-cli" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-eee4e7cb><span class="vpi-social-github" /></a><!--]--></div><div class="VPFlyout VPNavBarExtra extra" data-v-ccf7ddec data-v-d0bd9dde data-v-b6c34ac9><button type="button" class="button" aria-haspopup="true" aria-expanded="false" aria-label="extra navigation" data-v-b6c34ac9><span class="vpi-more-horizontal icon" data-v-b6c34ac9></span></button><div class="menu" data-v-b6c34ac9><div class="VPMenu" data-v-b6c34ac9 data-v-e7ea1737><!----><!--[--><!--[--><div class="group translations" data-v-d0bd9dde><p class="trans-title" data-v-d0bd9dde>English</p><!--[--><div class="VPMenuLink" data-v-d0bd9dde data-v-43f1e123><a class="VPLink link" href="/zh/develop/source-module.html" data-v-43f1e123><!--[-->简体中文<!--]--></a></div><!--]--></div><div class="group" data-v-d0bd9dde><div class="item appearance" data-v-d0bd9dde><p class="label" data-v-d0bd9dde>Appearance</p><div class="appearance-action" data-v-d0bd9dde><button class="VPSwitch VPSwitchAppearance" type="button" role="switch" title="Switch to dark theme" aria-checked="false" data-v-d0bd9dde data-v-d1f28634 data-v-1d5665e3><span class="check" data-v-1d5665e3><span class="icon" data-v-1d5665e3><!--[--><span class="vpi-sun sun" data-v-d1f28634></span><span class="vpi-moon moon" data-v-d1f28634></span><!--]--></span></span></button></div></div></div><div class="group" data-v-d0bd9dde><div class="item social-links" data-v-d0bd9dde><div class="VPSocialLinks social-links-list" data-v-d0bd9dde data-v-7bc22406><!--[--><a class="VPSocialLink no-icon" href="https://github.com/crazywhalecc/static-php-cli" aria-label="github" target="_blank" rel="noopener" data-v-7bc22406 data-v-eee4e7cb><span class="vpi-social-github" /></a><!--]--></div></div></div><!--]--><!--]--></div></div></div><!--[--><!--]--><button type="button" class="VPNavBarHamburger hamburger" aria-label="mobile navigation" aria-expanded="false" aria-controls="VPNavScreen" data-v-ccf7ddec data-v-e5dd9c1c><span class="container" data-v-e5dd9c1c><span class="top" data-v-e5dd9c1c></span><span class="middle" data-v-e5dd9c1c></span><span class="bottom" data-v-e5dd9c1c></span></span></button></div></div></div></div><div class="divider" data-v-ccf7ddec><div class="divider-line" data-v-ccf7ddec></div></div></div><!----></header><div class="VPLocalNav has-sidebar empty" data-v-5d98c3a5 data-v-a6f0e41e><div class="container" data-v-a6f0e41e><button class="menu" aria-expanded="false" aria-controls="VPSidebarNav" data-v-a6f0e41e><span class="vpi-align-left menu-icon" data-v-a6f0e41e></span><span class="menu-text" data-v-a6f0e41e>Menu</span></button><div class="VPLocalNavOutlineDropdown" style="--vp-vh:0px;" data-v-a6f0e41e data-v-17a5e62e><button data-v-17a5e62e>Return to top</button><!----></div></div></div><aside class="VPSidebar" data-v-5d98c3a5 data-v-575e6a36><div class="curtain" data-v-575e6a36></div><nav class="nav" id="VPSidebarNav" aria-labelledby="sidebar-aria-label" tabindex="-1" data-v-575e6a36><span class="visually-hidden" id="sidebar-aria-label" data-v-575e6a36> Sidebar Navigation </span><!--[--><!--]--><!--[--><div class="group" data-v-575e6a36><section class="VPSidebarItem level-0" data-v-575e6a36 data-v-b8d55f3b><div class="item" role="button" tabindex="0" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><h2 class="text" data-v-b8d55f3b>Development</h2><!----></div><div class="items" data-v-b8d55f3b><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/en/develop/" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>Get Started</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/en/develop/structure.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>Project Structure</p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/en/develop/php-src-changes.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>PHP Source Modification</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-575e6a36><section class="VPSidebarItem level-0 has-active" data-v-575e6a36 data-v-b8d55f3b><div class="item" role="button" tabindex="0" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><h2 class="text" data-v-b8d55f3b>Module</h2><!----></div><div class="items" data-v-b8d55f3b><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/en/develop/doctor-module.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>Doctor </p><!--]--></a><!----></div><!----></div><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/en/develop/source-module.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>Source</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><div class="group" data-v-575e6a36><section class="VPSidebarItem level-0" data-v-575e6a36 data-v-b8d55f3b><div class="item" role="button" tabindex="0" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><h2 class="text" data-v-b8d55f3b>Extra</h2><!----></div><div class="items" data-v-b8d55f3b><!--[--><div class="VPSidebarItem level-1 is-link" data-v-b8d55f3b data-v-b8d55f3b><div class="item" data-v-b8d55f3b><div class="indicator" data-v-b8d55f3b></div><a class="VPLink link link" href="/en/develop/system-build-tools.html" data-v-b8d55f3b><!--[--><p class="text" data-v-b8d55f3b>Compilation Tools</p><!--]--></a><!----></div><!----></div><!--]--></div></section></div><!--]--><!--[--><!--]--></nav></aside><div class="VPContent has-sidebar" id="VPContent" data-v-5d98c3a5 data-v-1428d186><div class="VPDoc has-sidebar has-aside" data-v-1428d186 data-v-39a288b8><!--[--><!--]--><div class="container" data-v-39a288b8><div class="aside" data-v-39a288b8><div class="aside-curtain" data-v-39a288b8></div><div class="aside-container" data-v-39a288b8><div class="aside-content" data-v-39a288b8><div class="VPDocAside" data-v-39a288b8 data-v-3f215769><!--[--><!--]--><!--[--><!--]--><nav aria-labelledby="doc-outline-aria-label" class="VPDocAsideOutline" data-v-3f215769 data-v-a5bbad30><div class="content" data-v-a5bbad30><div class="outline-marker" data-v-a5bbad30></div><div aria-level="2" class="outline-title" id="doc-outline-aria-label" role="heading" data-v-a5bbad30>On this page</div><ul class="VPDocOutlineItem root" data-v-a5bbad30 data-v-b933a997><!--[--><!--]--></ul></div></nav><!--[--><!--]--><div class="spacer" data-v-3f215769></div><!--[--><!--]--><!----><!--[--><!--]--><!--[--><!--]--></div></div></div></div><div class="content" data-v-39a288b8><div class="content-container" data-v-39a288b8><!--[--><!--]--><main class="main" data-v-39a288b8><div style="position:relative;" class="vp-doc _en_develop_source-module" data-v-39a288b8><div><h1 id="source-module" tabindex="-1">Source module <a class="header-anchor" href="#source-module" aria-label="Permalink to &quot;Source module&quot;">​</a></h1><p>The download source module of static-php-cli is a major module. It includes dependent libraries, external extensions, PHP source code download methods and file decompression methods. The download configuration file mainly involves the <code>source.json</code> and <code>pkg.json</code> file, which records the download method of all downloadable sources.</p><p>The main commands involved in the download function are <code>bin/spc download</code> and <code>bin/spc extract</code>. The <code>download</code> command is a downloader that downloads sources according to the configuration file, and the <code>extract</code> command is an extractor that extract sources from downloaded files.</p><p>Generally speaking, downloading sources may be slow because these sources come from various official websites, GitHub, and other different locations. At the same time, they also occupy a large space, so you can download the sources once and reuse them.</p><p>The configuration file of the downloader is <code>source.json</code>, which contains the download methods of all sources. You can add the source download methods you need, or modify the existing source download methods.</p><p>The download configuration structure of each source is as follows. The following is the source download configuration corresponding to the <code>libevent</code> extension:</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
  20. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;libevent&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  21. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;ghrel&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  22. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;repo&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;libevent/libevent&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  23. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;match&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;libevent.+</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.tar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.gz&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  24. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;provide-pre-built&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">true</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  25. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;license&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  26. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;file&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  27. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;LICENSE&quot;</span></span>
  28. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  29. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  30. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>The most important field here is <code>type</code>. Currently, the types it supports are:</p><ul><li><code>url</code>: Directly use URL to download, for example: <code>https://download.libsodium.org/libsodium/releases/libsodium-1.0.18.tar.gz</code>.</li><li><code>ghrel</code>: Use the GitHub Release API to download, download the artifacts uploaded from the latest version released by maintainers.</li><li><code>ghtar</code>: Use the GitHub Release API to download. Different from <code>ghrel</code>, <code>ghtar</code> is downloaded from the <code>source code (tar.gz)</code> in the latest Release of the project.</li><li><code>ghtagtar</code>: Use GitHub Release API to download. Compared with <code>ghtar</code>, <code>ghtagtar</code> can find the latest one from the <code>tags</code> list and download the source code in <code>tar.gz</code> format (because some projects only use <code>tag</code> release version).</li><li><code>bitbuckettag</code>: Download using BitBucket API, basically the same as <code>ghtagtar</code>, except this one applies to BitBucket.</li><li><code>git</code>: Clone the project directly from a Git address to download sources, applicable to any public Git repository.</li><li><code>filelist</code>: Use a crawler to crawl the Web download site that provides file index, and get the latest version of the file name and download it.</li><li><code>custom</code>: If none of the above download methods are satisfactory, you can write <code>custom</code>, create a new class under <code>src/SPC/store/source/</code>, extends <code>CustomSourceBase</code>, and write the download script yourself.</li></ul><h2 id="source-json-common-parameters" tabindex="-1">source.json Common parameters <a class="header-anchor" href="#source-json-common-parameters" aria-label="Permalink to &quot;source.json Common parameters&quot;">​</a></h2><p>Each source file in source.json has the following params:</p><ul><li><code>license</code>: the open source license of the source code, see <strong>Open Source License</strong> section below</li><li><code>type</code>: must be one of the types mentioned above</li><li><code>path</code> (optional): release the source code to the specified directory instead of <code>source/{name}</code></li><li><code>provide-pre-built</code> (optional): whether to provide precompiled binary files. If <code>true</code>, it will automatically try to download precompiled binary files when running <code>bin/spc download</code></li></ul><div class="tip custom-block"><p class="custom-block-title">TIP</p><p>The <code>path</code> parameter in <code>source.json</code> can specify a relative or absolute path. When specified as a relative path, the path is based on <code>source/</code>.</p></div><h2 id="download-type-url" tabindex="-1">Download type - url <a class="header-anchor" href="#download-type-url" aria-label="Permalink to &quot;Download type - url&quot;">​</a></h2><p>URL type sources refer to downloading files directly from the URL.</p><p>The parameters included are:</p><ul><li><code>url</code>: The download address of the file, such as <code>https://example.com/file.tgz</code></li><li><code>filename</code> (optional): The file name saved to the local area. If not specified, the file name of the url will be used.</li></ul><p>Example (download the imagick extension and extract it to the extension storage path of the php source code):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
  31. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;ext-imagick&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  32. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;url&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  33. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;url&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;https://pecl.php.net/get/imagick&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  34. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;php-src/ext/imagick&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  35. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;filename&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;imagick.tgz&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  36. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;license&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  37. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;file&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  38. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;LICENSE&quot;</span></span>
  39. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  40. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  41. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h2 id="download-type-ghrel" tabindex="-1">Download type - ghrel <a class="header-anchor" href="#download-type-ghrel" aria-label="Permalink to &quot;Download type - ghrel&quot;">​</a></h2><p>ghrel will download files from Assets uploaded in GitHub Release. First use the GitHub Release API to get the latest version, and then download the corresponding files according to the regular matching method.</p><p>The parameters included are:</p><ul><li><code>repo</code>: GitHub repository name</li><li><code>match</code>: regular expression matching Assets files</li><li><code>prefer-stable</code>: Whether to download stable versions first (default is <code>false</code>)</li></ul><p>Example (download the libsodium library, matching the libsodium-x.y.tar.gz file in Release):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
  42. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;libsodium&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  43. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;ghrel&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  44. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;repo&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;jedisct1/libsodium&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  45. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;match&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;libsodium-</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">d+(</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">d+)*</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.tar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.gz&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  46. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;license&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  47. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;file&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  48. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;LICENSE&quot;</span></span>
  49. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  50. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  51. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h2 id="download-type-ghtar" tabindex="-1">Download type - ghtar <a class="header-anchor" href="#download-type-ghtar" aria-label="Permalink to &quot;Download type - ghtar&quot;">​</a></h2><p>ghtar will download the file from the GitHub Release Tag. Unlike <code>ghrel</code>, <code>ghtar</code> will download the <code>source code (tar.gz)</code> from the latest Release of the project.</p><p>The parameters included are:</p><ul><li><code>repo</code>: GitHub repository name</li><li><code>prefer-stable</code>: Whether to download stable versions first (default is <code>false</code>)</li></ul><p>Example (brotli library):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
  52. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;brotli&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  53. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;ghtar&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  54. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;repo&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;google/brotli&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  55. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;license&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  56. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;file&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  57. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;LICENSE&quot;</span></span>
  58. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  59. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  60. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h2 id="download-type-ghtagtar" tabindex="-1">Download type - ghtagtar <a class="header-anchor" href="#download-type-ghtagtar" aria-label="Permalink to &quot;Download type - ghtagtar&quot;">​</a></h2><p>Use the GitHub Release API to download. Compared with <code>ghtar</code>, <code>ghtagtar</code> can find the latest one from the <code>tags</code> list and download the source code in <code>tar.gz</code> format (because some projects only use the <code>tag</code> version).</p><p>The parameters included are:</p><ul><li><code>repo</code>: GitHub repository name</li><li><code>prefer-stable</code>: Whether to download stable versions first (default is <code>false</code>)</li></ul><p>Example (gmp library):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
  61. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;gmp&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  62. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;ghtagtar&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  63. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;repo&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;alisw/GMP&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  64. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;license&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  65. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;text&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  66. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;text&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;EXAMPLE LICENSE&quot;</span></span>
  67. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  68. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  69. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h2 id="download-type-bitbuckettag" tabindex="-1">Download Type - bitbuckettag <a class="header-anchor" href="#download-type-bitbuckettag" aria-label="Permalink to &quot;Download Type - bitbuckettag&quot;">​</a></h2><p>Download using BitBucket API, basically the same as <code>ghtagtar</code>, except this one works with BitBucket.</p><p>The parameters included are:</p><ul><li><code>repo</code>: BitBucket repository name</li></ul><h2 id="download-type-git" tabindex="-1">Download type - git <a class="header-anchor" href="#download-type-git" aria-label="Permalink to &quot;Download type - git&quot;">​</a></h2><p>Clone the project directly from a Git address to download sources, applicable to any public Git repository.</p><p>The parameters included are:</p><ul><li><code>url</code>: Git link (HTTPS only)</li><li><code>rev</code>: branch name</li></ul><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
  70. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;imap&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  71. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;git&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  72. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;url&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;https://github.com/static-php/imap.git&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  73. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;rev&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;master&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  74. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;license&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  75. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;file&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  76. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;LICENSE&quot;</span></span>
  77. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  78. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  79. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h2 id="download-type-filelist" tabindex="-1">Download type - filelist <a class="header-anchor" href="#download-type-filelist" aria-label="Permalink to &quot;Download type - filelist&quot;">​</a></h2><p>Use a crawler to crawl a web download site that provides a file index and get the latest version of the file name and download it.</p><p>Note that this method is only applicable to static sites with page index functions such as mirror sites and GNU official websites.</p><p>The parameters included are:</p><ul><li><code>url</code>: The URL of the page to crawl the latest version of the file</li><li><code>regex</code>: regular expression matching file names and download links</li></ul><p>Example (download the libiconv library from the GNU official website):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
  80. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;libiconv&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  81. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;filelist&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  82. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;url&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;https://ftp.gnu.org/gnu/libiconv/&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  83. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;regex&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;/href=</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\&quot;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">(?&lt;file&gt;libiconv-(?&lt;version&gt;[^</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\&quot;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">]+)</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.tar</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\\</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">.gz)</span><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">\&quot;</span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">/&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  84. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;license&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  85. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;file&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  86. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;COPYING&quot;</span></span>
  87. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  88. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  89. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><h2 id="download-type-custom" tabindex="-1">Download type - custom <a class="header-anchor" href="#download-type-custom" aria-label="Permalink to &quot;Download type - custom&quot;">​</a></h2><p>If the above downloading methods are not satisfactory, you can write <code>custom</code>, create a new class under <code>src/SPC/store/source/</code>, extends <code>CustomSourceBase</code>, and write the download script yourself.</p><p>I won’t go into details here, you can look at <code>src/SPC/store/source/PhpSource.php</code> or <code>src/SPC/store/source/PostgreSQLSource.php</code> as examples.</p><h2 id="pkg-json-general-parameters" tabindex="-1">pkg.json General parameters <a class="header-anchor" href="#pkg-json-general-parameters" aria-label="Permalink to &quot;pkg.json General parameters&quot;">​</a></h2><p>pkg.json stores non-source-code files, such as precompiled tools musl-toolchain and UPX. It includes:</p><ul><li><code>type</code>: The same type as <code>source.json</code> and different kinds of parameters.</li><li><code>extract</code> (optional): The path to decompress after downloading, the default is <code>pkgroot/{pkg_name}</code>.</li><li><code>extract-files</code> (optional): Extract only the specified files to the specified location after downloading.</li></ul><p>It should be noted that <code>pkg.json</code> does not involve compilation, modification and distribution of source code, so there is no <code>license</code> open source license field. And you cannot use the <code>extract</code> and <code>extract-files</code> parameters at the same time.</p><p>Example (download nasm locally and extract only program files to PHP SDK):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
  90. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;nasm-x86_64-win&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  91. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;url&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  92. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;url&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/win64/nasm-2.16.01-win64.zip&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  93. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;extract-files&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  94. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;nasm-2.16.01/nasm.exe&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;{php_sdk_path}/bin/nasm.exe&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  95. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;nasm-2.16.01/ndisasm.exe&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;{php_sdk_path}/bin/ndisasm.exe&quot;</span></span>
  96. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  97. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  98. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>The key name in <code>extract-files</code> is the file in the source folder, and the key value is the storage path. The storage path can use the following variables:</p><ul><li><code>{php_sdk_path}</code>: (Windows only) PHP SDK path</li><li><code>{pkg_root_path}</code>: <code>pkgroot/</code></li><li><code>{working_dir}</code>: current working directory</li><li><code>{download_path}</code>: download directory</li><li><code>{source_path}</code>: source code decompression directory</li></ul><p>When <code>extract-files</code> does not use variables and is a relative path, the directory of the relative path is <code>{working_dir}</code>.</p><h2 id="open-source-license" tabindex="-1">Open source license <a class="header-anchor" href="#open-source-license" aria-label="Permalink to &quot;Open source license&quot;">​</a></h2><p>For <code>source.json</code>, each source file should contain an open source license. The <code>license</code> field stores the open source license information.</p><p>Each <code>license</code> contains the following parameters:</p><ul><li><code>type</code>: <code>file</code> or <code>text</code></li><li><code>path</code>: the license file in the source code directory (required when <code>type</code> is <code>file</code>)</li><li><code>text</code>: License text (required when <code>type</code> is <code>text</code>)</li></ul><p>Example (yaml extension source code with LICENSE file):</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
  99. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;yaml&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  100. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;git&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  101. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;php-src/ext/yaml&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  102. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;rev&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;php7&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  103. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;url&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;https://github.com/php/pecl-file_formats-yaml&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  104. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;license&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  105. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;file&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  106. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;LICENSE&quot;</span></span>
  107. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  108. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  109. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>When an open source project has multiple licenses, multiple files can be specified:</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
  110. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;libuv&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  111. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;ghtar&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  112. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;repo&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;libuv/libuv&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  113. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;license&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span></span>
  114. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
  115. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;file&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  116. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;LICENSE&quot;</span></span>
  117. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> },</span></span>
  118. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> {</span></span>
  119. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;file&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  120. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;LICENSE-extra&quot;</span></span>
  121. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  122. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ]</span></span>
  123. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  124. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div><p>When the license of an open source project uses different files between versions, <code>path</code> can be used as an array to list the possible license files:</p><div class="language-json vp-adaptive-theme"><button title="Copy Code" class="copy"></button><span class="lang">json</span><pre class="shiki shiki-themes github-light github-dark vp-code" tabindex="0"><code><span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">{</span></span>
  125. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;redis&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  126. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;git&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  127. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;php-src/ext/redis&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  128. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;rev&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;release/6.0.2&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  129. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;url&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;https://github.com/phpredis/phpredis&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  130. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;license&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: {</span></span>
  131. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;type&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: </span><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">&quot;file&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  132. <span class="line"><span style="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> &quot;path&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">: [</span></span>
  133. <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;LICENSE&quot;</span><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">,</span></span>
  134. <span class="line"><span style="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> &quot;COPYING&quot;</span></span>
  135. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> ]</span></span>
  136. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  137. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> }</span></span>
  138. <span class="line"><span style="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">}</span></span></code></pre></div></div></div></main><footer class="VPDocFooter" data-v-39a288b8 data-v-d4a0bba5><!--[--><!--]--><!----><nav class="prev-next" aria-labelledby="doc-footer-aria-label" data-v-d4a0bba5><span class="visually-hidden" id="doc-footer-aria-label" data-v-d4a0bba5>Pager</span><div class="pager" data-v-d4a0bba5><a class="VPLink link pager-link prev" href="/en/develop/doctor-module.html" data-v-d4a0bba5><!--[--><span class="desc" data-v-d4a0bba5>Previous page</span><span class="title" data-v-d4a0bba5>Doctor </span><!--]--></a></div><div class="pager" data-v-d4a0bba5><a class="VPLink link pager-link next" href="/en/develop/system-build-tools.html" data-v-d4a0bba5><!--[--><span class="desc" data-v-d4a0bba5>Next page</span><span class="title" data-v-d4a0bba5>Compilation Tools</span><!--]--></a></div></nav></footer><!--[--><!--]--></div></div></div><!--[--><!--]--></div></div><footer class="VPFooter has-sidebar" data-v-5d98c3a5 data-v-e315a0ad><div class="container" data-v-e315a0ad><p class="message" data-v-e315a0ad>Released under the MIT License.</p><p class="copyright" data-v-e315a0ad>Copyright © 2023-present crazywhalecc</p></div></footer><!--[--><!--]--></div></div>
  139. <script>window.__VP_HASH_MAP__=JSON.parse("{\"en_guide_extensions.md\":\"C5vF7yDY\",\"zh_develop_index.md\":\"-CPpDfMx\",\"en_guide_index.md\":\"CjOUKFgy\",\"en_contributing_index.md\":\"CsY8mx8F\",\"zh_contributing_index.md\":\"BvgdahxO\",\"en_guide_extension-notes.md\":\"BaBSDnpT\",\"en_index.md\":\"Cbpb4iAg\",\"zh_develop_structure.md\":\"B-0RMSSw\",\"en_guide_troubleshooting.md\":\"9z66WsuC\",\"en_develop_system-build-tools.md\":\"D6vaAwN3\",\"extension-notes.md\":\"Bw8xYOie\",\"extensions.md\":\"BOvD4zE9\",\"zh_guide_action-build.md\":\"DWMlBDvT\",\"zh_guide_env-vars.md\":\"CfYA93uA\",\"zh_guide_cli-generator.md\":\"B7mYo4Lw\",\"zh_guide_deps-map.md\":\"b1yfT0cS\",\"en_faq_index.md\":\"DLWPz-7S\",\"zh_develop_system-build-tools.md\":\"Ds53VEw1\",\"deps-map-ext.md\":\"Ct90_tZH\",\"zh_develop_php-src-changes.md\":\"Df0-NcBw\",\"deps-map-lib.md\":\"CHkEUaxl\",\"zh_guide_build-on-windows.md\":\"BxVEYT8r\",\"en_develop_php-src-changes.md\":\"DLlooohw\",\"en_develop_source-module.md\":\"CdOHR0ez\",\"en_guide_cli-generator.md\":\"DsQUY_G0\",\"index.md\":\"mKXtywCA\",\"en_guide_env-vars.md\":\"DXDG6yvH\",\"en_guide_manual-build.md\":\"cuxk79AG\",\"en_guide_build-on-windows.md\":\"0XosmiyO\",\"zh_guide_troubleshooting.md\":\"DsBZI1Y4\",\"en_develop_structure.md\":\"BA5PDIse\",\"zh_guide_manual-build.md\":\"CPnjjhB_\",\"en_develop_index.md\":\"B7_c9YYa\",\"zh_guide_extension-notes.md\":\"Bk8p1Uuk\",\"zh_guide_extensions.md\":\"A3n52TMR\",\"zh_guide_index.md\":\"20ged7P4\",\"zh_index.md\":\"LslJ1UMp\",\"zh_faq_index.md\":\"DL8Ncj95\",\"en_develop_doctor-module.md\":\"DGd8PeM_\",\"en_guide_action-build.md\":\"BKamBazh\",\"zh_develop_doctor-module.md\":\"DgFAPT6E\",\"zh_develop_source-module.md\":\"D0odLsHX\",\"en_guide_deps-map.md\":\"BMawLo1f\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"static-php-cli\",\"description\":\"Build single static PHP binary, with PHP project together, with popular extensions included.\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":true,\"themeConfig\":{\"nav\":[],\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/crazywhalecc/static-php-cli\"}]},\"locales\":{\"en\":{\"label\":\"English\",\"lang\":\"en\",\"themeConfig\":{\"nav\":[{\"text\":\"Guide\",\"link\":\"/en/guide/\"},{\"text\":\"Advanced\",\"link\":\"/en/develop/\"},{\"text\":\"Contributing\",\"link\":\"/en/contributing/\"},{\"text\":\"FAQ\",\"link\":\"/en/faq/\"}],\"sidebar\":{\"/en/guide/\":[{\"text\":\"Guide\",\"items\":[{\"text\":\"Guide\",\"link\":\"/en/guide/\"},{\"text\":\"Actions Build\",\"link\":\"/en/guide/action-build\"},{\"text\":\"Manual Build\",\"link\":\"/en/guide/manual-build\"},{\"text\":\"Extension List\",\"link\":\"/en/guide/extensions\"},{\"text\":\"Extension Notes\",\"link\":\"/en/guide/extension-notes\"},{\"text\":\"Command Generator\",\"link\":\"/en/guide/cli-generator\"},{\"text\":\"Environment Variables\",\"link\":\"/en/guide/env-vars\",\"collapsed\":true},{\"text\":\"Dependency Table\",\"link\":\"/en/guide/deps-map\"}]},{\"items\":[{\"text\":\"Troubleshooting\",\"link\":\"/en/guide/troubleshooting\"},{\"text\":\"Build on Windows\",\"link\":\"/en/guide/build-on-windows\"}]}],\"/en/develop/\":[{\"text\":\"Development\",\"items\":[{\"text\":\"Get Started\",\"link\":\"/en/develop/\"},{\"text\":\"Project Structure\",\"link\":\"/en/develop/structure\"},{\"text\":\"PHP Source Modification\",\"link\":\"/en/develop/php-src-changes\"}]},{\"text\":\"Module\",\"items\":[{\"text\":\"Doctor \",\"link\":\"/en/develop/doctor-module\"},{\"text\":\"Source\",\"link\":\"/en/develop/source-module\"}]},{\"text\":\"Extra\",\"items\":[{\"text\":\"Compilation Tools\",\"link\":\"/en/develop/system-build-tools\"}]}],\"/en/contributing/\":[{\"text\":\"Contributing\",\"items\":[{\"text\":\"Contributing\",\"link\":\"/en/contributing/\"}]}]},\"footer\":{\"message\":\"Released under the MIT License.\",\"copyright\":\"Copyright © 2023-present crazywhalecc\"}}},\"zh\":{\"label\":\"简体中文\",\"lang\":\"zh\",\"themeConfig\":{\"nav\":[{\"text\":\"构建指南\",\"link\":\"/zh/guide/\"},{\"text\":\"进阶\",\"link\":\"/zh/develop/\"},{\"text\":\"贡献\",\"link\":\"/zh/contributing/\"},{\"text\":\"FAQ\",\"link\":\"/zh/faq/\"}],\"sidebar\":{\"/zh/guide/\":[{\"text\":\"构建指南\",\"items\":[{\"text\":\"指南\",\"link\":\"/zh/guide/\"},{\"text\":\"Actions 构建\",\"link\":\"/zh/guide/action-build\"},{\"text\":\"本地构建\",\"link\":\"/zh/guide/manual-build\"},{\"text\":\"扩展列表\",\"link\":\"/zh/guide/extensions\"},{\"text\":\"扩展注意事项\",\"link\":\"/zh/guide/extension-notes\"},{\"text\":\"编译命令生成器\",\"link\":\"/zh/guide/cli-generator\"},{\"text\":\"环境变量列表\",\"link\":\"/zh/guide/env-vars\"},{\"text\":\"依赖关系图表\",\"link\":\"/zh/guide/deps-map\"}]},{\"items\":[{\"text\":\"故障排除\",\"link\":\"/zh/guide/troubleshooting\"},{\"text\":\"在 Windows 上构建\",\"link\":\"/zh/guide/build-on-windows\"}]}],\"/zh/develop/\":[{\"text\":\"开发指南\",\"items\":[{\"text\":\"开发简介\",\"link\":\"/zh/develop/\"},{\"text\":\"项目结构简介\",\"link\":\"/zh/develop/structure\"},{\"text\":\"对 PHP 源码的修改\",\"link\":\"/zh/develop/php-src-changes\"}]},{\"text\":\"模块\",\"items\":[{\"text\":\"Doctor 环境检查工具\",\"link\":\"/zh/develop/doctor-module\"},{\"text\":\"资源模块\",\"link\":\"/zh/develop/source-module\"}]},{\"text\":\"其他\",\"items\":[{\"text\":\"系统编译工具\",\"link\":\"/zh/develop/system-build-tools\"}]}],\"/zh/contributing/\":[{\"text\":\"贡献指南\",\"items\":[{\"text\":\"贡献指南\",\"link\":\"/zh/contributing/\"}]}]},\"footer\":{\"message\":\"Released under the MIT License.\",\"copyright\":\"Copyright © 2023-present crazywhalecc\"}}}},\"scrollOffset\":134,\"cleanUrls\":false}");</script>
  140. </body>
  141. </html>