章 2. 概覽

# 章 2. 概覽

The Debian packaging of the package-1.0.tar.xz, containing a simple C source following the “GNU Coding Standards” and “FHS”, can be done with the debmake command as follows.

    [base_dir] $ tar --xz -xvf package-1.0.tar.xz
    [base_dir] $ cd package-1.0
    [package-1.0] $ debmake
       ... Make manual adjustments of generated configuration files
    [package-1.0] $ debuild

如果跳過了對生成的配置檔案的手工調整流程，則最終生成的二進位制套件將缺少有意義的套件描述資訊，但是仍然能為 dpkg 命令所使用，在本地部署環境下正常工作。

| 注意
The debmake command only provides decent template files. These template files must be manually adjusted to their perfection to comply with the strict quality requirements of the Debian archive, if the generated package is intended for general consumption.

If you are new to Debian packaging, focus on understanding the overall process rather than worrying about the details.

If you are familiar with Debian packaging, you’ll notice that debmake is similar to the dh_make command. This is because debmake is designed to replace the functionality historically provided by dh_make. [3]

debmake 命令設計提供如下特性與功能：

- 現代的打包風格

  - debian/copyright: “DEP-5” compliant
  - debian/control: substvar support, multiarch support, multi binary packages, …​
  - debian/rules: dh syntax, compiler hardening options, …​

- 靈活性

  - many options (see “節 16.2, “debmake -b””, “章 15, debmake(1) 手冊頁”, and “章 16, debmake options”)

- 合理的預設行為

  - 執行過程不中斷，輸出乾淨的結果
  - 生成多架構支援（multiarch）的套件，除非明確指定了 -m 選項。
  - generate the non-native Debian package with the Debian source format “3.0 (quilt)”, unless the -n option is explicitly specified.

The debmake command delegates most of the heavy lifting to its back-end packages: debhelper, dpkg-dev, devscripts, sbuild, schroot, licensecheck, licenserecon, etc.

| 提示
Ensure that you properly quote the arguments of the -b, -f, and -w options to protect them from shell interference.

| 提示
非原生套件是標準的 Debian 套件。

| 提示
本文件中所有套件構建範例的詳細日誌可以由 “節 14.14, “細節”” 一段給出的操作來取得。

[3] Before dh_make, the deb-make command was popular. The current debmake package starts its version from 4.0 to avoid version conflicts with the obsolete debmake package, which provided the “deb-make” command.

章 1. 前言 |  | 章 3. 預備知識