# 3.6.提交新的 port

在提交新的 Port 之前，请阅读 [DOs 和 DON’Ts](https://docs.freebsd.org/en/books/porters-handbook/porting-dads/#porting-dads) 部分。

如果你对 Port 满意，剩下的就是将它放入 FreeBSD 的主 Ports 树，并让其他人也为它高兴。

> **重要**
>
> 我们不需要 **work** 目录或 **pkgname.txz** 包，所以现在就删除它们。

接下来，创建一个 [patch(1)](https://man.freebsd.org/cgi/man.cgi?query=patch\&sektion=1\&format=html) 文件。假设该 Port 名为 `oneko`，并位于 `games` 分类下。

**示例 1. 为新 Port 创建 .diff 文件**

使用 `git add .` 添加所有文件，然后用 `git diff` 查看差异。例如：

```sh
% git add .
% git diff --staged
```

确保所有必要的文件都已包括，然后将更改提交到本地分支，并使用 `git format-patch` 生成补丁：

```sh
% git commit
% git format-patch origin/main
```

使用 `git format-patch` 生成的补丁会包括作者的身份和电子邮件地址，使开发人员能够更容易地应用补丁（使用 `git am`），并给予适当的信用。

为了方便提交者在其 Ports 树的工作副本中应用补丁，请从 Ports 树的根目录生成 **.diff** 文件。

通过 [问题报告提交表单](https://bugs.freebsd.org/submit/) 提交 **oneko.diff**。选择产品 "Ports & Packages"，组件 "Individual Port(s)"，并遵循那里显示的指南。在 PR 的描述字段中添加该程序的简短描述（也许是 `COMMENT` 的简短版本），并记得将 **oneko.diff** 作为附件添加。

> **注意**
>
> 在问题报告的总结中给出一个好的说明，可以让 Port 提交者和分类员的工作变得更容易。新 Port 的预期格式是 "\[NEW PORT] *类别/port 名 port 简要描述*"。使用这个格式可以让提交新 Port 的工作开始得更快更顺利。

提交 Port 后，请耐心等待。将新 Port 纳入 FreeBSD 的时间可能从几天到几个月不等。可以通过 <https://bugs.freebsd.org/bugzilla/query.cgi> 搜索问题报告数据库的简单搜索表单。

要列出 *Open* 状态的 Port PR，可以在搜索表单中选择 *Open* 和 *Ports & Packages*，然后点击 **Search**。

在查看新 Port 后，我们会根据需要回复，并将其提交到树中。提交者的名字也会被添加到 [Additional FreeBSD Contributors](https://docs.freebsd.org/en/articles/contributors/#contrib-additional) 和其他文件的列表中。

> **重要**
>
> 之前提交新 Port 的补丁可以使用 [shar(1)](https://man.freebsd.org/cgi/man.cgi?query=shar\&sektion=1\&format=html) 文件；但随着 [git(1)](https://man.freebsd.org/cgi/man.cgi?query=git\&sektion=1\&format=html) 的发展，这已经不再是有效的方式。提交者现在不再接受 [shar(1)](https://man.freebsd.org/cgi/man.cgi?query=shar\&sektion=1\&format=html) 文件，因为它容易出错，并且不会在分类的 **Makefile** 中添加相关条目。


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://porters-handbook.bsdcn.org/di-3-zhang-jian-dan-de-port/3.6.-ti-jiao-xin-de-port.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
