improve description for building rpms
[openafs-wiki.git] / AFSLore / HowToBuildOpenAFSFromSource.mdwn
index b20d16f..0d76ee0 100644 (file)
@@ -6,26 +6,42 @@ 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).
 
-## The Short Story
+## Getting Started
 
-Assuming you already have all the required prerequisites on your build host, the
-following commands show how to checkout and build a version OpenAFS,
+The following shows how to download source code tarballs and build the
+OpenAFS binaries:
+
+    $ wget http://openafs.org/dl/openafs/<version>/openafs-<version>-src.tar.bz2
+    $ wget http://openafs.org/dl/openafs/<version>/openafs-<version>-doc.tar.bz2
+    $ tar xjf openafs-<version>-src.tar.bz2 
+    $ tar xjf openafs-<version>-doc.tar.bz2 
+    $ cd openafs-<version>
+    $ ./configure
+    $ make
+
+See <http://openafs.org/dl/openafs> for available versions.
+
+The following shows how to do a git checkout and build the OpenAFS binaries,
 
     $ git clone git://git.openafs.org/openafs.git
     $ cd openafs
-    $ git checkout openafs-stable-1_6_0pre3
+    $ git checkout <branch-or-tag>
     $ ./regen.sh
     $ ./configure
     $ make
-    $ sudo make install
 
 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.  More about the configure options below.
+--enable-transarc-paths option. (Read on for more information about configure
+options.)
+
+    $ ./configure --enable-transarc-paths $ make
+    $ make
+    $ make dest 
 
 See the end of this page for instructions on how to build RPM packages.
 
-## The Longer Story
+## Build OpenAFS 
 
 Building and packaging OpenAFS is not difficult on current unix-like
 systems. A small number of fairly common libraries and tools are required. The
@@ -68,47 +84,44 @@ below in the section Building RPMs.
 
 ## Prerequisites
 
-The following tools are needed to build OpenAFS:
+The following tools are needed to build OpenAFS from source from a tar file:
 
-- Git
-- autoconf, v2.60 or better
-- automake
-- perl, v5.6 or better
 - make
 - compiler
-- must be capable of building kernel modules for the target)
-  * if using gcc, version 4.2 or better is recommended
-  * assembler (as)
+- assembler
 - linker
 - ranlib
+- lex/yacc
 - install
-- lex/yacc (flex/bison)
-- rpm-build (if building rpms)
-
-Strictly speaking, git is not required for the build, but used to fetch source
-code from the OpenAFS git repository. (It is also used to determine the version
-string when building in a local git repo.) You can build release versions of
-OpenAFS without git, by retrieving the source code tree by downloading source
-code and documentation compressed tar files.
-
-You will need to generate a configure script if you checkout the source with
-git. Autoconf version 2.60 is minimum required version to generate the
-configure script.  If your system has an older version, you'll need to upgrade
-m4 and autoconf, or generate the configure script on another system which has a
-suitable version of autoconf and run the configure and build on your build
-host.
+- perl 5.6 or better (only to build the documention)
+
+In addtion to the above, the following tools are needed to build OpenAFS 
+from a git checkout:
+
+- git
+- autoconf 2.60 or better
+- automake
+
+The compiler used must be capable of building kernel modules for the target
+platform.
 
 > Note for RHEL users: RedHat Enterprise Linux 5.5 and less shipped with a
 > version of autoconf too old to generate the OpenAFS configure script.
 > Fortunately, the recently released RHEL 6.0 shipped with a more up to date
-> version of autoconf which mets the minimum version needed to generate th
+> version of autoconf which mets the minimum version needed to generate the
+> configure script.
+
+The following tools are needed to build OpenAFS RPMS:
 
-The following development libraries are used to build OpenAFS:
+- perl 5.6 or better
+- rpmbuild
+
+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
@@ -133,8 +146,20 @@ installed with the following yum commands,
 
 ### 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
 
@@ -234,9 +259,15 @@ specify the path with the --with-linux-kernel-headers option. For example,
 
 ### Kerberos 5 configuration
 
-Recent configure scripts will automatically find the location of the
-krb5-config script to configure kerberos.  If you need to build an
-older version, use the --with-krb5-conf option. 
+The 1.6.0 configure scripts should automatically find the kerberos 5
+libraries and headers.
+
+If you need to build 1.4.x, or if the krb5-config file is in a non-standard
+location, use the --with-krb5-conf option to specify the path to the krb5-config
+utility (part of the kerberos 5 development package).
+
+    --with-krb5-conf=/usr/bin/krb5-config
+
 
 ### Debugging Options
 
@@ -270,6 +301,26 @@ for a complete list and README for more details.  Common options are:
                                    and safely used by a ptserver built 
                                    without this option. 
 
+### Configure changes in 1.6.0
+
+If you have been building the 1.5.0 freatures branch, note the following configure
+options have been removed in 1.6.0. Each feature is now always on, except as noted:
+
+* --disable-afsdb
+* --disable-largefile-fileserver
+* --enable-bos-restricted
+* --enable-fast-restart (off, but the code is still there)
+* --disable-full-vos-listvol
+* --enable-disconnected
+* --enable-icmp-pmtu-discovery
+* --enable-demand-attach-fs (see below)
+
+In 1.5.x, the demand attach fileserver feature was enabld by the a configure
+switch. Starting in 1.6.0, both DAFS and legacy binaries are built. The
+DAFS binaries are prefixed with 'da', expect for the new salvageserver, since
+salvageserver is new with DAFS.
+
+
 ## Make
 
 After a successful configure, run make to build OpenAFS. The
@@ -326,31 +377,49 @@ Some make targets of interest
 - make tests - make the (old) afs test suite
 
 
-### Building RPM packages
+## 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.
 
-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.