File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -928,6 +928,40 @@ case "$1" in
928928esac
929929` ` `
930930
931+ # ### 基于 debhelper 的打包简介 {#debhelper}
932+
933+ 在很多时候,我们需要更加复杂的打包流程,例如在打包时编译程序等。相关的操作由 `debian/rules` 文件控制。这是一个 Makefile 文件。由于正规的打包流程非常复杂,手写 `rules` 文件是非常麻烦的,因此 Debian 提供了 debhelper (`dh`) 工具来简化打包流程。要调用 `dh`,只需要在 `rules` 文件中添加以下内容:
934+
935+ ` ` ` makefile
936+ #!/usr/bin/make -f
937+ #export DH_VERBOSE=1
938+
939+ %:
940+ dh $@
941+ ` ` `
942+
943+ !!! tip "`%:`"
944+
945+ 这是一个 Makefile 的通配符规则,表示所有的目标都使用 `dh` 命令来处理。例如,执行 `debian/rules build` 时,Makefile 会将 `build` 作为目标传递给 `dh`,因此等价于执行 `dh build`。
946+
947+ 可以使用 `--no-act` 参数来查看 `dh` 会执行哪些操作:
948+
949+ ` ` ` shell
950+ $ dh clean --no-act
951+ dh_testdir
952+ debian/rules override_dh_auto_clean
953+ dh_autoreconf_clean
954+ dh_clean
955+ ` ` `
956+
957+ 如果需要覆盖某个 `dh` 的操作,可以在 `debian/rules` 中添加对应的规则,例如:
958+
959+ ` ` ` makefile
960+ override_dh_auto_clean:
961+ echo "Custom clean step"
962+ dh_auto_clean
963+ ` ` `
964+
931965# ### 使用 `checkinstall` 快速打包 {#checkinstall}
932966
933967!!! warning "checkinstall 工具仅适用于临时打包"
You can’t perform that action at this time.
0 commit comments