(no commit message)
[openafs-wiki.git] / AFSLore / HowToBuildOpenAFSFromSource.mdwn
index 67ca048..88a8ea1 100644 (file)
@@ -6,7 +6,10 @@ instructions and software needed to build OpenAFS on Microsoft Windows.
 Unless otherwise noted, the information on this page is for version 1.6.x
 (available as pre-release 3 at the time of this writing).
 
-## Getting Started
+## The Short Version
+
+For the impatient, this section describes how to get a code tree and
+build it, assuming you have a development environment already setup.
 
 The following shows how to download source code tarballs and build the
 OpenAFS binaries:
@@ -30,7 +33,6 @@ The following shows how to do a git checkout and build the OpenAFS binaries,
     $ ./configure
     $ make
 
-
 You will usually want to specify configure options. For example, to enable the
 traditional Transarc/IBM AFS installation paths, run configure with the
 --enable-transarc-paths option. (Read on for more information about configure
@@ -94,21 +96,14 @@ The following tools are needed to build OpenAFS from source from a tar file:
 - ranlib
 - lex/yacc
 - install
+- perl 5.6 or better (only to build the documention)
 
-The following tools are needed to build OpenAFS from source from a git
-checkout:
+In addtion to the above, the following tools are needed to build OpenAFS 
+from a git checkout:
 
 - git
-- autoconf v2.60 or better
+- autoconf 2.60 or better
 - automake
-- perl v5.6 or better 
-- make
-- compiler
-- assembler
-- linker
-- ranlib
-- lex/yacc
-- install
 
 The compiler used must be capable of building kernel modules for the target
 platform.
@@ -124,12 +119,12 @@ The following tools are needed to build OpenAFS RPMS:
 - perl 5.6 or better
 - rpmbuild
 
-The following development libraries are used to build OpenAFS:
+The following development libraries are needed:
 
 - libc
 - kerberos 5
-- ncurses
-- pam
+- ncurses (optional, needed to build scout/afsmonitor)
+- pam (optional)
 - kernel headers
 
 The ncurses libraries are needed to build the ncurses based admin tools
@@ -149,13 +144,25 @@ install with the following commands apt-get commands,
 On a RedHat-based linux distributions, all of the required packages can be
 installed with the following yum commands,
 
-     $ yum install gcc autoconf automake make flex bison rpm-build
+     $ yum install git-core gcc autoconf automake make flex bison rpm-build
      $ yum install glibc-devel krb5-devel ncurses-devel pam-devel kernel-devel-$(uname -r)
 
 ### Solaris Packages
 
-XXX: Please add the solaris pgk names
+For Solaris packages, start by installing pkg-get, if you have not already.
+
+     $ wget http://www.opencsw.org/pkg-get
+     $ pkgadd -d /path/to/pkg-get
+     $ wget --output-document=/tmp/gpg.key http://www.opencsw.org/get-it/mirrors/
+     $ gpg --import /tmp/gpg.key
 
+Check to make sure pkg-get is installed properly by doing a pkg-get compare.
+It should output a list of installed packages compared to up-to-date remote packages.
+
+With pkg-get installed, go ahead and begin installing the necessary packages
+
+     $ pkg-get install gcc flex bison automake autoconf gmake
+     $ pkg-get install krb5_kdc ncurses
 
 ## Getting the Source Code
 
@@ -374,36 +381,48 @@ Some make targets of interest
 
 
 ## Building RPM packages
+A script called makesrpm.pl is provided to build a source RPM package.  You can
+use the generated source RPM to build the binaries and create the RPM packages
+for your source code tree of OpenAFS.
 
-A script is provided to build RPM packages. This script will run the
-configure and make as part of the process. You'll need to get source
-and document tar archives of the version you want to build, and then
-use a script to build the source RPM, then use the rpmbuild tool to
-build the packages from that source RPM.
-
-To build OpenAFS RPM packages, use the OpenAFS makesrpm.pl script to build a
-source RPM, and then use the rpm tool rpmbuild to build the various packages.
-The makesrpm.pl requires the source and document tar archive files. If you
-are building from a git repository, first create the source and document
-archive files.
+The first step is to create a source tree of OpenAFS. Run the regen.sh script
+to build the docs and to generate the configure script. Also, use git describe
+to make a version stamp file which will be used by the packaging process. This
+example shows how to get a source tree from a remote git repo.
 
-    $ git clone git://git.sinenomine.net/openafs.git openafs-<version>
+    $ git clone git://git.openafs.org/openafs.git openafs-<version>
     $ cd openafs-<version>
     $ git checkout <tagname>
     $ git describe >.version
     $ ./regen.sh
-    $ cd ..
+
+The _version_ is the dotted OpenAFS version number, such as 1.6.0,
+and the _tagname_ is the git tag for the version, such as openafs-stable-1_6_0.
+The _version_ number for pre-releases are suffixed with pre<number>. For example,
+to build 1.6.0pre5, create a directory called openafs-1.6.0pre5.
+
+Next, create a source RPM file. This requires creating a tar file for the
+source files and a tar file for the documents.  Run the makesrpm program
+to generate an OpenAFS source RPM.
+
+    $ cd .. # move out of the source tree
     $ tar cjf openafs-<version>-src.tar.bz2 openafs-<version> --exclude .git --exclude doc
     $ tar cjf openafs-<version>-doc.tar.bz2 openafs-<version>/doc
+    $ openafs-<version>/src/packaging/RedHat/makesrpm.pl openafs-<version>-src.tar.bz2 openafs-<version>-doc.tar.bz2
 
-where _version_ is the dotted OpenAFS version number, such as 1.6.0,
-and _tagname_ is the git tag for the version, such as openafs-stable-1_6_0.
+At this point you should have a source RPM called openafs-<version>-1.0.src.rpm. See the makesrpm.pl for additional options.
+The source tree and tar files are no longer needed.
 
-Next run makesrpm.pl to build the source RPM, and then use rpmbuild to
-build the binaries and packages. The resulting packages will be located
-in the $HOME/rpmbuild/RPMS/_arch_ directory.
+Finally, run rpmbuild to build the build binary RPM packages. If all goes well, the final
+output will show the destination directory and an exit code of zero.
 
-    $ openafs-<version>/src/packaging/RedHat/makesrpm.pl openafs-<version>-src.tar.bz2 openafs-<version>-doc.tar.bz2
     $ rpmbuild --rebuild openafs-<version>-1.0.src.rpm
-    $ cd ~/rpmbuild/RPMS/<arch>
+    ...
+    + cd /usr/src/redhat/BUILD
+    + rm -rf openafs-<version>
+    + exit 0
+
+Alternatively, the source RPM may be installed, which will place the sources in the
+rpm SOURCE directory and a spec file in the rpm SPEC directory.