xref: /freebsd/crypto/krb5/doc/build/doing_build.rst (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1*7f2fe78bSCy SchubertDoing the build
2*7f2fe78bSCy Schubert===============
3*7f2fe78bSCy Schubert
4*7f2fe78bSCy Schubert.. _do_build:
5*7f2fe78bSCy Schubert
6*7f2fe78bSCy SchubertBuilding within a single tree
7*7f2fe78bSCy Schubert-----------------------------
8*7f2fe78bSCy Schubert
9*7f2fe78bSCy SchubertIf you only need to build Kerberos for one platform, using a single
10*7f2fe78bSCy Schubertdirectory tree which contains both the source files and the object
11*7f2fe78bSCy Schubertfiles is the simplest.  However, if you need to maintain Kerberos for
12*7f2fe78bSCy Schuberta large number of platforms, you will probably want to use separate
13*7f2fe78bSCy Schubertbuild trees for each platform.  We recommend that you look at OS
14*7f2fe78bSCy SchubertIncompatibilities, for notes that we have on particular operating
15*7f2fe78bSCy Schubertsystems.
16*7f2fe78bSCy Schubert
17*7f2fe78bSCy SchubertIf you don't want separate build trees for each architecture, then use
18*7f2fe78bSCy Schubertthe following abbreviated procedure::
19*7f2fe78bSCy Schubert
20*7f2fe78bSCy Schubert    cd /u1/krb5-VERSION/src
21*7f2fe78bSCy Schubert    ./configure
22*7f2fe78bSCy Schubert    make
23*7f2fe78bSCy Schubert
24*7f2fe78bSCy SchubertThat's it!
25*7f2fe78bSCy Schubert
26*7f2fe78bSCy SchubertBuilding with separate build directories
27*7f2fe78bSCy Schubert----------------------------------------
28*7f2fe78bSCy Schubert
29*7f2fe78bSCy SchubertIf you wish to keep separate build directories for each platform, you
30*7f2fe78bSCy Schubertcan do so using the following procedure.  (Note, this requires that
31*7f2fe78bSCy Schubertyour make program support VPATH.  GNU's make will provide this
32*7f2fe78bSCy Schubertfunctionality, for example.)  If your make program does not support
33*7f2fe78bSCy Schubertthis, see the next section.
34*7f2fe78bSCy Schubert
35*7f2fe78bSCy SchubertFor example, if you wish to store the binaries in ``tmpbuild`` build
36*7f2fe78bSCy Schubertdirectory you might use the following procedure::
37*7f2fe78bSCy Schubert
38*7f2fe78bSCy Schubert   mkdir /u1/tmpbuild
39*7f2fe78bSCy Schubert   cd /u1/tmpbuild
40*7f2fe78bSCy Schubert   /u1/krb5-VERSION/src/configure
41*7f2fe78bSCy Schubert   make
42*7f2fe78bSCy Schubert
43*7f2fe78bSCy Schubert
44*7f2fe78bSCy SchubertBuilding using lndir
45*7f2fe78bSCy Schubert--------------------
46*7f2fe78bSCy Schubert
47*7f2fe78bSCy SchubertIf you wish to keep separate build directories for each platform, and
48*7f2fe78bSCy Schubertyou do not have access to a make program which supports VPATH, all is
49*7f2fe78bSCy Schubertnot lost.  You can use the lndir program to create symbolic link trees
50*7f2fe78bSCy Schubertin your build directory.
51*7f2fe78bSCy Schubert
52*7f2fe78bSCy SchubertFor example, if you wish to create a build directory for solaris
53*7f2fe78bSCy Schubertbinaries you might use the following procedure::
54*7f2fe78bSCy Schubert
55*7f2fe78bSCy Schubert    mkdir /u1/krb5-VERSION/solaris
56*7f2fe78bSCy Schubert    cd /u1/krb5-VERSION/solaris
57*7f2fe78bSCy Schubert    /u1/krb5-VERSION/src/util/lndir `pwd`/../src
58*7f2fe78bSCy Schubert    ./configure
59*7f2fe78bSCy Schubert    make
60*7f2fe78bSCy Schubert
61*7f2fe78bSCy SchubertYou must give an absolute pathname to lndir because it has a bug that
62*7f2fe78bSCy Schubertmakes it fail for relative pathnames.  Note that this version differs
63*7f2fe78bSCy Schubertfrom the latest version as distributed and installed by the
64*7f2fe78bSCy SchubertXConsortium with X11R6.  Either version should be acceptable.
65*7f2fe78bSCy Schubert
66*7f2fe78bSCy Schubert
67*7f2fe78bSCy SchubertInstalling the binaries
68*7f2fe78bSCy Schubert-----------------------
69*7f2fe78bSCy Schubert
70*7f2fe78bSCy SchubertOnce you have built Kerberos, you should install the binaries. You can
71*7f2fe78bSCy Schubertdo this by running::
72*7f2fe78bSCy Schubert
73*7f2fe78bSCy Schubert    make install
74*7f2fe78bSCy Schubert
75*7f2fe78bSCy SchubertIf you want to install the binaries into a destination directory that
76*7f2fe78bSCy Schubertis not their final destination, which may be convenient if you want to
77*7f2fe78bSCy Schubertbuild a binary distribution to be deployed on multiple hosts, you may
78*7f2fe78bSCy Schubertuse::
79*7f2fe78bSCy Schubert
80*7f2fe78bSCy Schubert    make install DESTDIR=/path/to/destdir
81*7f2fe78bSCy Schubert
82*7f2fe78bSCy SchubertThis will install the binaries under *DESTDIR/PREFIX*, e.g., the user
83*7f2fe78bSCy Schubertprograms will install into *DESTDIR/PREFIX/bin*, the libraries into
84*7f2fe78bSCy Schubert*DESTDIR/PREFIX/lib*, etc.  *DESTDIR* must be an absolute path.
85*7f2fe78bSCy Schubert
86*7f2fe78bSCy SchubertSome implementations of make allow multiple commands to be run in
87*7f2fe78bSCy Schubertparallel, for faster builds.  We test our Makefiles in parallel builds
88*7f2fe78bSCy Schubertwith GNU make only; they may not be compatible with other parallel
89*7f2fe78bSCy Schubertbuild implementations.
90*7f2fe78bSCy Schubert
91*7f2fe78bSCy Schubert
92*7f2fe78bSCy SchubertTesting the build
93*7f2fe78bSCy Schubert-----------------
94*7f2fe78bSCy Schubert
95*7f2fe78bSCy SchubertThe Kerberos V5 distribution comes with built-in regression tests.  To
96*7f2fe78bSCy Schubertrun them, simply type the following command while in the top-level
97*7f2fe78bSCy Schubertbuild directory (i.e., the directory where you sent typed make to
98*7f2fe78bSCy Schubertstart building Kerberos; see :ref:`do_build`)::
99*7f2fe78bSCy Schubert
100*7f2fe78bSCy Schubert    make check
101*7f2fe78bSCy Schubert
102*7f2fe78bSCy SchubertOn some operating systems, you have to run ``make install`` before
103*7f2fe78bSCy Schubertrunning ``make check``, or the test suite will pick up installed
104*7f2fe78bSCy Schubertversions of Kerberos libraries rather than the newly built ones.  You
105*7f2fe78bSCy Schubertcan install into a prefix that isn't in the system library search
106*7f2fe78bSCy Schubertpath, though.  Alternatively, you can configure with
107*7f2fe78bSCy Schubert**-**\ **-disable-rpath**, which renders the build tree less suitable
108*7f2fe78bSCy Schubertfor installation, but allows testing without interference from
109*7f2fe78bSCy Schubertpreviously installed libraries.
110*7f2fe78bSCy Schubert
111*7f2fe78bSCy SchubertThere are additional regression tests available, which are not run
112*7f2fe78bSCy Schubertby ``make check``.  These tests require manual setup and teardown of
113*7f2fe78bSCy Schubertsupport infrastructure which is not easily automated, or require
114*7f2fe78bSCy Schubertexcessive resources for ordinary use.  The procedure for running
115*7f2fe78bSCy Schubertthe manual tests is documented at
116*7f2fe78bSCy Schuberthttps://k5wiki.kerberos.org/wiki/Manual_Testing.
117*7f2fe78bSCy Schubert
118*7f2fe78bSCy Schubert
119*7f2fe78bSCy SchubertCleaning up the build
120*7f2fe78bSCy Schubert---------------------
121*7f2fe78bSCy Schubert
122*7f2fe78bSCy Schubert* Use ``make clean`` to remove all files generated by running make
123*7f2fe78bSCy Schubert  command.
124*7f2fe78bSCy Schubert* Use ``make distclean`` to remove all files generated by running
125*7f2fe78bSCy Schubert  ./configure script.  After running ``make distclean`` your source
126*7f2fe78bSCy Schubert  tree (ideally) should look like the raw (just un-tarred) source
127*7f2fe78bSCy Schubert  tree.
128*7f2fe78bSCy Schubert
129*7f2fe78bSCy SchubertUsing autoconf
130*7f2fe78bSCy Schubert--------------
131*7f2fe78bSCy Schubert
132*7f2fe78bSCy Schubert(If you are not a developer, you can ignore this section.)
133*7f2fe78bSCy Schubert
134*7f2fe78bSCy SchubertIn the Kerberos V5 source directory, there is a configure script which
135*7f2fe78bSCy Schubertautomatically determines the compilation environment and creates the
136*7f2fe78bSCy Schubertproper Makefiles for a particular platform.  This configure script is
137*7f2fe78bSCy Schubertgenerated using autoconf, which you should already have installed if
138*7f2fe78bSCy Schubertyou will be making changes to ``src/configure.in``.
139*7f2fe78bSCy Schubert
140*7f2fe78bSCy SchubertNormal users will not need to worry about running autoconf; the
141*7f2fe78bSCy Schubertdistribution comes with the configure script already prebuilt.
142*7f2fe78bSCy Schubert
143*7f2fe78bSCy SchubertThe autoconf package comes with a script called ``autoreconf`` that
144*7f2fe78bSCy Schubertwill automatically run ``autoconf`` and ``autoheader`` as needed.  You
145*7f2fe78bSCy Schubertshould run ``autoreconf`` from the top source directory, e.g.::
146*7f2fe78bSCy Schubert
147*7f2fe78bSCy Schubert    cd /u1/krb5-VERSION/src
148*7f2fe78bSCy Schubert    autoreconf --verbose
149