(no commit message)
[openafs-wiki.git] / AFSLore / HowToBuildOpenAFSFromSource.mdwn
1 These are notes on how to build [[OpenAFS]] from source code. Note that [[OpenAFS]] pre-built binaries are available on the [[OpenAFS]] site and are available as prebuilt packages for many platforms. These instructions may be useful for you if you need to build [[OpenAFS]] from source.
2
3 ### <a name="Requirements"></a> Requirements
4
5 #### <a name="Tools"></a> Tools
6
7 - Git
8 - autoconf
9 - automake
10 - perl 5.6
11 - make
12 - compiler/linker (e.g. gcc tool chain)
13 - lex/yacc (flex/bison)
14
15 #### <a name="Libraries"></a> Libraries
16
17 - libc
18 - kerberos, optional, but recommended
19 - ncurses
20 - pam
21 - kernel headers
22
23 The required packages to build [[OpenAFS]] on Debian-based linux distributions can be installed with,
24
25       apt-get install git-core autoconf automake make gcc flex bison
26       apt-get install libc6-dev libkrb5-dev libncurses5-dev linux-headers-$(uname -r)
27
28 On RPM based linux distributions, the packages required are,
29
30      yum install gcc autoconf automake make flex bison rpm-build
31      yum install glibc-devel krb5-devel ncurses-devel pam-devel kernel-devel-$(uname -r)
32
33 ### <a name="Getting the Source Code"></a> Getting the Source Code
34
35 Snapshots of the [[OpenAFS]] source code is made available for each stable and each development release at <http://openafs.org>.
36
37 The [[OpenAFS]] code base is now available from a Git repository. See [[GitDevelopers]] for more information.
38
39 ### <a name="Building the Binaries"></a> Building the Binaries
40
41 #### <a name="Modern Paths"></a> Modern Paths
42
43 To build [[OpenAFS]] with Kerberos 5 support, and with a custom install path. Be sure to run ./regen.sh to generate the configure script.
44
45        cd openafs-stable-1_4_x.
46        ./regen.sh
47        ./configure --prefix=/usr/local/openafs --with-krb5-conf=(full path to krb5-config script) --with-linux-kernel-headers=(full path to desired kernel headers)
48        make
49        sudo make install
50
51 #### <a name="Transarc Paths"></a> Transarc Paths
52
53 By convention, [[OpenAFS]] server binaries and related files are located in /usr/afs, and client binaries and related files are located in /usr/vice. These are known as Transarc paths, so called because that is is the convention used by Transarc, the company that first commercialized AFS. To build with the Transarc paths, specify --enable-transarc-paths as a configure option.
54
55 There are a couple of side effects that you need need to be aware of when building with the --enable-transarc-paths mode. First of all, the typical make install target does not work in this mode. Instead the 'make dest' target is used to build a directory of the binaries to be copied to the target system. Secondly, the packaging targets are not executed, so for example the redhat spec file is not generated to build the rpms.
56
57 To build with Keberos support (recommended), you'll need to have the Keberos development libraries, and if available for your platform, the krb5-config. You will need the full path the the krb5-config script. For example
58
59        $ which krb5-config
60        /usr/bin/krb5-config
61
62 To build [[OpenAFS]] with Kerberos 5 support and the Transarc path conventions:
63
64        ./configure  --enable-transarc-paths --with-krb5-conf=/usr/bin/krb5-config
65        make
66        make dest
67
68 If all goes well, then the binaries are located in a platform sub-directory, the name of which is platform specific, for example 'i386\_linux26/dest'.
69
70 The 'make install' command does not work with Transarc paths. You will have to manually copy the binaries into place after running make dest. For more information, see the Quick Start Guide for Unix on the [[OpenAFS]] documentation page.
71
72       # cp -r i386_linux26/dest/root.client/usr/vice/etc/modload /usr/vice/etc
73       # cp i386_linux26/dest/root.client/usr/vice/etc/afsd /usr/vice/etc
74       # cp -r i386_linux26/dest/bin /usr/afsws
75       # cp -r i386_linux26/dest/etc /usr/afsws
76       # cp -r i386_linux26/dest/include /usr/afsws
77       # cp -r i386_linux26/dest/lib /usr/afsws
78       # cp -r i386_linux26/dest/root.server/usr/afs/* /usr/afs
79
80 #### <a name="Building RPMs"></a> Building RPMs
81
82 The makesrpm.pl script, available in the directory src/packaging/RedHat, is used to build [[OpenAFS]] rpm packages. First build a srpm file using makesrpm.pl, then run rpmbuild to build and package the binaries. makesrpm.pl builds a srpm from the source and document tar files,
83
84     makesrpm.pl openafs-<version>-src.tar.bz2 openafs-<version>-doc.tar.bz2
85
86 This will create the srpm file openafs-<version>.src.rpm. Use rpmbuld with the --rebuild option, which will run configure and then make to build the binaries, and create the rpm files. The rpm files will be placed into /usr/src/redhat/
87
88     rpmbuild --rebuild openafs-<version>.src.rpm
89
90 #### If You are Working with a Git Clone and Would Like to Make Your Own tar.bz2 Files
91 Start by making sure the root directory of your openafs clone is named to match the version you have checked out.  For instance, if you have checked out openafs-stable-1_4_14 from git, then the directory should be named "openafs-1.4.14".
92
93 NOTE: If your have checked out a newer version of openafs (1.6), you may want to make sure that a .version file exists in the openafs root directory.  It simply holds a bit of text equivalent to the tag on your checkout.
94
95 Now tar and compress <afsroot> and <afsroot>/doc like so.
96
97     tar -cvjf openafs-<version>-src.tar.bz2 <afsroot>
98     tar -cvjf openafs-<version>-doc.tar.bz2 <afsroot>/doc
99
100 After that, you can run makesrpm.pl as stated above.
101
102 ### <a name="Running the Test Suite"></a> [[Running the Test Suite]]
103
104 -- [[MichaelMeffie]] - 26 Mar 2008