[postgis-users] Building with mingw32
Romi Hardiyanto
rodin at ewesewes.net
Thu May 13 04:17:42 PDT 2004
Dear David,
Apparently, didn't catch much time today. But attached is the diffs you
must applied before configure. One is for pgsql and one for postgis.The
pgsql.diff changed vacuum.h in top_srcdir/src/include/command. The
postgis.diff changed postgis.h, postgis_inout.c, and Makefile for
loader. I'll do regress later.
-----
GEOS version is 1.0.0
PROJ version is 4.4.7
PostgreSQL and PostGIS from latest CVS
-----
GEOS configure command is ./configure --prefix=/d/projects/build/geos
PROJ configure command is ./configure --prefix=/d/projects/build/proj
PostgreSQL configure command is ./configure
--prefix=/d/projects/build/pgsql --without-zlib (Yes, i didn't installed
zlib)
PostgGIS Makefile is:
# Configuration Directives
#---------------------------------------------------------------
# Set USE_PROJ to 1 for Proj4 reprojection support
#
USE_PROJ=1
ifeq (${PROJ_DIR},)
PROJ_DIR=/d/projects/build/proj
endif
#---------------------------------------------------------------
# Set USE_GEOS to 1 for GEOS spatial predicate and operator
# support
#
USE_GEOS=1
ifeq (${GEOS_DIR},)
GEOS_DIR=/d/projects/build/geos
endif
#---------------------------------------------------------------
# Set USE_STATS to 1 for new GiST statistics collection support
# Note that this support requires additional columns in
# GEOMETRY_COLUMNS, so see the list archives for info or
# install a fresh database using postgis.sql
#
USE_STATS=1
Note: if you had error initdb'ing PGDATA, you have to copy libpq.dll
from pgsql\lib to pgsql\bin directory. Many PostgreSQL executables
depends on this library so it is best to copy them to pgsql\bin location
(Actually, you can set PATH environment variable to point pgsql\bin and
pgsql\lib).
Romi H
-------------- next part --------------
--- /d/fromoutsideworld/pgsql/src/include/commands/vacuum.h Mon Feb 16 04:01:39 2004
+++ /d/projects/compile/pgsql/src/include/commands/vacuum.h Thu May 13 03:34:14 2004
@@ -122,7 +122,7 @@
} VacRUsage;
/* Default statistics target (GUC parameter) */
-extern int default_statistics_target;
+extern DLLIMPORT int default_statistics_target;
/* in commands/vacuum.c */
-------------- next part --------------
diff -Naur /d/fromoutsideworld/postgis/loader/Makefile /d/projects/compile/pgsql/contrib/postgis/loader/Makefile
--- /d/fromoutsideworld/postgis/loader/Makefile Thu Feb 5 16:07:32 2004
+++ /d/projects/compile/pgsql/contrib/postgis/loader/Makefile Thu May 13 17:46:35 2004
@@ -50,9 +50,9 @@
$(CC) $(CFLAGS) $(OBJS) shp2pgsql.o $(LDFLAGS) -o $@
install: all
- $(INSTALL_PROGRAM) pgsql2shp$(EXE) $(DESTDIR)$(bindir)/pgsql2shp$(EXE)
- $(INSTALL_PROGRAM) shp2pgsql$(EXE) $(DESTDIR)$(bindir)/shp2pgsql$(EXE)
+ $(INSTALL_PROGRAM) pgsql2shp$(X) $(DESTDIR)$(bindir)/pgsql2shp$(X)
+ $(INSTALL_PROGRAM) shp2pgsql$(X) $(DESTDIR)$(bindir)/shp2pgsql$(X)
clean:
- @rm -f $(OBJS) shp2pgsql.o pgsql2shp.o shp2pgsql$(EXE) pgsql2shp$(EXE)
+ @rm -f $(OBJS) shp2pgsql.o pgsql2shp.o shp2pgsql$(X) pgsql2shp$(X)
diff -Naur /d/fromoutsideworld/postgis/postgis.h /d/projects/compile/pgsql/contrib/postgis/postgis.h
--- /d/fromoutsideworld/postgis/postgis.h Sun Mar 28 19:42:25 2004
+++ /d/projects/compile/pgsql/contrib/postgis/postgis.h Thu May 13 17:50:37 2004
@@ -94,7 +94,7 @@
* it defines BYTE_ORDER and LITTLE_ENDIAN
*/
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(__MINGW32__)
#include <sys/param.h> // FOR ENDIAN DEFINES
#endif
@@ -669,8 +669,10 @@
// from contrib/cube/cube.c
+#if !defined(__MINGW32__)
#define max(a,b) ((a) > (b) ? (a) : (b))
#define min(a,b) ((a) <= (b) ? (a) : (b))
+#endif
#define abs(a) ((a) < (0) ? (-a) : (a))
diff -Naur /d/fromoutsideworld/postgis/postgis_inout.c /d/projects/compile/pgsql/contrib/postgis/postgis_inout.c
--- /d/fromoutsideworld/postgis/postgis_inout.c Thu Apr 29 08:49:37 2004
+++ /d/projects/compile/pgsql/contrib/postgis/postgis_inout.c Thu May 13 17:50:10 2004
@@ -1617,8 +1617,14 @@
char *last_paren;
char *current_paren;
+ //from mappostgis.c
+ #if defined(__MINGW32__)
+ first_paren= strchr (str,'(');
+ last_paren = strrchr(str,')');
+ #else
first_paren= index (str,'(');
last_paren = rindex(str,')');
+ #endif
if ( (first_paren == NULL) || (last_paren == NULL) || (first_paren >last_paren) )
{