192 lines
6.8 KiB
XML
192 lines
6.8 KiB
XML
<?xml version="1.0" encoding="big5"?>
|
||
<!-- Copyright (c) 1998, 1999 Nik Clayton, All rights reserved.
|
||
|
||
Redistribution and use in source (SGML DocBook) and 'compiled' forms
|
||
(SGML HTML, PDF, PostScript, RTF and so forth) with or without
|
||
modification, are permitted provided that the following conditions
|
||
are met:
|
||
|
||
1. Redistributions of source code (SGML DocBook) must retain the above
|
||
copyright notice, this list of conditions and the following
|
||
disclaimer as the first lines of this file unmodified.
|
||
|
||
2. Redistributions in compiled form (transformed to other DTDs,
|
||
converted to PDF, PostScript, RTF and other formats) must reproduce
|
||
the above copyright notice, this list of conditions and the
|
||
following disclaimer in the documentation and/or other materials
|
||
provided with the distribution.
|
||
|
||
THIS DOCUMENTATION IS PROVIDED BY NIK CLAYTON "AS IS" AND ANY EXPRESS OR
|
||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||
DISCLAIMED. IN NO EVENT SHALL NIK CLAYTON BE LIABLE FOR ANY DIRECT,
|
||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||
ANY WAY OUT OF THE USE OF THIS DOCUMENTATION, EVEN IF ADVISED OF THE
|
||
POSSIBILITY OF SUCH DAMAGE.
|
||
|
||
$FreeBSD$
|
||
Original revision: 1.22
|
||
-->
|
||
|
||
<chapter id="the-website">
|
||
<title>建構 Website</title>
|
||
|
||
<sect1 id="the-website-prep">
|
||
<title>事前準備</title>
|
||
|
||
<para>請先準備約 200MB 空間,這些是要用來放 SGML 工具程式、CVS tree、
|
||
臨時編譯用的空間,以及編譯好的網頁存放空間。若事先已有裝 SGML 工具程式、
|
||
CVS tree 的話,那麼只需頂多約 100MB 空間即可。</para>
|
||
|
||
<note>
|
||
<para>請確認一下你的相關文件製作所會用到的 ports 都是最新版!
|
||
若不清楚所裝的版本為何,那麼就先以 &man.pkg.delete.1; 指令來移除舊版,
|
||
接著才去裝 port。 舉例來說,若已裝的是 jade-1.1,
|
||
但是我們目前需要的卻是 jade-1.2,那麼先用下列方式來移除舊版:</para>
|
||
|
||
<screen>&prompt.root; <userinput>pkg_delete jade-1.1</userinput></screen>
|
||
</note>
|
||
|
||
<para>接著,就是設定 CVS repository。需要至少 www, doc, ports 這三樣
|
||
CVS tree(當然還要加上 CVSROOT)。 請參閱
|
||
<ulink url="&url.books.handbook;/synching.html#CVSUP">CVSup 簡介</ulink>
|
||
以瞭解如何來 mirror a CVS tree 或部分 CVS tree。</para>
|
||
|
||
<para>最低需求的 cvsup collections 為:<literal>www</literal>,
|
||
<literal>doc-all</literal>, <literal>cvs-base</literal> 以及
|
||
<literal>ports-base</literal>。</para>
|
||
|
||
<para>剛講的這些需要約 105MB 空間。</para>
|
||
|
||
<para>而完整的 CVS tree - 包括 <literal>src</literal>,
|
||
<literal>doc</literal>, <literal>www</literal> 以及
|
||
<literal>ports</literal> - 目前約為 940MB。</para>
|
||
</sect1>
|
||
|
||
<sect1 id="the-website-build">
|
||
<title>Build the web pages from scratch</title>
|
||
|
||
<procedure>
|
||
<step>
|
||
<para>先建立要編譯的目錄(至少要有 60MB 空間),並切換到該目錄。</para>
|
||
|
||
<screen>&prompt.root; <userinput>mkdir /var/tmp/webbuild</userinput>
|
||
&prompt.root; <userinput>cd /var/tmp/webbuild</userinput></screen>
|
||
</step>
|
||
|
||
<step>
|
||
<para>從 CVS tree 內 checkout 相關的 SGML 檔。</para>
|
||
|
||
<screen>&prompt.root; <userinput>cvs -R co www doc</userinput></screen>
|
||
</step>
|
||
|
||
<step>
|
||
<para>切到 <filename class="directory">www/en</filename> 目錄,然後打
|
||
&man.make.1; <maketarget>all</maketarget> 來產生網頁。</para>
|
||
|
||
<screen>&prompt.root; <userinput>cd en</userinput>
|
||
&prompt.root; <userinput>make all</userinput></screen>
|
||
</step>
|
||
</procedure>
|
||
</sect1>
|
||
|
||
<sect1 id="the-website-install">
|
||
<title>在你的網頁伺服器上安裝網頁</title>
|
||
|
||
<procedure>
|
||
<step>
|
||
<para>如果你已經離開 <filename>en</filename>
|
||
這個目錄,請切換回這個目錄中。</para>
|
||
|
||
<screen>&prompt.root; <userinput>cd <replaceable>path</replaceable>/www/en</userinput></screen>
|
||
</step>
|
||
|
||
<step>
|
||
<para>執行 &man.make.1; <maketarget>install</maketarget> ,
|
||
並將 <makevar>DESTDIR</makevar> 設定為你想安裝檔案的目錄名稱。</para>
|
||
|
||
<screen>&prompt.root; <userinput>make DESTDIR=<replaceable>/usr/local/www</replaceable> install</userinput></screen>
|
||
</step>
|
||
|
||
<step>
|
||
<para>如果你之前已經在相同的目錄中安裝了這些網頁,
|
||
安裝過程並不會刪除任何既有或過期的網頁。
|
||
舉例來說,如果你每日建構和安裝新的網頁副本,
|
||
這個指令將會搜尋並刪除在三天內沒有更新的檔案。</para>
|
||
|
||
<screen>&prompt.root; <userinput>find <replaceable>/usr/local/www</replaceable> -ctime 3 -print0 | xargs -0 rm</userinput></screen>
|
||
</step>
|
||
</procedure>
|
||
</sect1>
|
||
|
||
<sect1 id="the-website-env">
|
||
<title>環境變數</title>
|
||
|
||
<variablelist>
|
||
<varlistentry>
|
||
<term><envar>CVSROOT</envar></term>
|
||
|
||
<listitem>
|
||
<para>設定 CVS tree 的位置,此為必備條件。</para>
|
||
|
||
<screen><userinput>&prompt.root; CVSROOT=/home/ncvs; export CVSROOT</userinput></screen>
|
||
</listitem>
|
||
</varlistentry>
|
||
|
||
<varlistentry>
|
||
<term><makevar>ENGLISH_ONLY</makevar></term>
|
||
|
||
<listitem>
|
||
<para>如果設定這個環境變數,而且值不為空白,
|
||
makefiles 將只會建構和安裝英文文件。
|
||
所以將會略過其他的各國翻譯。例如:</para>
|
||
|
||
<screen>&prompt.root; <userinput>make ENGLISH_ONLY=YES all install</userinput></screen>
|
||
|
||
<para>如果你想要取消變數 <makevar>ENGLISH_ONLY</makevar>
|
||
以及建構所有的頁面並包括翻譯,只要將變數 <makevar>ENGLISH_ONLY</makevar>
|
||
的值設定成空白即可。</para>
|
||
|
||
<screen>&prompt.root; <userinput>make ENGLISH_ONLY="" all install clean</userinput></screen>
|
||
</listitem>
|
||
</varlistentry>
|
||
|
||
<varlistentry>
|
||
<term><makevar>WEB_ONLY</makevar></term>
|
||
|
||
<listitem>
|
||
<para>如果有設定這個變數的話,
|
||
makefiles 將只會從 www 目錄建構及安裝 HTML 頁面。
|
||
所有從 doc 目錄下的文件全部都會被忽略 (Handbook, FAQ, Tutorials)。
|
||
例如:</para>
|
||
|
||
<screen>&prompt.root; <userinput>make WEB_ONLY=YES all install</userinput></screen>
|
||
</listitem>
|
||
</varlistentry>
|
||
|
||
<varlistentry>
|
||
<term><makevar>NOPORTSCVS</makevar></term>
|
||
|
||
<listitem>
|
||
<para>如果設了這個變數,makefiles 就不會從 ports cvs repository
|
||
取出檔案。 取而代之會從
|
||
<filename>/usr/ports</filename> (或是 <envar>PORTSBASE</envar>
|
||
所設定的值) 內複製檔案。</para>
|
||
</listitem>
|
||
</varlistentry>
|
||
</variablelist>
|
||
|
||
<para><envar>CVSROOT</envar> 是環境變數。
|
||
你必須直接使用指令或是在 dot files (如: ~/.profile) 中
|
||
設定這個環境變數。</para>
|
||
|
||
<para><makevar>WEB_ONLY</makevar>、<makevar>ENGLISH_ONLY</makevar> 及
|
||
<makevar>NOPORTSCVS</makevar> 都是 makefile 變數。
|
||
你可以在 <filename>/etc/make.conf</filename>、<filename>Makefile.inc</filename>
|
||
中設定這些變數,作法就像是用命令列或使用 dot files 來設定環境變數一般。</para>
|
||
</sect1>
|
||
</chapter>
|