CHAPTER 7: BUILDING FROM SOURCE
7.1 . . . . Loading the Source
7.2 . . . . Setting Up the Tree Structure and Tools Using washtool
7.3 . . . . Building the System
7.4 . . . . Building Without Washtool

 7. BUILDING FROM SOURCE

This chapter describes how to build AFS from source.

Note for sites using the NFS/AFS Translator: Source code for the NFS/AFS
Translator is available for all system types supported in AFS 3.4 (except
Ultrix systems, which cannot act as Translator machines).

 7.1. LOADING THE SOURCE

Working on the AFS machine where you will build the source, follow these steps
to load the AFS source tree from the AFS Source Distribution Tape.

Step 1: Create and mount the volume for housing the AFS source tree.

	------------------------------------------------------------
	# vos  create  <machine name>  <partition name>  src.afs 
	# cd  /afs/.<cellname>                                   
	# mkdir  afs                                             
	# fs  mkmount afs/src  src.afs                           
	# vos  release  root.cell                                
	# fs  checkvolumes                                       
	------------------------------

Step 2: Load the source tree to the local disk.

---------------------------------------------------------------------------------
On AIX systems: Before reading the tape, verify that block size is set to 0   
(meaning variable block size); if necessary, use SMIT to set block size to 0. 
Also, substitute tctl for mt.                                                 

	On HP-UX systems: Substitute mt -t for mt -f.                                 

On all system types: For , substitute the name of the tape device for 
your system that does not rewind after each operation.                        

	# mt -f /dev/<device> rewind                                                  
	# cd /afs/<cellname>/afs/src                                                  
	# tar xvf /dev/<device>                                                       
	----------------------------

 7.2. SETTING UP THE TREE STRUCTURE AND TOOLS USING WASHTOOL

Transarc provides the washtool program for managing a hierarchy of software
development projects.  The program builds project trees which allow program
editing, compilation, and installation.  Using washtool, follow these steps to
set up the object and destination trees.

Note: The washtool program assumes that you use RCS.  If you do not, or do not
want to use washtool, see Section 7.4.

Step 1: Create an rcs directory under /afs/cellname/afs (at the same level
as the src directory).  Then create directories under it for the AFS
packages. Transarc distributes source directories that already have
links in the source package files from RCS to the RCS package files.

	-----------------------------------
	# mkdir /afs/<cellname>/afs/rcs 
	# cd /afs/<cellname>/afs/src    

	# foreach dir (*)               
	? if (-d $dir) then             
	? echo $dir                     
	? mkdir ../rcs/$dir             
	? mkdir ../rcs/$dir/RCS         
	? endif                         
	? end                           
	-----------------------------------

Step 2: Create a directory under /afs/cellname/afs for each system type
for which you will build AFS.  In order for AFS's @sys mechanism to
work, you must use Transarc's recommended system names, as listed in
Section 1.3.

	---------------------------------------------------------
	Note: Repeat the second command for each system type. 

	# cd /afs/<cellname>/afs                              
	# mkdir <sysname>                                     
	-------------------------

For example, to create directories for DECstations running Ultrix
4.3a and for IBM RS/6000s running AIX 3.2, issue the following
commands.

	# mkdir pmax_ul43a
	# mkdir rs_aix32

Step 3: Define two symbolic links in /afs/cellname/afs:

 - dest, pointing to @sys/dest

 - obj, pointing to @sys/obj

	-----------------------------
	# cd /afs/<cellname>/afs  
	# ln  -s  @sys/obj  obj   
	# ln  -s  @sys/dest  dest 
	-----------------------------

Step 4: (Optional.) The build procedure normally creates a destination
directory for each system type under /afs/cellname/afs/sysname/dest
and installs its results there. If you want to locate a system
type's destination directory elsewhere, create a link from the dest
directory to that alternate directory.

-------------------------------------------------------------------------------------
Note: Perform this step only if you want to locate a system type's dest directory 
somewhere other than /afs/cellname/afs/sysname/dest.  Repeat it for each desired  
system type.                                                                      

	# cd /afs/<cellname>/afs/<sysname>                                                
	# ln -s <full path of alternate directory>  dest                                  
	------------------------------------------------

For example, if you wanted the destination directory for DECStations
running Ultrix 4.3a to be /afs/cellname/pmax_ul43a/usr/afsws, you
would issue the following.

	# cd /afs/<cellname>/afs/pmax_ul43a
	# ln -s /afs/<cellname>/pmax_ul43a/usr/afsws  dest

Step 5: Create a link called PARENT in the top level directory
(/afs/cellname/afs).

	----------------------------
	# cd /afs/<cellname>/afs 
	# ln  -s  .  PARENT      
	----------------------------

Step 6: Create a link in /afs/cellname/afs that points to the global
Makefile in the src directory.

	------------------------------------
	# cd /afs/<cellname>/afs         
	# ln  -s  src/Makefile  Makefile 
	------------------------------------

The following is an example of what your /afs/cellname/afs might
look like after you have completed this step.  It shows
/afs/transarc.com/afs.test.

lrwxr-xr-x hines  12 Sep 19 11:02 Makefile->src/Makefile
lrwxr-xr-x hines   1 Sep 19 11:03 PARENT -> .
drwxrwxrwx root 2048 Sep 28 18:57 rs_aix32
lrwxr-xr-x hines   9 Sep 19 11:25 dest -> @sys/dest
lrwxr-xr-x hines   8 Sep 19 11:25 obj -> @sys/obj
drwxrwxrwx root 2048 Sep 28 19:00 pmax_ul43a
drwxrwxrwx root 4096 Sep 18 21:01 rcs
drwxrwxrwx root 2048 Sep 28 19:04 sgi_52
drwxrwxrwx root 2048 Sep 20 14:58 src
drwxrwxrwx root 2048 Sep 28 16:55 sun4c_411
drwxrwxrwx root 2048 Sep 28 19:05 sun4m_412

Step 7: Verify that /usr/afsws/bin/co and /usr/afsws/bin/ci exist (they
are distributed as part of the AFS Binary Distribution).  They are
programs that check the times listed in the .rcstimes files in each
package directory, making sure that the build procedure checks out a
new copy of the source files when necessary.

Step 8: Verify that the washtool and rcsupdate binaries are available.
The Makefile looks for them in /afs/cellname/afs/dest/bin by
default, but you can specify a different location by setting the
WASHTOOL variable on the make command line (see Section 7.3 for an
example).

 7.3. BUILDING THE SYSTEM

This section explains how to build the system.  It assumes you have followed
the instructions in Section 7.2.

Step 1: Working in the /afs/cellname/afs directory, issue the make finale
command to build the system.

-------------------------------------------------------------------------------------
	# cd /afs/<cellname>/afs                                                          

If the washtool binary is in the expected directory (/afs/cellname/afs/dest/bin), 
then issue:                                                                       

	# make finale                                                                     

If the washtool binary is in a different directory, then issue the following,     
specifying the full path of the alternate directory:                              

	# make finale WASHTOOL=<alternate washtool directory>                             
-------------------------------------------------------------------------------------

For example, if washtool is in /usr/afsws/bin, then you would issue:

	# make finale WASHTOOL=/usr/afsws/bin/washtool

 7.4. BUILDING WITHOUT WASHTOOL

This section explains how to build AFS without using washtool.  It assumes that
you have followed the instructions in Section 7.1, but not in Section 7.2.  Use
these instructions if you do not use RCS for the AFS source files.

Step 1: Create an object directory for each system type you will build.

	-----------------------------------------------------
	Note: Repeat these commands for each system type. 

	# mkdir /afs/<cellname>/afs/<sysname>             
	# mkdir /afs/<cellname>/afs/<sysname>/obj         
	-----------------------------------------------------

Step 2: Copy the source files from /afs/cellname/afs/src to each system
type's obj directory.

------------------------------------------------------------------------
Note:  Repeat these commands for each system type you will build.    

	# cd /afs/<cellname>/afs/<sysname>/obj                               
	# up  -v  /afs/<cellname>/afs/src  /afs/<cellname>/afs/<sysname>/obj 
	--------------------------------------------------------------------

Step 3: Create a destination directory for each system type.

	----------------------------------------------------
	Note:  Repeat this command for each system type. 

	# mkdir /afs/<cellname>/<sysname>/dest           
	----------------------------------------------------

Step 4: For each AFS package found under /afs/cellname/afs/sysname/obj,
create a link from its DEST subdirectory to the destination tree.
Repeat for each system type.

--------------------------------------------------------------------
Note:  Repeat this command for each system type sysname and each 
AFS package AFS-pkg.  Type it on a single line in each case.     

	# ln -s /afs/<cellname>/<sysname>/dest                           
	  /afs/<cellname>/afs/<sysname>/obj/<AFS-pkg>/DEST    
	-----------------------------------------------------


Step 5: Working in the /afs/cellname/afs directory, run the make program
for each system type.

-----------------------------------------------------------------------------------
Note: Repeat the second command for each system type, substituting its Transarc 
system name for sysname.                                                        

	# cd /afs/<cellname>/afs                                                        
	# make SYS_NAME=<sysname>                                                       
-----------------------------------------------------------------------------------