aboutsummaryrefslogtreecommitdiff
path: root/en_US.ISO8859-1/books/fdp-primer/the-website/chapter.sgml
blob: bfef1cb72a22bae9a855cc322e5547ac9e692fe6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
<!-- 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$
-->

<chapter id="the-website">
  <title>The Website</title>

  <sect1 id="the-website-prep">
    <title>Preparation</title>

    <para>Use a disk with sufficient free space.  You may need anything from
      200&nbsp;MB to over 500&nbsp;MB, depending on the method you choose.
      This space will hold the SGML tools, a subset of the
      <application>CVS</application> tree, temporary build space and the
      installed web pages.</para>

    <note>
      <para>Make sure your documentation ports are up to date!  When in
	doubt, remove the old ports using &man.pkg.delete.1; command before
	installing the port.  For example, we currently depend on
	jade-1.2 and if you have installed jade-1.1, please do:</para>

      <screen>&prompt.root; <userinput><command>pkg_delete</command> jade-1.1</userinput></screen>
    </note>

    <para>There are two methods to get the files required for the website
      build:</para>

    <itemizedlist>
      <listitem>
	<para>Use <command>csup</command> to get a local copy of the files
	  from a <application>CVSup</application> server.  This is the
	  easiest method, and does not require installation of additional
	  software.  The supfile presented in the next section will always
	  checkout the latest version of the required files.  This is
	  sufficient if you are simply rebuilding the website and do not
	  intend to commit any changes.</para>

	<note>
	  <para>&man.csup.1; became part of the base system in
	    &os;&nbsp;6.2-RELEASE. If you are using an earlier version of &os;
	    you will need to install <filename role="package">net/csup</filename>
	    from the Ports&nbsp;Collection.</para>
	</note> 	
      </listitem>

      <listitem>
	<para>Use <command>cvsup</command> in <quote>cvs</quote> mode to
	  create and maintain a local <application>CVS</application>
	  repository with the required files.  This will require you to
	  install a program like
	  <filename role="package">net/cvsup-without-gui</filename>, but it is
	  a more flexible method if you need to have quick access to different
	  revisions of the doc/www files, revision histories, or if you
	  intend to commit changes to the central &os;
	  <application>CVS</application> repository.</para>
      </listitem>
    </itemizedlist>

    <sect2 id="the-website-csup">
      <title>Simple method: Using <command>csup</command></title>

      <para>The <command>csup</command> command is part of the base system and
	already used extensively by most people for updating the
	Ports&nbsp;Collection.  The following sample supfile can be used to
	obtain a checkout of the files required for the website build:</para>

      <programlisting>#
# This file checks out all collections required to rebuild
# the FreeBSD website
#
# Use the nearest CVSup mirror
# listed at http://www.freebsd.org/doc/handbook/mirrors.html.

*default host=<replaceable>cvsup10.FreeBSD.org</replaceable>
*default base=/var/db
*default prefix=<replaceable>/usr/build</replaceable>
*default release=cvs tag=.
*default delete use-rel-suffix
*default compress

# This will retrieve the entire doc branch of the FreeBSD repository.

doc-all

# This will retrieve the files required for the website

www

# This will retrieve some basic ports info required for the build

ports-base</programlisting>

      <para>You should, of course, change the <literal>default host</literal>
	entry to a <application>CVSup</application> mirror near your
	location, and the <literal>default prefix</literal> entry to the
	location where you intend to store the checked out files.  Save this
	file as e.g.
	<filename><replaceable>doc-www-supfile</replaceable></filename>, and
	then execute the following command:</para>

      <screen>&prompt.root; <userinput><command>csup</command> <option>-g</option> <option>-L2</option> <replaceable>doc-www-supfile</replaceable></userinput></screen>

      <para>When this command finishes, you will find the directories
	<filename role="directory">doc/</filename>,
	<filename role="directory">www/</filename> and
	<filename role="directory">ports/</filename> under the directory you
	specified in <literal>default prefix</literal>
	(<filename
	  role="directory"><replaceable>/usr/build</replaceable></filename>
	in our example).  We will use this same directory for the build
	process itself, so it would be better to use a filesystem with
	sufficient free space.</para>

      <para>That's it! You can now proceed with the
	<link linkend="the-website-build">website build</link>.</para>
    </sect2>

    <sect2 id="the-website-cvsup">
      <title>Advanced method: Maintaining a local
	<application>CVS</application> doc/www repository</title>

      <para>This method will give you more advanced options, but will require
	you to install the
	<filename role="package">net/cvsup-without-gui</filename> port or
	package.</para>

      <note>
	<para>The <filename role="package">net/cvsup-without-gui</filename>
	  port has a build dependency on
	  <filename role="package">lang/ezm3</filename>, a Modula&nbsp;3
	  compiler.  This compiler takes quite some time to build, and since
	  most people will not need it for anything else, it is perhaps best
	  to use a package to install <application>CVSup</application>.</para>
      </note>

      <para>The <application>CVSup</application> utility has a special
	<quote>cvs</quote> mode that allows the retrieval of the
	<quote>,v</quote> files that make up a <application>CVS</application>
	repository.  This function is not currently available in
	<application>csup</application>.  For detailed information on
	<application>CVSup</application>, please read the <ulink
	   url="&url.books.handbook;/synching.html#CVSUP">CVSup introduction</ulink> in the &os;&nbsp;Handbook.</para>

      <para>The supfile shown below will fetch the cvs collections required
	for the website build, and create a local
	<application>CVS</application> repository:</para>

      <programlisting>#
# This file will create a local CVS repository
# with the collections required for a complete
# FreeBSD website rebuild. It should be used with
# cvsup *only* (csup will not work)

*default host=<replaceable>cvsup10.FreeBSD.org</replaceable>
*default base=/var/db
*default prefix=<replaceable>/usr/dcvs</replaceable>
*default release=cvs
*default delete use-rel-suffix
*default compress

# The following collections are needed
# for the website build

ports-base
doc-all
www

# These collections are needed
# for CVS functionality

cvsroot-common
cvsroot-ports
cvsroot-doc</programlisting>

      <para>You should, of course, change the <literal>default host</literal>
	entry to a <application>CVSup</application> mirror near your
	location, and the <literal>default prefix</literal> entry to the
	location where you intend to store the repository files.  Save this
	file as e.g.
	<filename><replaceable>doc-www-cvsfile</replaceable></filename>, and
	then execute the following command:</para>

      <screen>&prompt.root; <userinput><command>cvsup</command> <option>-g</option> <option>-L2</option> <replaceable>doc-www-cvsfile</replaceable></userinput></screen>

      <para>It is also advisable to set the <envar>CVSROOT</envar> environment
	variable in your shell's startup files.  For example, use
	the following entry in your <filename>~/.cshrc</filename> file:</para>

      <programlisting>setenv <envar>CVSROOT</envar> <replaceable>/usr/dcvs</replaceable></programlisting>

      <para>If you set this variable, you may omit the <option>-d</option>
	argument (shown below) when performing repository operations using
	the <command>cvs</command> command.</para>

      <para>Currently, you will need more than 400&nbsp;MB of free space to
	host the repository files.  An additional 200&nbsp;MB will be needed
	for the temporary build space.  Once the <command>cvsup</command>
	command completes, you are ready to check out the files to your build
	directory:</para>

      <screen>&prompt.root; <userinput><command>mkdir</command> <replaceable>/usr/build</replaceable></userinput>
&prompt.root; <userinput><command>cd</command> <replaceable>/usr/build</replaceable></userinput>
&prompt.root; <userinput><command>cvs</command> <option>-d</option> <replaceable>/usr/dcvs</replaceable> <option>-R</option> co <option>-AP</option> doc www ports</userinput></screen>

      <para>The above command is consistent with the way
	<application>csup</application> checks out the files from the
	<application>CVSup</application> servers.  When it completes, you
	will have a build directory with similar contents to the one used in
	the simple <application>csup</application> method.</para>

      <para>You can continue to use the <command>cvsup</command> command
	shown above, to update your local <application>CVS</application>
	repository on a regular basis.  After the initial somewhat lengthy
	download, regular updates will only take a few minutes.</para>
    </sect2>
  </sect1>

  <sect1 id="the-website-build">
    <title>Build the web pages from scratch</title>

    <para>Having completed either of the two methods, you will be ready to
      start the website build.  In our example, the build directory is
      <filename
	 role="directory"><replaceable>/usr/build</replaceable></filename>
      and all the required files are already in place.</para>

    <procedure>
      <step>
	<para>Change into the build directory:</para>

	<screen>&prompt.root; <userinput><command>cd</command> <replaceable>/usr/build</replaceable></userinput></screen>
      </step>

      <step>
	<para>The website build starts from the
	  <filename role="directory">www/en</filename> directory by executing
	  the &man.make.1; <maketarget>all</maketarget> target, to create
	  the web pages.</para>

	<screen>&prompt.root; <userinput><command>cd</command> www/en</userinput>
&prompt.root; <userinput><command>make</command> <maketarget>all</maketarget></userinput></screen>
      </step>
    </procedure>
  </sect1>

  <sect1 id="the-website-install">
    <title>Install the web pages into your web server</title>

    <procedure>
      <step>
	<para>If you have moved out of the
	  <filename role="directory">en</filename> directory, change back to
	  it.</para>

	<screen>&prompt.root; <userinput><command>cd</command> <replaceable>/usr/build/www/en</replaceable></userinput></screen>
      </step>

      <step>
	<para>Run the &man.make.1; <maketarget>install</maketarget> target,
	  setting the <makevar>DESTDIR</makevar> variable to the name of the
	  directory you want to install the files to.</para>

	<screen>&prompt.root; <userinput><command>env</command> <makevar>DESTDIR</makevar>=<replaceable>/usr/local/www</replaceable> <command>make</command> <maketarget>install</maketarget></userinput></screen>
      </step>

      <step>
	<para>If you have previously installed the web pages into the same
	  directory the install process will not have deleted any old or
	  outdated pages.  For example, if you build and install a new copy
	  of the site every day, this command will find and delete all
	  files that have not been updated in three days.</para>

	<screen>&prompt.root; <userinput><command>find</command> <replaceable>/usr/local/www</replaceable> <option>-ctime</option> 3 <option>-print0</option> | <command>xargs</command> <option>-0</option> <command>rm</command></userinput></screen>
      </step>
    </procedure>
  </sect1>

  <sect1 id="the-website-env">
    <title>Environment variables</title>

    <variablelist>
      <varlistentry>
	<term><envar>CVSROOT</envar></term>

	<listitem>
	  <para>Location of the CVS tree.  We suggest you set this
	    variable, if you use the <application>CVSup</application>
	    method:</para>

	  <screen><userinput>&prompt.root; <makevar>CVSROOT</makevar>=<replaceable>/usr/dcvs</replaceable>; <command>export</command> <makevar>CVSROOT</makevar></userinput></screen>

	  <para><envar>CVSROOT</envar> is an environment variable.  You must
	    set it on the command line or in your dot files
	    (e.g., <filename>~/.profile</filename>).  The exact syntax will
	    differ depending on your shell (the above example is for
	    <application>bash</application> and bash-like shells).</para>
	</listitem>
      </varlistentry>

      <varlistentry>
	<term><makevar>ENGLISH_ONLY</makevar></term>

	<listitem>
	  <para>If set and not empty, the makefiles will build and
	    install only the English documents.  All translations will be
	    ignored.  E.g.:</para>

	  <screen>&prompt.root; <userinput><command>make</command> <makevar>ENGLISH_ONLY=YES</makevar> <maketarget>all</maketarget> <maketarget>install</maketarget></userinput></screen>

	  <para>If you want to unset the variable
	    <makevar>ENGLISH_ONLY</makevar> and build all pages, including
	    translations, set the variable <makevar>ENGLISH_ONLY</makevar>
	    to an empty value:</para>

	  <screen>&prompt.root; <userinput><command>make</command> <makevar>ENGLISH_ONLY=""</makevar> <maketarget>all</maketarget> <maketarget>install</maketarget> <maketarget>clean</maketarget></userinput></screen>
	</listitem>
      </varlistentry>

      <varlistentry>
	<term><makevar>WEB_ONLY</makevar></term>

	<listitem>
	  <para>If set and not empty, the makefiles will build and install
	    only the HTML pages from the www directory.  All documents from
	    the <filename role="directory">doc</filename> directory (Handbook,
	    FAQ, Tutorials) will be ignored.  E.g.:</para>

	  <screen>&prompt.root; <userinput><command>make</command> <makevar>WEB_ONLY=YES</makevar> <maketarget>all</maketarget> <maketarget>install</maketarget></userinput></screen>
	</listitem>
      </varlistentry>

      <varlistentry>
	<term><makevar>NOPORTSCVS</makevar></term>

	<listitem>
	  <para>If set, the makefiles will not checkout files from the ports
	    cvs repository.  Instead, it will copy the files from
	    <filename role="directory">/usr/ports</filename> (or where the
	    variable <envar>PORTSBASE</envar> points to).</para>
	</listitem>
      </varlistentry>
    </variablelist>

    <para><makevar>WEB_ONLY</makevar>, <makevar>ENGLISH_ONLY</makevar> and
      <makevar>NOPORTSCVS</makevar> are make variables.  You can set the
      variables in <filename>/etc/make.conf</filename>,
      <filename>Makefile.inc</filename>, as environment variables on the
      command line, or in your dot files.</para>
  </sect1>
</chapter>

<!--
     Local Variables:
     mode: sgml
     sgml-declaration: "../chapter.decl"
     sgml-indent-data: t
     sgml-omittag: nil
     sgml-always-quote-attributes: t
     sgml-parent-document: ("../book.sgml" "part" "chapter")
     End:
-->