Compilation instructions for Postgres95-1.01 on FreeBSD 2.1R
------------------------------------------------------------

These installation instructions are intended to provide a rough guide to
getting Postgres95 up and running under FreeBSD2.1R.

FreeBSD 2.1R ships with an old version of Lex (use the 'lex -V' command to
verify this). Postgres95 requires a newer version of GNU Flex (if you have Flex
installed, use the 'flex --version' command to identify the version).

On my 2.1R system (after installing GNU Flex) I get the following:

% which lex
/usr/bin/lex
% lex -V
lex version 2.4.7

% which flex
/usr/local/bin/flex
% flex --version
flex version 2.5.2

You must make the Postgres95 installation use your new version of Flex. If you
do not, the build process will die with an error like "Undefined symbol
yy_flush_buffer' referenced from text segment".

1. Get GNU Flex v.2.5.2 (or whatever the latest version is) via
   anonymous ftp from prep.ai.mit.edu and install in /usr/local as per
   the instructions.

2. Install GNU make package from the FreeBSD 2.1R CD-ROM.

3. Un-tar the postgres95 distribution and edit Makefile.global as per
   the instructions in INSTALL. Change the PORTNAME variable to
   'BSD44_derived'. Ensure that you've got the POSTGRESDIR variable set
   properly (if you don't, the make will die when trying to create
   obj/fe-auth.o)

4. Edit src/mk/port/postgres.mk.BSD44_derived and add the following lines:

	# FreeBSD 2.1R with new Flex v2.5.2 in /usr/local
	LEX = flex

5. Edit src/backend/port/BSD44_derived/Makefile.inc and comment out
   the LDADD line, then add the following lines:

	# FreeBSD 2.1R with new Flex lib v2.5.2 in /usr/local/lib
	LDADD+= /usr/local/lib/libfl.a
or
	# FreeBSD 2.1R with new Flex lib v2.5.2 in /usr/local/lib
	LDADD+= -L/usr/local/lib -lfl

6. Do a 'gmake clean' in the src directory to clean up any failed
   compilations from before.

7. Do a 'gmake' to build postgres95. FYI, this takes about 8 minutes on my P133
   w/32MB RAM.

8. Just to be sure everything went right, do another 'gmake'. You should
   get the following output:

	% gmake
	===> backend
	===> libpq
	===> bin
	===> monitor
	===> pg_id
	===> pg_version
	===> psql
	===> pg_dump
	===> cleardbdir
	===> createdb
	===> createuser
	===> destroydb
	===> destroyuser
	===> initdb

9. To actually install posgres95, issue the 'gmake install' command from the
   src directory and continue following the postgres95 installation
   instructions.