INSTALLATION INSTRUCTIONS FOR POSTGRESQL 7.5 FOR WIN32 Build environment: mingw-3.1.0-1.exe, msys-1.0.10.exe from http://www.mingw.org ActivePerl 5.8.3-809 from http://www.activestate.com/Products/ActivePerl/ Additional installations in mingw: zlib-1.2.1 from http://www.gzip.org/zlib/ bison-1.875 from http://gnuwin32.sourceforge.net Once bison was installed, this was used to compile and install flex-2.5.4.a-1 from http://www.gnu.org/software/flex/ Setting up the environment is quite a task in itself. However once this is done, the instructions to build postgresql 7.5 with PROJ.4 and GEOS are given below: 1. Download PostgreSQL 7.5 source from CVS (see http://developer.postgresql.org/docs/postgres/cvs.html) 2. Apply Romi's "default_statistics_target" patch to the source (see http://postgis.refractions.net/pipermail/postgis-users/2004-May/004829.html or http://postgis.refractions.net/pipermail/postgis-users/2004-May/004918.html) 3. Configure PostgreSQL using: LDFLAGS=-lstdc++ ./configure --prefix=/c/pgsql75win 4. Do a "make install" 5. Download GEOS from http://geos.refractions.net. Configure GEOS using: ./configure --prefix=/c/pgsql75win 6. Do a "make install" 7. Create the DLL from libgeos.a cd /c/pgsql75win/lib g++ -shared -o libgeos.dll -Wl,--out-implib=libgeos.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive libgeos.a -Wl,--no-whole-archive /c/mingw/lib/libmingw32.a 8. Download PROJ.4 from http:///www.remotesensing.org/proj. Configure PROJ.4 using: ./configure --prefix=/c/pgsql75win 9. Do a "make install" 10. Create the DLL from libproj.a cd /c/pgsql75win/lib gcc -shared -o libproj.dll -Wl,--out-implib=libproj.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive libproj.a -Wl,--no-whole-archive /c/mingw/lib/libmingw32.a 11. Create libz.dll using a similar command to above and copy to /c/pgsql75win/lib 12. Move to the /contrib directory 13. Unpack the postgis-cvs.tar.gz and apply the "super patch" posted to mailing list (http://postgis.refractions.net/pipermail/postgis-users/2004-May/004918.html) patch -p0 < postgis_pg75.patch 14. Load up /contrib/postgis-cvs/Makefile and set the following for GEOS_DIR and PROJ_DIR: PROJ_DIR=/c/pgsql75win GEOS_DIR= Temporarily set 'USE_GEOS' to 0. 15. cd /contrib/postgis-cvs and then just do "make" 16. Capture the command line used to compile one of the files; alter it to use g++ and to produce postgis_geos_wrapper.o from postgis_geos_wrapper.cpp. Then add the -DUSE_GEOS and -I/c/pgsql75win/include/geos entries. 17. Do a "make clean" 18. Set 'USE_GEOS' to 1. 19. Execute the captured command which should look something like: g++ -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations -g -fexceptions -I. -DFRONTEND -DSYSCONFDIR='"/c/pgsql75win/etc"' -DUSE_VERSION=75 -I/c/pgsql75win/include -DUSE_PROJ -DUSE_STATS -DUSE_GEOS -I/c/pgsql75win -I../../src/include -I./src/include/port/win32 -DEXEC_BACKEND "-I../../src/include/port/win32" -c -o postgis_geos_wrapper.o postgis_geos_wrapper.cpp 20. Now compile the rest of postgis using "make" 21. When that all works, do a "make install" in /contrib for any other modules required 22. Change to the postgis-cvs directory and do a "make install". It will fail on the shp2pgsql/pgsql2shp install, so copy these files manually to c:\pgsql75win\bin 23. Remove any .a and .la files from /c/pgsql75win/lib 24. Remove the man and doc directories from /c/pgsql75win. 25. Copy spatial_ref_sys.sql, postgis.sql and postgis_undef.sql from /c/pgsql75win/share to /c/pgsql75win/share/contrib.