1This is the src tree for the second Berkeley networking distribution.
2This file is intended to be a simple, preliminary guide to finding your
3way around and compiling the programs.  We apologize that this
4distribution has so little in the way of compatibility with previous
5systems.  We had hoped that we could provide compatibility with at least
64.3BSD, but we simply did not have sufficient time to accomplished the
7task.
8
9First, there has been a major reorganization of the file system.  (You
10may have seen similar reorganizations on systems shipped by Sun
11Microsytems and Digital Equipment Corporation, among others.)  In general,
12the reorganization is as follows.  (Directories not listed are pretty much
13unchanged, i.e.  /dev is the same as always.)
14
15	/etc		configuration files (NO BINARIES)
16	/bin		binaries needed when running single-user
17	/sbin		binaries for the root user when running single-user
18
19	/var		per machine variable directories
20	/var/mail	the old /usr/spool/mail
21	/var/spool	the old /usr/spool directories
22	/var/tmp	the old /usr/tmp
23	/var/acct	the old /usr/adm
24	/var/log	log files
25	/var/crash	crash dumps
26
27	/usr/bin	the rest of the binaries
28	/usr/lib	system libraries (NO BINARIES)
29	/usr/libdata	system datafiles
30	/usr/libexec	programs executed by other programs
31	/usr/sbin	the rest of the binaries for the root user
32	/usr/share	architecture independent files
33
34The directories containing the source tree parallel the directories where
35the binaries live, i.e. the binaries for /usr/bin are in /usr/src/usr.bin,
36the files that are installed in /usr/share/misc live in
37/usr/src/share/misc, and so on.  It is our intent that the entire system
38be installed from /usr/src -- the files normally found in /etc are
39prototyped (and installed) from /usr/src/etc.  Include files are installed
40from /usr/src/include.  One exception to this is the software not
41maintained at Berkeley.  For example, the Kerberos software can be found
42in /usr/src/kerberosIV, and the ISODE software is in
43/usr/src/contrib/isode.  Manual pages are in the directories of the
44programs that they document; if they aren't directly related to a program,
45they are in /usr/src/share/man.
46
47Make has changed a lot.  It's pretty well documented, so you should read
48the man page.  All of the makefiles in /usr/src have been modified to use
49the new make features.  Your make will almost certainly not work on these
50makefiles.  However, the new make will work on your old makefiles.  If
51you only wish to install one or two programs, you may want to just create
52makefiles for them and build them by hand.  If you want to build the entire
53system, you probably want to get our make running on your system.
54
55This is done by by going to usr.bin/src/make and entering "make -f
56Makefile.dist".  This is a minimal makefile which just compiles the make
57program.  It will create a binary named pmake.  Compiling pmake on your
58system may fail.  If it does, there's probably a difference in your
59/usr/include files that make is unhappy about.  You probably want to
60figure out what the real problem is in this case.  Loading make on your
61system may also fail.  If it does, you are probably missing one or more
62routines in your C library that make needs.  Finding the correct routine
63in the lib/libc/* directories, and creating a .o for the make directory
64will probably get you around this problem.
65
66Once you have a "new" make working, you have to install the template files
67that it uses.  These files are in the directory src/share/mk.  Normally, they
68are installed in the directory /usr/share/mk.  If you wish to install them
69somewhere else, change the file pathnames.h in src/usr.bin/make to reflect
70where you plan to install them.  There's a file named bsd.README in the
71src/share/mk directory that briefly discusses how the BSD make templates
72work.  It's not necessary reading, but it might be useful.
73
74Once you have a make compiled and its template files installed, you can use
75the standard makefiles.  One other comment, most of the standard makefiles
76will attempt to build manual pages as well as the program.  This will be a
77problem, because the manual pages require roff macro packages which will not
78have been installed.  You can install these macros (see src/share/tmac),
79or use the command "make NOMAN=noman" or add NOMAN=man as part of your
80"MAKE" environmental variable when you make the BSD source to solve this
81problem.
82
83In each of the source directories you will find a symbolic link named "obj".
84This symbolic link points to somewhere in the file hierarchy /usr/obj.  For
85example, the "obj" symlink in bin/ls points to /usr/obj/bin/ls.  This is the
86way that we build multiple architectures from a single source tree.  We
87create a /usr/obj that is local to each machine which is building for an
88architecture.  Then, we remote mount the source tree (often read-only) and
89start the compile.  Make changes directory into the "obj" subdirectory, and
90builds the object files there.  (There is one real nastiness in this scheme.
91Any makefile wishing to reference a file relative to the source directory
92must use the ${.CURDIR} macro before the path name, because when make runs
93it cd's into the "obj" directory.  This *will* be corrected by 4.4BSD, but
94we haven't done it yet.)  A simple work-around is to remove the symbolic
95link obj, or make it a real sub-directory of the source directory.
96
97Now you're ready to try and build the system.  First, we haven't really done
98this (as I said before, we just ran out of time).  So don't take the following
99as a real solution, it's simply the way that we had planned to approach the
100problem.
101
102There are really two problems that you're likely to encounter.  The first
103are include files that aren't what the BSD source expects, and the second
104are C library routines that are either missing or different.  The include
105files are probably best handled by creating a directory, called, for the
106sake of discussion, bsdinclude, in the top level of the distribution
107source tree.  Add a -I include path to the CFLAGS macro in the source
108makefiles that you are trying to compile so that the compiler looks for
109its include files in bsdinclude first.  (Another way to do this, to avoid
110modifying the makefiles, is to put the -I include path into the
111environmental variable "COPTS".  This environmental variable is used by
112make.)  Then, as you encounter problems in compiling, create include files
113that fix the problem.
114
115For example, one of the changes that we've made in our release is that
116we've extracted all full path names from the source code and placed them
117either in an include file in the source directory or an include file in
118/usr/include.  Therefore, you will find a number of programs that include
119<paths.h> (the path include file for the entire system).  Since your
120system will probably not have a paths.h include file, you can install the
121BSD one in bsdinclude (modifying it as necessary) and the problem should
122go away.  However, our <utmp.h> include file has had paths added to it,
123as well, and now includes the <lastlog.h> include file as well.  To make
124this work, I'd suggest creating a utmp.h file in bsdinclude which #defines
125the paths that the BSD utmp.h include file does, but which then includes
126your standard utmp.h and lastlog.h include files.  So, the bsdinclude
127version of utmp.h might look like:
128
129	#define _PATH_UTMP      "/var/run/utmp"
130	#define _PATH_WTMP      "/var/log/wtmp"
131	#define _PATH_LASTLOG   "/var/log/lastlog"
132
133	#include "/usr/include/lastlog.h"
134	#include "/usr/include/utmp.h"
135
136I believe that this approach will make it possible to build the C library.
137Once the C library is built, install it somewhere.  As you compile
138programs you will probably find unresolved references that need to be
139satisfied using the BSD library.  I'd suggest adding the BSD library
140*after* the standard C library.  You can do this by changing the makefiles,
141or adding the string "LDADD=-lc the/bsd/library/path" to your environment.
142Note, programs that require other libraries will probably require  additional
143information in the LDADD environmental variable.
144