aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/nss/building/index.html
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/nss/building/index.html
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/nss/building/index.html')
-rw-r--r--files/zh-cn/nss/building/index.html116
1 files changed, 116 insertions, 0 deletions
diff --git a/files/zh-cn/nss/building/index.html b/files/zh-cn/nss/building/index.html
new file mode 100644
index 0000000000..2d7adf09b2
--- /dev/null
+++ b/files/zh-cn/nss/building/index.html
@@ -0,0 +1,116 @@
+---
+title: Building NSS
+slug: NSS/Building
+translation_of: Mozilla/Projects/NSS/Building
+---
+<p><font face="x-locale-heading-primary, zillaslab, Palatino, Palatino Linotype, x-locale-heading-secondary, serif"><span style="font-size: 37.33327865600586px;"><strong>介绍</strong></span></font></p>
+
+
+
+<p>此页包含有关如何构建NSS的详细信息。因为NSS是一个跨平台的库,它构建在许多不同的平台上,并且有许多选项,所以构建起来可能很复杂。在尝试构建之前,请仔细阅读这些说明。</p>
+
+<h2 id="Build_环境">Build 环境</h2>
+
+<p>NSS需要一个C和C++编译器。它有最小的依赖关系,包括标准的C和C++库,再加上ZLIB。</p>
+
+<p>For building, you also need <a href="https://www.gnu.org/software/make/">make</a>.  Ideally, also install <a href="https://gyp.gsrc.io/">gyp</a> and <a href="https://ninja-build.org/">ninja</a> and put them on your path.  This is recommended, as the build is faster and more reliable.</p>
+
+<h3 id="Windows">Windows</h3>
+
+<p>Windows上的NSS编译使用与Mozilla Firefox相同的共享生成系统。 你必须先安装 <a href="/en-US/docs/Developer_Guide/Build_Instructions/Windows_Prerequisites">Windows Prerequisites</a>, 包括 <strong>MozillaBuild</strong>.</p>
+
+<p>您还可以在Windows子系统上为Linux构建NSS,但是生成的二进制文件不能被其他Windows应用程序使用。</p>
+
+<p><font face="x-locale-heading-primary, zillaslab, Palatino, Palatino Linotype, x-locale-heading-secondary, serif"><span style="font-size: 37.33327865600586px;"><strong>获取源码</strong></span></font></p>
+
+
+
+<p>NSS和NSPR像其他Mozilla项目一样使用Mercurial进行源代码管理。 要查看NSS和NSPR的最新源(可能不是稳定版本的一部分),请使用以下命令:</p>
+
+<pre>hg clone https://hg.mozilla.org/projects/nspr
+hg clone https://hg.mozilla.org/projects/nss
+</pre>
+
+<p>To get the source of a specific release, see <a href="/en-US/docs/Mozilla/Projects/NSS/NSS_Releases">NSS Releases</a>.</p>
+
+<dl>
+ <dd>
+ <dl>
+ </dl>
+ </dd>
+</dl>
+
+<h2 id="Build">Build</h2>
+
+<p>Build NSS using our build script:</p>
+
+<pre>nss/build.sh
+</pre>
+
+<p>This builds both NSPR and NSS.</p>
+
+<h2 id="Build_with_make">Build with make</h2>
+
+<p>Alternatively, there is a <code>make</code> target called "nss_build_all", which produces a similar result.  This supports some alternative options, but can be a lot slower.</p>
+
+<pre>make -C nss nss_build_all USE_64=1
+</pre>
+
+<p>The make-based build system for NSS uses a variety of variables to control the build. Below are some of the variables, along with possible values they may be set to.</p>
+
+<dl>
+ <dt>BUILD_OPT</dt>
+ <dd>
+ <dl>
+ <dt>0</dt>
+ <dd>Build a debug (non-optimized) version of NSS. <em>This is the default.</em></dd>
+ <dt>1</dt>
+ <dd>Build an optimized (non-debug) version of NSS.</dd>
+ </dl>
+ </dd>
+ <dt>USE_64</dt>
+ <dd>
+ <dl>
+ <dt>0</dt>
+ <dd>Build for a 32-bit environment/ABI. <em>This is the default.</em></dd>
+ <dt>1</dt>
+ <dd>Build for a 64-bit environment/ABI. <em>This is recommended.</em></dd>
+ </dl>
+ </dd>
+ <dt>USE_ASAN</dt>
+ <dd>
+ <dl>
+ <dt>0</dt>
+ <dd>Do not create an <a href="http://clang.llvm.org/docs/AddressSanitizer.html">AddressSanitizer</a> build. <em>This is the default.</em></dd>
+ <dt>1</dt>
+ <dd>Create an AddressSanitizer build.</dd>
+ </dl>
+ </dd>
+</dl>
+
+<h2 id="单元测试">单元测试</h2>
+
+<p>NSS包含大量的单元测试。运行这些测试的脚本可以在测试目录中找到。 通过以下方式运行标准套件:</p>
+
+<pre>HOST=localhost DOMSUF=localdomain USE_64=1 nss/tests/all.sh</pre>
+
+<h3 id="单元测试配置">单元测试配置</h3>
+
+<p>NSS测试是使用环境变量配置的。<br>
+ 脚本将尝试推断主机和DOMSUF的值,但可能会失败。 用主机名和域后缀替换localhost和localdomain。 您需要能够连接到$HOST.$DOMSUF。</p>
+
+<p>如果没有域后缀,则可以将条目添加到/etc/hosts (on Windows,<code> c:\Windows\System32\drivers\etc\hosts</code>) as follows:</p>
+
+<pre><code>127.0.0.1 localhost.localdomain</code></pre>
+
+<p>验证是否打开命令shell并键入: <code>ping localhost.localdomain</code>.</p>
+
+<p>Remove the <code>USE_64=1</code> override if using a 32-bit build.</p>
+
+<h3 id="测试结果">测试结果</h3>
+
+<p>运行所有测试可能需要相当长的时间。</p>
+
+<p>测试输出存储在tests_results/security/$HOST.$NUMBER/中。 文件results.html概要结果,output.log捕获所有测试输出。</p>
+
+<p>nss/tests的其他子目录包含运行完整套件子集的脚本。 它们可以直接运行,而不是all.sh,这可能会节省一些时间,但会降低覆盖率。</p>