FreeBSD Porter's Handbook
前一頁 | 章 7. Advanced `pkg-plist` practices | 下一頁

# 7.5. 自動產生 package list

首先，先確認您的 port 除了 `pkg-plist` 尚未搞定之外，其他都完成了。

接著，建立臨時目錄以供該 port 安裝，並且把所有相依套件都裝好 。

    # mkdir /var/tmp/$(make -V PORTNAME)
    # mtree -U -f $(make -V MTREE_FILE) -d -e -p /var/tmp/$(make -V PORTNAME)
    # make depends PREFIX=/var/tmp/$(make -V PORTNAME)

把這目錄架構存到新檔案。

    # (cd /var/tmp/$(make -V PORTNAME) && find -d * -type d) | sort > OLD-DIRS

新增空的 `pkg-plist` 檔案：

    # :>pkg-plist

若該 port 有遵循 `PREFIX`(也應該要遵循)， 接著就可以安裝該 port 並產生檔案清單。

    # make install PREFIX=/var/tmp/$(make -V PORTNAME)
    # (cd /var/tmp/$(make -V PORTNAME) && find -d * \! -type d) | sort > pkg-plist

這時要記得把新建的目錄，也加到檔案清單內。

    # (cd /var/tmp/$(make -V PORTNAME) && find -d * -type d) | sort | comm -13 OLD-DIRS - | sort -r | sed -e 's#^#@dirrm #' >> pkg-plist

最後，您應該手動整理檔案清單（這不是全部自動化處理的）。Man page 則應該利用 `MAN`n`` 的方式 寫在 port 的 `Makefile` 而不是寫在檔案清單中。 使用者設定檔應該移除，或更名為``filename`.sample`。 The `info/dir` file should not be listed and appropriate `install-info` lines should be added as noted in the info files section. Any libraries installed by the port should be listed as specified in the shared libraries section.

Alternatively, use the `plist` script in `/usr/ports/Tools/scripts/` to build the package list automatically. The first step is the same as above: take the first three lines, that is, `mkdir`, `mtree` and `make depends`. Then build and install the port:

    # make install PREFIX=/var/tmp/port-name

And let `plist` create the `pkg-plist` file:

    # /usr/ports/Tools/scripts/plist -Md -m /etc/mtree/BSD.port-type.dist /var/tmp/port-name > pkg-plist

The packing list still has to be tidied up by hand as stated above.

前一頁 | 內容 | 下一頁
Dynamic vs. static package list | 上一層 | The `pkg-`*`` files

For questions about the FreeBSD ports system, e-mail <ports@FreeBSD.org>.
For questions about this documentation, e-mail <doc@FreeBSD.org>.