xref: /original-bsd/lib/libc/db/PORT/README (revision 95ecee29)
1#	@(#)README	8.2 (Berkeley) 09/06/93
2
3This is the area for building the libdb library.  There are a number
4of porting directories, for various architecture/OS combinations.  Pick
5the one that's closest to yours and try "make".  For the rest of this
6file, I'll use "MACH" as a fake architecture/OS name.
7
8To PORT to a new system, create the following subdirectories and
9symbolic links.
10
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 local
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 ..
24
25The basic idea is that you now have a local area that you can modify.
26In particular, you have local copies of the Makefile and the include
27file compat.h.  Read through the Makefile and compat.h and make whatever
28changes are appropriate to your system.  If there's an architecture
29that's close to yours, you probably should diff the Makefile and
30compat.h in that tree against the standard ones and see what changes
31were necessary, as they're probably necessary for you as well.  Then,
32enter "make" and see what happens!
33
34There are several subroutines that are found in POSIX 1003.2, or ANSI
35C, or 4.4BSD that you may not have.  Once you get libdb.a to compile,
36go through the list of undefined routines and add entries to the MISC
37line in the Makefile as necessary.
38
39If you have to add some functions that are missing, please don't add
40them in the PORT/clib directory.  Add them in MACH/local directory,
41and add lines of the form:
42
43	function.o: local/function.o
44		${CL} -Ilocal local/function.o
45
46to your local Makefile.
47
48Hopefully, over time, we'll develop a set of system directories that
49are known to work.  If you send me the changes that were necessary
50to make your system work, this will happen much more quickly.
51
52In some of the system directories, you'll see a file named OTHER_PATCHES.
53This is a set of patches which you'll have to make from the top-level db
54directory to get libdb.a to run on this system.
55
56Some knobs you may have to turn:
57
58In include/compat.h:
59	Before attempting to build nvi, you should look through the
60	compat.h file, and adjust it as necessary for your system.
61	It's possible to use the #ifndef construct to figure out if a
62	#ifdef has been set, but C provides no similar method to figure
63	out if a typedef has been done.  Your compile errors should
64	give you a good indication of which ones you need.
65
66
67You may see warning messages about illegal pointer combinations.  Systems
68prototype malloc, calloc and realloc in different places, and the missing
69prototypes will produce such warnings.  You may also see lots of warning
70messages about #define's being redefined.  These can mostly be ignored.
71In general, I ignore all warning messages until something doesn't work.
72Some systems produce thousands of lines of completely useless warnings.
73
74The other parts of the PORT directory are as follows:
75
76	The directory PORT/clib is a set of functions that the 4.4BSD
77	C library had and which your system may not have.  They are
78	added to the MISC line of the Makefile if they aren't defined
79	when you try and load libdb.a.
80
81	The directory PORT/include is header files that the 4.4BSD
82	system had which your system may not have.  The really important
83	one is compat.h, which is a set of compatibility work-arounds
84	that you'll almost certainly have to modify for a new system.
85
86	The symbolic link PORT/sys points to the PORT/include directory
87	so that includes of the form <sys/xxx.h> work.
88
89Some of the more common portability problems:
90
91	If you don't have:
92
93		memmove(3), add memmove.o
94		mkstemp(3), add mktemp.o
95
96			... to the MISC line in the Makefile.
97
98	If realloc(3) of a NULL pointer on your system isn't the same
99	as a malloc(3) call, add realloc.o to the MISC line in the
100	Makefile.
101
102	If you don't have snprintf/vsnprintf(3), add snprintf.o to the
103	MISC line in the Makefile.  This workaround depends on your
104	system having vsprintf(3) -- if you don't, there's no workaround
105	other than changing the source code to not use the snprintf calls.
106	If you have to make that change, check to see if your vsprintf
107	returns a length or a char *; if it's the latter, make sure you
108	set VSPRINTF_CHARSTAR in the include/compat.h file.
109