Browse Source

update docs

ruki 2 years ago
parent
commit
5183585a21
5 changed files with 296 additions and 104 deletions
  1. 58 0
      manual/xpack.md
  2. 38 0
      mirror/manual/xpack.html
  3. 38 0
      mirror/zh-cn/manual/xpack.html
  4. 104 104
      sitemap.xml
  5. 58 0
      zh-cn/manual/xpack.md

+ 58 - 0
manual/xpack.md

@@ -606,6 +606,64 @@ xpack("test")
      end)
 ```
 
+### xpack:on_buildcmd
+
+#### Custom build script
+
+For some source code build packages, we need to build the source code first before installation, such as srpm packages.
+
+Therefore, we can customize the build script through this interface, for example:
+
+```lua
+xpack("test")
+     set_formats("srpm")
+     add_sourcefiles("src/*.c")
+     add_sourcefiles("./configure")
+     on_buildcmd(function (package, batchcmds)
+         batchcmds:runv("./configure")
+         batchcmds:runv("make")
+     end)
+```
+
+If we associate target programs through add_targets, xpack will execute the `xmake build` command by default to build them even if we do not configure `on_buildcmd`.
+
+```lua
+xpack("test")
+     set_formats("srpm")
+     add_sourcefiles("src/*.c")
+     add_sourcefiles("./xmake.lua")
+```
+
+In addition, we can also use `add_buildrequires` to configure some build dependencies.
+
+### xpack:before_buildcmd
+
+#### Customize pre-build scripts
+
+Through this interface, we can configure pre-build scripts.
+
+```lua
+xpack("test")
+     set_formats("srpm")
+     before_buildcmd(function (package, batchcmds)
+         -- TODO
+     end)
+```
+
+### xpack:after_buildcmd
+
+#### Customize the script after the build
+
+Through this interface, we can configure the script after the build.
+
+```lua
+xpack("test")
+     set_formats("srpm")
+     after_buildcmd(function (package, batchcmds)
+         -- TODO
+     end)
+```
+
 ### xpack:before_installcmd
 
 #### Add script before installation

+ 38 - 0
mirror/manual/xpack.html

@@ -560,6 +560,44 @@ VIAddVersionKey /LANG=0 OriginalFilename "${PACKAGE_FILENAME}"
          -- TODO
      end)
 </code></pre>
+<h3 id="xpackon_buildcmd">xpack:on_buildcmd</h3>
+<h4 id="custombuildscript">Custom build script</h4>
+<p>For some source code build packages, we need to build the source code first before installation, such as srpm packages.</p>
+<p>Therefore, we can customize the build script through this interface, for example:</p>
+<pre><code class="lang-lua">xpack("test")
+     set_formats("srpm")
+     add_sourcefiles("src/*.c")
+     add_sourcefiles("./configure")
+     on_buildcmd(function (package, batchcmds)
+         batchcmds:runv("./configure")
+         batchcmds:runv("make")
+     end)
+</code></pre>
+<p>If we associate target programs through add_targets, xpack will execute the <code>xmake build</code> command by default to build them even if we do not configure <code>on_buildcmd</code>.</p>
+<pre><code class="lang-lua">xpack("test")
+     set_formats("srpm")
+     add_sourcefiles("src/*.c")
+     add_sourcefiles("./xmake.lua")
+</code></pre>
+<p>In addition, we can also use <code>add_buildrequires</code> to configure some build dependencies.</p>
+<h3 id="xpackbefore_buildcmd">xpack:before_buildcmd</h3>
+<h4 id="customizeprebuildscripts">Customize pre-build scripts</h4>
+<p>Through this interface, we can configure pre-build scripts.</p>
+<pre><code class="lang-lua">xpack("test")
+     set_formats("srpm")
+     before_buildcmd(function (package, batchcmds)
+         -- TODO
+     end)
+</code></pre>
+<h3 id="xpackafter_buildcmd">xpack:after_buildcmd</h3>
+<h4 id="customizethescriptafterthebuild">Customize the script after the build</h4>
+<p>Through this interface, we can configure the script after the build.</p>
+<pre><code class="lang-lua">xpack("test")
+     set_formats("srpm")
+     after_buildcmd(function (package, batchcmds)
+         -- TODO
+     end)
+</code></pre>
 <h3 id="xpackbefore_installcmd">xpack:before_installcmd</h3>
 <h4 id="addscriptbeforeinstallation">Add script before installation</h4>
 <p>It will not rewrite the entire installation script, but will add some custom installation scripts before the existing installation scripts are executed:</p>

+ 38 - 0
mirror/zh-cn/manual/xpack.html

@@ -572,6 +572,44 @@ VIAddVersionKey /LANG=0 OriginalFilename "${PACKAGE_FILENAME}"
     end)
 </code></pre>
 <p>需要注意的是,通过 <code>batchcmds</code> 添加的 cp, mkdir 等命令都不会被立即执行,而是仅仅生成一个命令列表,后面实际生成包的时候,会将这些命令,翻译成打包命令。</p>
+<h3 id="xpackon_buildcmd">xpack:on_buildcmd</h3>
+<h4 id="">自定义构建脚本</h4>
+<p>对于一些源码构建包,在安装之前,我们需要先构建源码,例如 srpm 包。</p>
+<p>因此,我们可以通过这个接口,自定义构建脚本,例如:</p>
+<pre><code class="lang-lua">xpack("test")
+    set_formats("srpm")
+    add_sourcefiles("src/*.c")
+    add_sourcefiles("./configure")
+    on_buildcmd(function (package, batchcmds)
+        batchcmds:runv("./configure")
+        batchcmds:runv("make")
+    end)
+</code></pre>
+<p>如果我们通过 add_targets 关联了目标程序,即使我们没有配置 <code>on_buildcmd</code>,xpack 也会默认执行 <code>xmake build</code> 命令去构建它们。</p>
+<pre><code class="lang-lua">xpack("test")
+    set_formats("srpm")
+    add_sourcefiles("src/*.c")
+    add_sourcefiles("./xmake.lua")
+</code></pre>
+<p>另外,我们也可以使用 <code>add_buildrequires</code> 去配置一些构建依赖。</p>
+<h3 id="xpackbefore_buildcmd">xpack:before_buildcmd</h3>
+<h4 id="">自定义构建之前的脚本</h4>
+<p>通过这个接口,我们可以配置构建之前的脚本。</p>
+<pre><code class="lang-lua">xpack("test")
+    set_formats("srpm")
+    before_buildcmd(function (package, batchcmds)
+        -- TODO
+    end)
+</code></pre>
+<h3 id="xpackafter_buildcmd">xpack:after_buildcmd</h3>
+<h4 id="">自定义构建之后的脚本</h4>
+<p>通过这个接口,我们可以配置构建之后的脚本。</p>
+<pre><code class="lang-lua">xpack("test")
+    set_formats("srpm")
+    after_buildcmd(function (package, batchcmds)
+        -- TODO
+    end)
+</code></pre>
 <h3 id="xpackon_installcmd">xpack:on_installcmd</h3>
 <h4 id="">自定义安装脚本</h4>
 <p>这回完全重写内置默认的安装脚本,包括内部对 <code>add_installfiles</code> 配置的文件的自动安装,用户需要完全自己处理所有的安装逻辑。</p>

+ 104 - 104
sitemap.xml

@@ -12,522 +12,522 @@
 
 <url>
   <loc>https://xmake.io/mirror/guide/project_examples.html</loc>
-  <lastmod>2023-12-22T22:42:59+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:51+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/quickstart.html</loc>
-  <lastmod>2023-12-22T22:42:59+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:51+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/faq.html</loc>
-  <lastmod>2023-12-22T22:42:59+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/build_policies.html</loc>
-  <lastmod>2023-12-22T22:42:59+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/configuration.html</loc>
-  <lastmod>2023-12-22T22:42:59+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/syntax_description.html</loc>
-  <lastmod>2023-12-22T22:43:00+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/installation.html</loc>
-  <lastmod>2023-12-22T22:43:00+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/remote_build.html</loc>
-  <lastmod>2023-12-22T22:43:00+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:52+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/unity_build.html</loc>
-  <lastmod>2023-12-22T22:43:00+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/distcc_build.html</loc>
-  <lastmod>2023-12-22T22:43:00+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/trybuild.html</loc>
-  <lastmod>2023-12-22T22:43:00+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/autogen.html</loc>
-  <lastmod>2023-12-22T22:43:01+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/build_cache.html</loc>
-  <lastmod>2023-12-22T22:43:01+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/plugin_development.html</loc>
-  <lastmod>2023-12-22T22:43:01+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:53+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/more_plugins.html</loc>
-  <lastmod>2023-12-22T22:43:01+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/builtin_plugins.html</loc>
-  <lastmod>2023-12-22T22:43:01+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/awesome.html</loc>
-  <lastmod>2023-12-22T22:43:01+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/technical_support.html</loc>
-  <lastmod>2023-12-22T22:43:02+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/changelog.html</loc>
-  <lastmod>2023-12-22T22:43:02+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:54+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/contact.html</loc>
-  <lastmod>2023-12-22T22:43:02+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/introduction.html</loc>
-  <lastmod>2023-12-22T22:43:02+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/who_is_using_xmake.html</loc>
-  <lastmod>2023-12-22T22:43:02+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/sponsor.html</loc>
-  <lastmod>2023-12-22T22:43:03+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/index.html</loc>
-  <lastmod>2023-12-22T22:43:03+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/project_examples.html</loc>
-  <lastmod>2023-12-22T22:43:03+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:55+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/quickstart.html</loc>
-  <lastmod>2023-12-22T22:43:03+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/faq.html</loc>
-  <lastmod>2023-12-22T22:43:03+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/build_policies.html</loc>
-  <lastmod>2023-12-22T22:43:03+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/configuration.html</loc>
-  <lastmod>2023-12-22T22:43:04+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/syntax_description.html</loc>
-  <lastmod>2023-12-22T22:43:04+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/installation.html</loc>
-  <lastmod>2023-12-22T22:43:04+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:56+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/remote_build.html</loc>
-  <lastmod>2023-12-22T22:43:04+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/unity_build.html</loc>
-  <lastmod>2023-12-22T22:43:04+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/distcc_build.html</loc>
-  <lastmod>2023-12-22T22:43:04+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/trybuild.html</loc>
-  <lastmod>2023-12-22T22:43:05+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/autogen.html</loc>
-  <lastmod>2023-12-22T22:43:05+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:57+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/build_cache.html</loc>
-  <lastmod>2023-12-22T22:43:05+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/plugin_development.html</loc>
-  <lastmod>2023-12-22T22:43:05+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/more_plugins.html</loc>
-  <lastmod>2023-12-22T22:43:05+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/builtin_plugins.html</loc>
-  <lastmod>2023-12-22T22:43:06+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/awesome.html</loc>
-  <lastmod>2023-12-22T22:43:06+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/technical_support.html</loc>
-  <lastmod>2023-12-22T22:43:06+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:58+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/changelog.html</loc>
-  <lastmod>2023-12-22T22:43:06+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/contact.html</loc>
-  <lastmod>2023-12-22T22:43:06+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/peripheral_items.html</loc>
-  <lastmod>2023-12-22T22:43:06+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/introduction.html</loc>
-  <lastmod>2023-12-22T22:43:07+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/who_is_using_xmake.html</loc>
-  <lastmod>2023-12-22T22:43:07+08:00</lastmod>
+  <lastmod>2023-12-22T22:53:59+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/sponsor.html</loc>
-  <lastmod>2023-12-22T22:43:07+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/course.html</loc>
-  <lastmod>2023-12-22T22:43:07+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/index.html</loc>
-  <lastmod>2023-12-22T22:43:07+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/getting_started.html</loc>
-  <lastmod>2023-12-22T22:43:07+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/specification.html</loc>
-  <lastmod>2023-12-22T22:43:08+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_variables.html</loc>
-  <lastmod>2023-12-22T22:43:08+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:00+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/conditions.html</loc>
-  <lastmod>2023-12-22T22:43:08+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_rule.html</loc>
-  <lastmod>2023-12-22T22:43:08+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/target_instance.html</loc>
-  <lastmod>2023-12-22T22:43:08+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/project_target.html</loc>
-  <lastmod>2023-12-22T22:43:08+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_modules.html</loc>
-  <lastmod>2023-12-22T22:43:09+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:01+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_toolchain.html</loc>
-  <lastmod>2023-12-22T22:43:09+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/plugin_task.html</loc>
-  <lastmod>2023-12-22T22:43:09+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_dependencies.html</loc>
-  <lastmod>2023-12-22T22:43:09+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/configuration_option.html</loc>
-  <lastmod>2023-12-22T22:43:09+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/extension_modules.html</loc>
-  <lastmod>2023-12-22T22:43:10+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:02+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/helper_interfaces.html</loc>
-  <lastmod>2023-12-22T22:43:10+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/global_interfaces.html</loc>
-  <lastmod>2023-12-22T22:43:10+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_instance.html</loc>
-  <lastmod>2023-12-22T22:43:10+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/xpack.html</loc>
-  <lastmod>2023-12-22T22:43:10+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/option_instance.html</loc>
-  <lastmod>2023-12-22T22:43:10+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:03+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/builtin_themes.html</loc>
-  <lastmod>2023-12-22T22:43:11+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/switch_theme.html</loc>
-  <lastmod>2023-12-22T22:43:11+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_3rd_source_library.html</loc>
-  <lastmod>2023-12-22T22:43:11+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package_old.html</loc>
-  <lastmod>2023-12-22T22:43:11+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package.html</loc>
-  <lastmod>2023-12-22T22:43:11+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/system_package.html</loc>
-  <lastmod>2023-12-22T22:43:11+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:04+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/remote_package.html</loc>
-  <lastmod>2023-12-22T22:43:12+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/remote_toolchain.html</loc>
-  <lastmod>2023-12-22T22:43:12+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2023-12-22T22:43:12+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/getting_started.html</loc>
-  <lastmod>2023-12-22T22:43:12+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/specification.html</loc>
-  <lastmod>2023-12-22T22:43:12+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:05+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_variables.html</loc>
-  <lastmod>2023-12-22T22:43:13+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/conditions.html</loc>
-  <lastmod>2023-12-22T22:43:13+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_rule.html</loc>
-  <lastmod>2023-12-22T22:43:13+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/target_instance.html</loc>
-  <lastmod>2023-12-22T22:43:13+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/project_target.html</loc>
-  <lastmod>2023-12-22T22:43:13+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_modules.html</loc>
-  <lastmod>2023-12-22T22:43:13+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:06+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_toolchain.html</loc>
-  <lastmod>2023-12-22T22:43:14+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/plugin_task.html</loc>
-  <lastmod>2023-12-22T22:43:14+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_dependencies.html</loc>
-  <lastmod>2023-12-22T22:43:14+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/configuration_option.html</loc>
-  <lastmod>2023-12-22T22:43:14+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/extension_modules.html</loc>
-  <lastmod>2023-12-22T22:43:14+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/helper_interfaces.html</loc>
-  <lastmod>2023-12-22T22:43:15+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:07+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/global_interfaces.html</loc>
-  <lastmod>2023-12-22T22:43:15+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_instance.html</loc>
-  <lastmod>2023-12-22T22:43:15+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/xpack.html</loc>
-  <lastmod>2023-12-22T22:43:15+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/option_instance.html</loc>
-  <lastmod>2023-12-22T22:43:15+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/builtin_themes.html</loc>
-  <lastmod>2023-12-22T22:43:15+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:08+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/switch_theme.html</loc>
-  <lastmod>2023-12-22T22:43:16+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_3rd_source_library.html</loc>
-  <lastmod>2023-12-22T22:43:16+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package_old.html</loc>
-  <lastmod>2023-12-22T22:43:16+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package.html</loc>
-  <lastmod>2023-12-22T22:43:16+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/system_package.html</loc>
-  <lastmod>2023-12-22T22:43:16+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/remote_package.html</loc>
-  <lastmod>2023-12-22T22:43:17+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:09+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/remote_toolchain.html</loc>
-  <lastmod>2023-12-22T22:43:17+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:10+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2023-12-22T22:43:17+08:00</lastmod>
+  <lastmod>2023-12-22T22:54:10+08:00</lastmod>
 </url>
 
 </urlset>

+ 58 - 0
zh-cn/manual/xpack.md

@@ -624,6 +624,64 @@ xpack("test")
 
 需要注意的是,通过 `batchcmds` 添加的 cp, mkdir 等命令都不会被立即执行,而是仅仅生成一个命令列表,后面实际生成包的时候,会将这些命令,翻译成打包命令。
 
+### xpack:on_buildcmd
+
+#### 自定义构建脚本
+
+对于一些源码构建包,在安装之前,我们需要先构建源码,例如 srpm 包。
+
+因此,我们可以通过这个接口,自定义构建脚本,例如:
+
+```lua
+xpack("test")
+    set_formats("srpm")
+    add_sourcefiles("src/*.c")
+    add_sourcefiles("./configure")
+    on_buildcmd(function (package, batchcmds)
+        batchcmds:runv("./configure")
+        batchcmds:runv("make")
+    end)
+```
+
+如果我们通过 add_targets 关联了目标程序,即使我们没有配置 `on_buildcmd`,xpack 也会默认执行 `xmake build` 命令去构建它们。
+
+```lua
+xpack("test")
+    set_formats("srpm")
+    add_sourcefiles("src/*.c")
+    add_sourcefiles("./xmake.lua")
+```
+
+另外,我们也可以使用 `add_buildrequires` 去配置一些构建依赖。
+
+### xpack:before_buildcmd
+
+#### 自定义构建之前的脚本
+
+通过这个接口,我们可以配置构建之前的脚本。
+
+```lua
+xpack("test")
+    set_formats("srpm")
+    before_buildcmd(function (package, batchcmds)
+        -- TODO
+    end)
+```
+
+### xpack:after_buildcmd
+
+#### 自定义构建之后的脚本
+
+通过这个接口,我们可以配置构建之后的脚本。
+
+```lua
+xpack("test")
+    set_formats("srpm")
+    after_buildcmd(function (package, batchcmds)
+        -- TODO
+    end)
+```
+
 ### xpack:on_installcmd
 
 #### 自定义安装脚本