add db.1.85
[nvi.git] / db.1.85 / PORT / README
blob6d47281017412fc84a4789659de525c247b171ac
1 #       @(#)README      8.6 (Berkeley) 6/20/94
3 This is the area for building the libdb library.  There are a number
4 of porting directories, for various architecture/OS combinations.  Pick
5 the one that's closest to yours and try "make".  For the rest of this
6 file, I'll use "MACH" as a fake architecture/OS name.
8 To PORT to a new system, create the following subdirectories and
9 symbolic links.
11         mkdir MACH              (for example: mkdir sunos.4.0)
12         cd MACH
13         cp ../Makefile .
14         chmod 664 Makefile
15         ln -s ../clib .
16         mkdir include
17         ln -s include sys
18         cd include
19         ln -s ../../include/*.h .
20         rm compat.h
21         cp ../../include/compat.h .
22         chmod 664 compat.h
23         cd ..
25 The basic idea is that you now have a local area that you can modify.
26 In particular, you have local copies of the Makefile and the include
27 file compat.h.  Read through the Makefile and compat.h and make whatever
28 changes are appropriate to your system.  If there's an architecture
29 that's close to yours, you probably should diff the Makefile and
30 compat.h in that tree against the standard ones and see what changes
31 were necessary, as they're probably necessary for you as well.  Then,
32 enter "make" and see what happens!
34 There are several subroutines that are found in POSIX 1003.2, ANSI
35 C, or 4.4BSD that you may not have.  Once you get libdb.a to compile,
36 go through the list of undefined routines and add entries to the MISC
37 line in the Makefile as necessary.
39 If you have to add some functions that are missing (and which aren't
40 in the PORT/clib directory), please don't add them in the PORT/clib
41 directory.  Add them in a MACH/local directory, and add lines of the
42 form:
44         function.o: local/function.o
45                 ${CL} -Ilocal local/function.o
47 to your local Makefile.
49 Hopefully, over time, we'll develop a set of system directories that
50 are known to work.  If you send me the changes that were necessary to
51 make your system work, this will happen much more quickly.
53 In some of the system directories, you'll see a file named OTHER_PATCHES.
54 This is a set of patches which you'll have to make from the top-level db
55 directory to get libdb.a to run on this system:
57         cd ..
58         patch < PORT/MACH/OTHER_PATCHES
60 If patch prompts you for the name of the file to modify (some versions
61 of patch don't figure it out on their own) use the file name which patch
62 displays.
64 Some knobs you may have to turn:
66 In include/db.h:
67         Before attempting to build libdb, you should look through the
68         db.h file, and adjust it as necessary for your system.  The
69         only adjustments that you should need to make are for the
70         fixed sized typedef's at the top of the file.  Make sure they're
71         right for your system.
73 In include/compat.h:
74         Before attempting to build libdb, you should look through the
75         compat.h file, and adjust it as necessary for your system.
76         It's possible to use the #ifndef construct to figure out if a
77         #ifdef has been set, but C provides no similar method to figure
78         out if a typedef has been done.  Your compile errors should
79         give you a good indication of which ones you need.
81 You may see warning messages about illegal pointer combinations.  You may
82 also see lots of warning messages about #define's being redefined.  These
83 can mostly be ignored.  I usually ignore warning messages until something
84 doesn't work.  Some systems produce thousands of lines of useless warnings,
85 bless their little hearts.
87 The other parts of the PORT directory are as follows:
89         The directory PORT/clib is a set of functions that the 4.4BSD
90         C library had and which your system may not have.  They are
91         added to the MISC line of the Makefile if they aren't defined
92         when you try and load libdb.a.
93         
94         The directory PORT/include is header files that the 4.4BSD
95         system had which your system may not have.  There is also
96         one really important extra one, named compat.h, which is a
97         set of compatibility work-arounds that you'll almost certainly
98         have to copy and modify for a new system.
100         The symbolic link PORT/sys points to the PORT/include directory
101         so that includes of the form <sys/include.h> work.
103 Some of the more common portability problems:
105         If you don't have:
107                 memmove(3):     add memmove.o
108                 mkstemp(3):     add mktemp.o
110                         ... to the MISC line in the Makefile.
112         If you don't have snprintf/vsnprintf(3), add snprintf.o to the
113         MISC line in the Makefile.  This workaround depends on your
114         system having vsprintf(3) -- if you don't, there's no workaround
115         other than changing the source code to not use the snprintf calls.
116         If you have to make that change, check to see if your vsprintf
117         returns a length or a char *; if it's the latter, make sure you
118         set VSPRINTF_CHARSTAR in the MACH/include/compat.h file.
120 Installing the DB library:
122         The Makefile builds a C library named libdb.a.  This file needs
123         to be installed in a place where the loader will automatically
124         look for it (or, if you're building it for a single project,
125         wherever that project's Makefile loads it from).
127         In addition, the header file PORT/include/db.h must be copied to
128         a directory (often /usr/include/) where programs that use the
129         db package can include it in their source.  (If you intend to use
130         the ndbm interface to libdb, you'll need to copy the header file
131         PORT/include/ndbm.h as well.)