Преглед изворни кода

winGRASS/OSGeo4W updates (see https://trac.osgeo.org/grass/changeset/45429)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@45484 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa пре 14 година
родитељ
комит
7f41d3778e

Разлика између датотеке није приказан због своје велике величине
+ 501 - 446
configure


+ 5 - 1
configure.in

@@ -827,7 +827,11 @@ else
   fi
   fi
   
   
   LOC_CHECK_INCLUDES(geos_c.h,GEOS,$GEOS_CFLAGS)
   LOC_CHECK_INCLUDES(geos_c.h,GEOS,$GEOS_CFLAGS)
-  LOC_CHECK_LIBS(geos_c,initGEOS,GEOS,$GEOS_LIBS,GEOS_LIBS)
+  if test "$MINGW32" = yes ; then
+    LOC_CHECK_LIBS(geos_c_i,initGEOS,GEOS,$GEOS_LIBS,GEOS_LIBS)
+  else
+    LOC_CHECK_LIBS(geos_c,initGEOS,GEOS,$GEOS_LIBS,GEOS_LIBS)
+  fi
   AC_DEFINE(HAVE_GEOS)
   AC_DEFINE(HAVE_GEOS)
 fi
 fi
 
 

+ 4 - 0
general/g.region/printwindow.c

@@ -1,6 +1,10 @@
 #include <string.h>
 #include <string.h>
 #include <stdlib.h>
 #include <stdlib.h>
+
+#ifndef __MINGW32__
 #include <projects.h>
 #include <projects.h>
+#endif
+
 #include <grass/gis.h>
 #include <grass/gis.h>
 #include <grass/gprojects.h>
 #include <grass/gprojects.h>
 #include <grass/glocale.h>
 #include <grass/glocale.h>

+ 27 - 0
include/gprojects.h

@@ -105,4 +105,31 @@ int GPJ__get_ellipsoid_params(struct Key_Value *,
 			      double *, double *, double *);
 			      double *, double *, double *);
 void GPJ_free_ellps(struct gpj_ellps *);
 void GPJ_free_ellps(struct gpj_ellps *);
 
 
+
+#ifdef __MINGW32__
+/* PROJ.4's private datastructures copied from projects.h as removed
+   from osgeo4w; pending better solution. see:
+   http://trac.osgeo.org/proj/ticket/98 */
+
+typedef struct { double u, v; } LP;
+
+struct DERIVS {
+    double x_l, x_p; /* derivatives of x for lambda-phi */
+    double y_l, y_p; /* derivatives of y for lambda-phi */
+};
+
+struct FACTORS {
+	struct DERIVS der;
+	double h, k;		/* meridinal, parallel scales */
+	double omega, thetap;	/* angular distortion, theta prime */
+	double conv;		/* convergence */
+	double s;		/* areal scale factor */
+	double a, b;		/* max-min scale error */
+	int code;		/* info as to analytics, see following */
+};
+
+int pj_factors(LP, void *, double, struct FACTORS *);
+/* end of copy */
+#endif
+
 #endif
 #endif

+ 1 - 0
include/proto_dbmi.h

@@ -132,6 +132,7 @@ int db_commit_transaction(dbDriver * driver);
 int db_fetch(dbCursor * cursor, int position, int *more);
 int db_fetch(dbCursor * cursor, int position, int *more);
 int db_find_database(dbDriver * driver, dbHandle * handle, int *found);
 int db_find_database(dbDriver * driver, dbHandle * handle, int *found);
 dbAddress db_find_token(dbToken token);
 dbAddress db_find_token(dbToken token);
+void *db_free(void *s);
 void db_free_column(dbColumn * column);
 void db_free_column(dbColumn * column);
 void db_free_cursor(dbCursor * cursor);
 void db_free_cursor(dbCursor * cursor);
 void db_free_cursor_column_flags(dbCursor * cursor);
 void db_free_cursor_column_flags(dbCursor * cursor);

+ 11 - 0
lib/db/dbmi_base/alloc.c

@@ -74,3 +74,14 @@ void *db_realloc(void *s, int n)
 	db_memory_error();
 	db_memory_error();
     return s;
     return s;
 }
 }
+
+/*!
+   \fn void *db_free (void *s)
+   \brief 
+   \return 
+   \param 
+ */
+void *db_free(void *s)
+{
+    free(s);
+}

+ 1 - 1
lib/db/dbmi_base/cursor.c

@@ -299,7 +299,7 @@ int db_alloc_cursor_column_flags(dbCursor *cursor)
 void db_free_cursor_column_flags(dbCursor *cursor)
 void db_free_cursor_column_flags(dbCursor *cursor)
 {
 {
     if (cursor->column_flags)
     if (cursor->column_flags)
-	free(cursor->column_flags);
+	db_free(cursor->column_flags);
     cursor->column_flags = NULL;
     cursor->column_flags = NULL;
 }
 }
 
 

+ 1 - 1
lib/db/dbmi_base/dbmscap.c

@@ -244,6 +244,6 @@ void db_free_dbmscap(dbDbmscap * list)
 
 
     for (cur = list; cur; cur = next) {
     for (cur = list; cur; cur = next) {
 	next = cur->next;
 	next = cur->next;
-	free(cur);
+	db_free(cur);
     }
     }
 }
 }

+ 2 - 2
lib/db/dbmi_base/dirent.c

@@ -85,7 +85,7 @@ dbDirent *db_dirent(const char *dirname, int *n)
 	dirent[i].isdir = (db_isdir(path) == DB_OK);
 	dirent[i].isdir = (db_isdir(path) == DB_OK);
     }
     }
     closedir(dp);
     closedir(dp);
-    free(path);
+    db_free(path);
 
 
     sort_dirent(dirent, *n);
     sort_dirent(dirent, *n);
 
 
@@ -105,7 +105,7 @@ void db_free_dirent_array(dbDirent * dirent, int count)
     if (dirent) {
     if (dirent) {
 	for (i = 0; i < count; i++)
 	for (i = 0; i < count; i++)
 	    db_free_string(&dirent[i].name);
 	    db_free_string(&dirent[i].name);
-	free(dirent);
+	db_free(dirent);
     }
     }
 }
 }
 
 

+ 2 - 2
lib/db/dbmi_base/error.c

@@ -33,7 +33,7 @@ void db_on_error(void (*f) (const char *))
 void db_set_error_who(const char *me)
 void db_set_error_who(const char *me)
 {
 {
     if (who)
     if (who)
-	free(who);
+	db_free_string(who);
     who = db_store(me);
     who = db_store(me);
 }
 }
 
 
@@ -59,7 +59,7 @@ void db_error(const char *s)
     if (s == NULL)
     if (s == NULL)
 	s = "<NULL error message>";
 	s = "<NULL error message>";
     if (err_msg)
     if (err_msg)
-	free(err_msg);
+	db_free_string(err_msg);
     err_msg = db_store(s);
     err_msg = db_store(s);
     err_flag = 1;
     err_flag = 1;
     if (auto_print_errors)
     if (auto_print_errors)

+ 1 - 1
lib/db/dbmi_base/handle.c

@@ -95,7 +95,7 @@ void db_free_handle_array(dbHandle * handle, int count)
     if (handle) {
     if (handle) {
 	for (i = 0; i < count; i++)
 	for (i = 0; i < count; i++)
 	    db_free_handle(&handle[i]);
 	    db_free_handle(&handle[i]);
-	G_free((void *) handle);
+	db_free((void *) handle);
     }
     }
 }
 }
 
 

+ 1 - 1
lib/db/dbmi_base/index.c

@@ -80,7 +80,7 @@ void db_free_index_array(dbIndex * list, int count)
     if (list) {
     if (list) {
 	for (i = 0; i < count; i++)
 	for (i = 0; i < count; i++)
 	    db_free_index(&list[i]);
 	    db_free_index(&list[i]);
-	free(list);
+	db_free(list);
     }
     }
 }
 }
 
 

+ 2 - 2
lib/db/dbmi_base/string.c

@@ -150,7 +150,7 @@ char *db_get_string(const dbString * x)
 void db_free_string(dbString * x)
 void db_free_string(dbString * x)
 {
 {
     if (x->nalloc > 0)
     if (x->nalloc > 0)
-	G_free(x->string);
+	db_free(x->string);
     db_init_string(x);
     db_init_string(x);
 }
 }
 
 
@@ -167,7 +167,7 @@ void db_free_string_array(dbString *a, int n)
     if (a) {
     if (a) {
 	for (i = 0; i < n; i++)
 	for (i = 0; i < n; i++)
 	    db_free_string(&a[i]);
 	    db_free_string(&a[i]);
-	G_free(a);
+	db_free(a);
     }
     }
 }
 }
 
 

+ 3 - 3
lib/db/dbmi_base/table.c

@@ -21,7 +21,7 @@ dbTable *db_alloc_table(int ncols)
 
 
     table->columns = (dbColumn *) db_calloc(sizeof(dbColumn), ncols);
     table->columns = (dbColumn *) db_calloc(sizeof(dbColumn), ncols);
     if (table->columns == NULL) {
     if (table->columns == NULL) {
-	free(table);
+	db_free(table);
 	return (table = NULL);
 	return (table = NULL);
     }
     }
     table->numColumns = ncols;
     table->numColumns = ncols;
@@ -54,8 +54,8 @@ void db_free_table(dbTable * table)
     for (i = 0; i < table->numColumns; i++)
     for (i = 0; i < table->numColumns; i++)
 	db_free_column(&table->columns[i]);
 	db_free_column(&table->columns[i]);
     if (table->columns)
     if (table->columns)
-	free(table->columns);
-    free(table);
+	db_free(table->columns);
+    db_free(table);
 }
 }
 
 
 /*!
 /*!

+ 3 - 3
lib/db/dbmi_base/value.c

@@ -353,15 +353,15 @@ void db_CatValArray_free(dbCatValArray * arr)
 	for (i = 0; i < arr->n_values; i++) {
 	for (i = 0; i < arr->n_values; i++) {
 	    if (arr->ctype == DB_C_TYPE_STRING && arr->value[i].val.s) {
 	    if (arr->ctype == DB_C_TYPE_STRING && arr->value[i].val.s) {
 		db_free_string(arr->value[i].val.s);
 		db_free_string(arr->value[i].val.s);
-		free(arr->value[i].val.s);
+		db_free(arr->value[i].val.s);
 	    }
 	    }
 	    if (arr->ctype == DB_C_TYPE_DATETIME && arr->value[i].val.t) {
 	    if (arr->ctype == DB_C_TYPE_DATETIME && arr->value[i].val.t) {
-		free(arr->value[i].val.t);
+		db_free(arr->value[i].val.t);
 	    }
 	    }
 	}
 	}
     }
     }
 
 
-    free(arr->value);
+    G_free(arr->value);
 }
 }
 
 
 /*!
 /*!

+ 1 - 1
lib/db/dbmi_client/copy_tab.c

@@ -374,7 +374,7 @@ int db__copy_table(const char *from_drvname, const char *from_dbname,
 	}
 	}
     }
     }
     if (selcol)
     if (selcol)
-	free(ivalues);
+	G_free(ivalues);
     G_debug(3, "Table copy OK");
     G_debug(3, "Table copy OK");
 
 
     db_close_cursor(&cursor);
     db_close_cursor(&cursor);

+ 1 - 1
lib/db/dbmi_client/shutdown.c

@@ -70,7 +70,7 @@ int db_shutdown_driver(dbDriver * driver)
     driver->pid = 0;
     driver->pid = 0;
 
 
     /* free the driver structure. THIS IS GOOFY */
     /* free the driver structure. THIS IS GOOFY */
-    free(driver);
+    db_free(driver);
 
 
     return status;
     return status;
 }
 }

+ 1 - 1
lib/db/dbmi_driver/d_close_cur.c

@@ -44,7 +44,7 @@ int db_d_close_cursor(void)
     db_drop_token(token);
     db_drop_token(token);
     db_free_cursor(cursor);
     db_free_cursor(cursor);
     db__drop_cursor_from_driver_state(cursor);
     db__drop_cursor_from_driver_state(cursor);
-    free(cursor);
+    db_free(cursor);
 
 
     /* send the return code */
     /* send the return code */
     if (stat != DB_OK) {
     if (stat != DB_OK) {

+ 3 - 3
lib/db/dbmi_driver/driver_state.c

@@ -66,8 +66,8 @@ void db__mark_database_open(const char *dbname, const char *dbschema)
 */
 */
 void db__mark_database_closed(void)
 void db__mark_database_closed(void)
 {
 {
-    free(state.dbname);
-    free(state.dbschema);
+    db_free_string(state.dbname);
+    db_free_string(state.dbschema);
     state.open = 0;
     state.open = 0;
 }
 }
 
 
@@ -128,7 +128,7 @@ void db__close_all_cursors(void)
 	    db_driver_close_cursor(state.cursor_list[i]);
 	    db_driver_close_cursor(state.cursor_list[i]);
 
 
     if (state.cursor_list)
     if (state.cursor_list)
-	free(state.cursor_list);
+	db_free(state.cursor_list);
 
 
     state.ncursors = 0;
     state.ncursors = 0;
     state.cursor_list = NULL;
     state.cursor_list = NULL;

+ 3 - 1
lib/db/dbmilib.dox

@@ -269,7 +269,9 @@ void #db_calloc (int n, int m)
 
 
 void #db_malloc (int n)
 void #db_malloc (int n)
 
 
-void #db_realloc (void s, int n)
+void #db_realloc (void *s, int n)
+
+void #db_free (void *s, int n)
 
 
 
 
 \subsection DB_case_routines DB case routines
 \subsection DB_case_routines DB case routines

+ 1 - 1
lib/g3d/g3dcache.c

@@ -121,7 +121,7 @@ static int cacheWrite_readFun(int tileIndex, void *tileBuf, void *closure)
 	return 0;
 	return 0;
     }
     }
 
 
-    index = *((int *)(xdr + nBytes));
+    index = *((int *)((unsigned char *)xdr + nBytes));
     map->index[index] = -pos - 2;
     map->index[index] = -pos - 2;
 
 
     map->cachePosLast--;
     map->cachePosLast--;

+ 10 - 1
lib/proj/Makefile

@@ -2,6 +2,10 @@ MODULE_TOPDIR = ../..
 
 
 LIB = GPROJ
 LIB = GPROJ
 
 
+include $(MODULE_TOPDIR)/include/Make/Vars.make
+
+MOD_OBJS := $(filter-out ftol.o,$(AUTO_OBJS))
+
 include $(MODULE_TOPDIR)/include/Make/Lib.make 
 include $(MODULE_TOPDIR)/include/Make/Lib.make 
 include $(MODULE_TOPDIR)/include/Make/Doxygen.make
 include $(MODULE_TOPDIR)/include/Make/Doxygen.make
 
 
@@ -27,9 +31,14 @@ NAD_SRCFILES := $(patsubst %.lla,$(NAD_SRCDIR)/%.lla,$(NAD_TABLES))
 PROJ_TABLES := proj-desc.table proj-parms.table proj-units.table
 PROJ_TABLES := proj-desc.table proj-parms.table proj-units.table
 PROJ_DSTFILES := $(patsubst %,$(ETC)/%,$(PROJ_TABLES))
 PROJ_DSTFILES := $(patsubst %,$(ETC)/%,$(PROJ_TABLES))
 
 
-default: lib
+default: lib $(FTOL_OBJ)
 	$(MAKE) $(NAD_DSTFILES) $(CSV_DSTFILES) $(PROJ_DSTFILES) $(NAD_SRCFILES)
 	$(MAKE) $(NAD_DSTFILES) $(CSV_DSTFILES) $(PROJ_DSTFILES) $(NAD_SRCFILES)
 
 
+ifdef MINGW
+$(FTOL_OBJ): $(OBJDIR)/ftol.o
+	$(INSTALL) $< $@
+endif
+
 $(NAD_DSTFILES): $(NAD_DIR)/%: %.lla | $(NAD_DIR)
 $(NAD_DSTFILES): $(NAD_DIR)/%: %.lla | $(NAD_DIR)
 	$(NAD2BIN) < $< $@
 	$(NAD2BIN) < $< $@
 
 

+ 2 - 0
lib/proj/ftol.c

@@ -0,0 +1,2 @@
+long _ftol(double);
+long _ftol2(double x) { return _ftol(x); }

+ 1 - 1
mswindows/osgeo4w/config.h.vc

@@ -162,7 +162,7 @@
 #define HAVE_PQCMDTUPLES 1
 #define HAVE_PQCMDTUPLES 1
 
 
 /* define if ODBC exists */
 /* define if ODBC exists */
-/* #undef HAVE_SQL_H */
+#define HAVE_SQL_H 1
 
 
 /* define if tiffio.h exists */
 /* define if tiffio.h exists */
 #define HAVE_TIFFIO_H 1
 #define HAVE_TIFFIO_H 1

+ 0 - 261
mswindows/osgeo4w/gdal-1.6.diff

@@ -1,261 +0,0 @@
-Index: nmake.opt
-===================================================================
---- nmake.opt	(revision 17458)
-+++ nmake.opt	(working copy)
-@@ -22,8 +22,8 @@
- # 1200 = 6.0
- #
- !IFNDEF MSVC_VER
--#assume msvc 7.1
--MSVC_VER=1310
-+#assume msvc 9.0
-+MSVC_VER=1500
- !ENDIF
- 
- ###############################################################################
-@@ -39,11 +39,11 @@
- # But the paths *should* be absolute (relative paths mess up in submakefiles).
- 
- !IFNDEF GDAL_HOME
--GDAL_HOME = "C:\warmerda\bld"
-+GDAL_HOME = $(OSGEO4W_ROOT)
- !ENDIF
- BINDIR = $(GDAL_HOME)\bin
- PLUGINDIR = $(BINDIR)\gdalplugins
--PY_INST_DIR = $(GDAL_HOME)\pymod
-+PY_INST_DIR = $(GDAL_HOME)\apps\Python25\lib\site-packages
- LIBDIR = $(GDAL_HOME)\lib
- INCDIR = $(GDAL_HOME)\include
- DATADIR = $(GDAL_HOME)\data
-@@ -52,7 +52,7 @@
- # Set this to the installed directory containing python.  If you don't
- # have python just let it point to a directory that does not exist (as now).
- !IFNDEF PYDIR 
--PYDIR   =	"C:\Software\Python24"
-+PYDIR = $(OSGEO4W_ROOT)\apps\Python25
- !ENDIF
- 
- # Set the location of your SWIG installation
-@@ -77,7 +77,7 @@
- !IFNDEF OPTFLAGS
- !IF $(MSVC_VER) >= 1400
- !IFNDEF DEBUG
--OPTFLAGS= /nologo /MD /EHsc /Ox /W3 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG
-+OPTFLAGS= /nologo /MD /EHsc /Zi /Ox /W3 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG /Fd$(GDAL_ROOT)\gdal$(VERSION).pdb
- !ELSE
- OPTFLAGS= /nologo /MD /EHsc /Zi /W4 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /Fd$(GDAL_ROOT)\gdal$(VERSION).pdb
- !ENDIF
-Index: ogr/ogrsf_frmts/grass/ogrgrassdatasource.cpp
-===================================================================
---- ogr/ogrsf_frmts/grass/ogrgrassdatasource.cpp	(revision 17458)
-+++ ogr/ogrsf_frmts/grass/ogrgrassdatasource.cpp	(working copy)
-@@ -31,6 +31,10 @@
- #include "cpl_conv.h"
- #include "cpl_string.h"
- 
-+#ifdef WIN32
-+#include <fcntl.h>
-+#endif
-+
- CPL_CVSID("$Id$");
- 
- /************************************************************************/
-@@ -187,6 +191,9 @@
- /* -------------------------------------------------------------------- */
-     Vect_set_fatal_error ( GV_FATAL_PRINT ); // Print error and continue
-     Vect_set_open_level (2);
-+#ifdef WIN32
-+    _set_fmode(_O_BINARY);
-+#endif
-     int level = Vect_open_old ( &map, pszMap, pszMapset);
- 
-     if ( level < 2 ) {
-Index: ogr/ogrsf_frmts/grass/makefile.vc
-===================================================================
---- ogr/ogrsf_frmts/grass/makefile.vc	(revision 0)
-+++ ogr/ogrsf_frmts/grass/makefile.vc	(revision 0)
-@@ -0,0 +1,33 @@
-+GRASS_BASE     = $(OSGEO4W_ROOT)\apps\grass\grass-$(GRASS_VERSION)
-+SRC            = ogrgrassdriver.cpp ogrgrassdatasource.cpp ogrgrasslayer.obj
-+OBJ            = ogrgrassdriver.obj ogrgrassdatasource.obj ogrgrasslayer.obj
-+PLUGIN_DLL     = ogr_GRASS.dll
-+CFLAGS         = /nologo /MD /EHsc /Od /Zi /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /DNDEBUG \
-+                       -I $(OSGEO4W_ROOT)/apps/gdal-16/include \
-+                       -I $(OSGEO4W_ROOT)/include -I $(GRASS_BASE)/include \
-+                       -D GRASS_GISBASE=\"$(OSGEO4W_ROOT)\\apps\\grass\\grass-$(GRASS_VERSION)\"
-+GRASS_LIBS     = /LIBPATH:$(GRASS_BASE)/lib $(OSGEO4W_ROOT)/apps/gdal-16/lib/gdal_i.lib grass_gis.lib grass_vect.lib grass_dbmibase.lib grass_dbmiclient.lib grass_gproj.lib
-+PLUGIN_DIR     = $(OSGEO4W_ROOT)\apps\gdal-16\bin\gdalplugins
-+
-+#GRASS_LIBS    = /LIBPATH:$(GRASS_BASE)/lib /LIBPATH:$(OSGEO4W_ROOT)/lib gdal_i.lib grass_gis.lib grass_vect.lib grass_dbmibase.lib grass_dbmiclient.lib grass_gproj.lib
-+#PLUGIN_DIR    = $(OSGEO4W_ROOT)\bin\gdalplugins
-+
-+plugin: $(PLUGIN_DLL)
-+
-+$(PLUGIN_DLL): $(OBJ)
-+       link /debug /dll $(LDEBUG) /out:$(PLUGIN_DLL) $(OBJ) $(GDALLIB) $(GRASS_LIBS)
-+       if exist $(PLUGIN_DLL).manifest mt -manifest $(PLUGIN_DLL).manifest -outputresource:$(PLUGIN_DLL);2
-+       xcopy $(PLUGIN_DLL) $(PLUGIN_DIR) /y
-+
-+.cpp.obj:      
-+       $(CC) $(CFLAGS) /c $*.cpp
-+
-+default:       $(OBJ)
-+       xcopy /D  /Y *.obj ..\o
-+
-+clean:
-+       -del *.obj
-+
-+plugin-install: $(PLUGIN_DLL)
-+       -mkdir $(PLUGINDIR)
-+       $(INSTALL) $(PLUGIN_DLL) $(PLUGINDIR)
-Index: ogr/ogrfeature.cpp
-===================================================================
---- ogr/ogrfeature.cpp	(revision 17458)
-+++ ogr/ogrfeature.cpp	(working copy)
-@@ -976,8 +976,7 @@
- const char *OGRFeature::GetFieldAsString( int iField )
- 
- {
--#define TEMP_BUFFER_SIZE 80
--    char         szTempBuffer[TEMP_BUFFER_SIZE];
-+    char szTempBufferSize[80];
- 
-     CPLFree(m_pszTmpFieldValue);
-     m_pszTmpFieldValue = NULL;            
-@@ -989,7 +988,7 @@
-         switch (iSpecialField)
-         {
-           case SPF_FID:
--            snprintf( szTempBuffer, TEMP_BUFFER_SIZE, "%ld", GetFID() );
-+            snprintf( szTempBuffer, sizeof szTempBufferSize, "%ld", GetFID() );
-             return m_pszTmpFieldValue = CPLStrdup( szTempBuffer );
- 
-           case SPF_OGR_GEOMETRY:
-@@ -1038,7 +1037,7 @@
-     }
-     else if( poFDefn->GetType() == OFTInteger )
-     {
--        snprintf( szTempBuffer, TEMP_BUFFER_SIZE,
-+        snprintf( szTempBuffer, sizeof szTempBufferSize,
-                   "%d", pauFields[iField].Integer );
-         return m_pszTmpFieldValue = CPLStrdup( szTempBuffer );
-     }
-@@ -1054,14 +1053,14 @@
-         else
-             strcpy( szFormat, "%.15g" );
-         
--        snprintf( szTempBuffer, TEMP_BUFFER_SIZE,
-+        snprintf( szTempBuffer, sizeof szTempBufferSize,
-                   szFormat, pauFields[iField].Real );
-         
-         return m_pszTmpFieldValue = CPLStrdup( szTempBuffer );
-     }
-     else if( poFDefn->GetType() == OFTDateTime )
-     {
--        snprintf( szTempBuffer, TEMP_BUFFER_SIZE,
-+        snprintf( szTempBuffer, sizeof szTempBufferSize,
-                   "%04d/%02d/%02d %2d:%02d:%02d", 
-                   pauFields[iField].Date.Year,
-                   pauFields[iField].Date.Month,
-@@ -1086,17 +1085,17 @@
- 
-             if( nMinutes == 0 )
-                 snprintf( szTempBuffer+strlen(szTempBuffer), 
--                          TEMP_BUFFER_SIZE-strlen(szTempBuffer), "%02d", nHours );
-+                          sizeof szTempBufferSize-strlen(szTempBuffer), "%02d", nHours );
-             else
-                 snprintf( szTempBuffer+strlen(szTempBuffer), 
--                          TEMP_BUFFER_SIZE-strlen(szTempBuffer), "%02d%02d", nHours, nMinutes );
-+                          sizeof szTempBufferSize-strlen(szTempBuffer), "%02d%02d", nHours, nMinutes );
-         }
- 
-         return m_pszTmpFieldValue = CPLStrdup( szTempBuffer );
-     }
-     else if( poFDefn->GetType() == OFTDate )
-     {
--        snprintf( szTempBuffer, TEMP_BUFFER_SIZE, "%04d/%02d/%02d",
-+        snprintf( szTempBuffer, sizeof szTempBufferSize, "%04d/%02d/%02d",
-                   pauFields[iField].Date.Year,
-                   pauFields[iField].Date.Month,
-                   pauFields[iField].Date.Day );
-@@ -1105,7 +1104,7 @@
-     }
-     else if( poFDefn->GetType() == OFTTime )
-     {
--        snprintf( szTempBuffer, TEMP_BUFFER_SIZE, "%2d:%02d:%02d", 
-+        snprintf( szTempBuffer, sizeof szTempBufferSize, "%2d:%02d:%02d", 
-                   pauFields[iField].Date.Hour,
-                   pauFields[iField].Date.Minute,
-                   pauFields[iField].Date.Second );
-@@ -1117,7 +1116,7 @@
-         char    szItem[32];
-         int     i, nCount = pauFields[iField].IntegerList.nCount;
- 
--        snprintf( szTempBuffer, TEMP_BUFFER_SIZE, "(%d:", nCount );
-+        snprintf( szTempBuffer, sizeof szTempBufferSize, "(%d:", nCount );
-         for( i = 0; i < nCount; i++ )
-         {
-             snprintf( szItem, sizeof(szItem), "%d",
-@@ -1155,7 +1154,7 @@
-         else
-             strcpy( szFormat, "%.16g" );
-         
--        snprintf( szTempBuffer, TEMP_BUFFER_SIZE, "(%d:", nCount );
-+        snprintf( szTempBuffer, sizeof szTempBufferSize, "(%d:", nCount );
-         for( i = 0; i < nCount; i++ )
-         {
-             snprintf( szItem, sizeof(szItem), szFormat,
-@@ -1183,7 +1182,7 @@
-     {
-         int     i, nCount = pauFields[iField].StringList.nCount;
- 
--        snprintf( szTempBuffer, TEMP_BUFFER_SIZE, "(%d:", nCount );
-+        snprintf( szTempBuffer, sizeof szTempBufferSize, "(%d:", nCount );
-         for( i = 0; i < nCount; i++ )
-         {
-             const char  *pszItem = pauFields[iField].StringList.paList[i];
-@@ -1228,7 +1227,6 @@
-     }
-     else
-         return "";
--#undef TEMP_BUFFER_SIZE
- }
- 
- /************************************************************************/
-Index: frmts/grass/makefile.vc
-===================================================================
---- frmts/grass/makefile.vc	(revision 0)
-+++ frmts/grass/makefile.vc	(revision 0)
-@@ -0,0 +1,32 @@
-+SRC            = grass57dataset.cpp
-+OBJ            = grass57dataset.obj
-+PLUGIN_DLL     = gdal_GRASS.dll
-+LDEBUG         = /debug 
-+
-+CFLAGS         = -I $(OSGEO4W_ROOT)\apps\grass\grass-$(GRASS_VERSION)\include -I $(OSGEO4W_ROOT)\apps\gdal-16\include -I $(OSGEO4W_ROOT)\include /MD /EHsc
-+GRASS_LIBS     = /LIBPATH:$(OSGEO4W_ROOT)\apps\grass\grass-$(GRASS_VERSION)\lib $(OSGEO4W_ROOT)\apps\gdal-16\lib\gdal_i.lib grass_gis.lib grass_i.lib grass_gproj.lib
-+PLUGINDIR      = $(OSGEO4W_ROOT)\apps\gdal-16\bin\gdalplugins
-+
-+#CFLAGS        = -I $(OSGEO4W_ROOT)\include -I $(OSGEO4W_ROOT)\apps\grass\grass-$(GRASS_VERSION)\include /MD /EHsc /Od /Zi /DNDEBUG /Fdgdal_GRASS.pdb
-+#GRASS_LIBS    = /LIBPATH:c:/OSGeo4W/apps/grass/grass-$(GRASS_VERSION)/lib /LIBPATH:C:/OSGeo4W/lib gdal_i.lib grass_gis.lib grass_i.lib grass_gproj.lib
-+#PLUGINDIR     = $(OSGEO4W_ROOT)\bin\gdalplugins
-+
-+plugin: $(PLUGIN_DLL)
-+
-+$(PLUGIN_DLL): $(OBJ)
-+	link /dll $(LDEBUG) /out:$(PLUGIN_DLL) $(OBJ) $(GDALLIB) $(GRASS_LIBS)
-+	if exist $(PLUGIN_DLL).manifest mt -manifest $(PLUGIN_DLL).manifest -outputresource:$(PLUGIN_DLL);2
-+	xcopy $(PLUGIN_DLL) $(PLUGINDIR) /y
-+
-+$(OBJ): $(SRC)
-+	$(CC) $(CFLAGS) /c $(SRC)
-+
-+default:       $(OBJ)
-+	xcopy /D  /Y *.obj ..\o
-+
-+clean:
-+       -del *.obj *.manifest *.dll *.lib *.exp *.pdb
-+
-+plugin-install: $(PLUGIN_DLL)
-+       -mkdir $(PLUGINDIR)
-+       $(INSTALL) $(PLUGIN_DLL) $(PLUGINDIR)

+ 64 - 0
mswindows/osgeo4w/gdal-config

@@ -0,0 +1,64 @@
+#!/bin/sh
+
+
+CONFIG_LIBS="$OSGEO4W_ROOT_MSYS/lib/gdal_i.lib"
+CONFIG_DEP_LIBS="$OSGEO4W_ROOT_MSYS/lib/libpng13.lib $OSGEO4W_ROOT_MSYS/lib/zlib.lib"
+CONFIG_PREFIX="$OSGEO4W_ROOT_MSYS"
+CONFIG_CFLAGS="-I$OSGEO4W_ROOT_MSYS/include"
+CONFIG_VERSION="1.8.0"
+CONFIG_OGR_ENABLED=yes
+CONFIG_FORMATS="gxf gtiff hfa aigrid aaigrid ceos ceos2 iso8211 xpm sdts raw dted mem jdem envisat elas fit vrt usgsdem l1b nitf bmp pcidsk airsar rs2 ilwis rmf rik leveller sgi idrisi bsb gif jpeg png pcraster "
+usage()
+{
+	cat <<EOF
+Usage: gdal-config [OPTIONS]
+Options:
+	[--prefix[=DIR]]
+	[--libs]
+	[--dep-libs]
+	[--cflags]
+	[--version]
+	[--ogr-enabled]
+	[--formats]
+EOF
+	exit $1
+}
+
+if test $# -eq 0; then
+	usage 1 1>&2
+fi
+
+case $1 in 
+  --libs)
+    echo $CONFIG_LIBS
+    ;;
+
+  --dep-libs)
+    echo $CONFIG_DEP_LIBS
+    ;;
+
+  --cflags)
+    echo $CONFIG_CFLAGS
+    ;;
+
+  --prefix)
+    echo $CONFIG_PREFIX
+    ;;
+
+  --version)
+    echo $CONFIG_VERSION
+    ;;
+
+  --ogr-enabled)
+    echo $CONFIG_OGR_ENABLED
+    ;;
+
+  --formats)
+    echo $CONFIG_FORMATS
+    ;;
+
+  *)
+    usage 1 1>&2
+    ;;
+
+esac

+ 0 - 33
mswindows/osgeo4w/gdalplugins.cmd

@@ -1,33 +0,0 @@
-path %SYSTEMROOT%\system32;%SYSTEMROOT%;%SYSTEMROOT%\System32\Wbem
-
-set VS90COMNTOOLS=%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\Tools\
-call "%PROGRAMFILES%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
-set OSGEO4W_ROOT=%PROGRAMFILES%\OSGeo4W
-set P=%PATH%
-call "%OSGEO4W_ROOT%"\bin\o4w_env.bat
-path %P%;%OSGEO4W_ROOT%\bin
-
-set VERSION=1.6.0
-set PACKAGE=1
-
-set P=%CD%
-
-echo OGR: %DATE% %TIME%
-cd ..\gdal-1.6\ogr\ogrsf_frmts\grass
-nmake /f makefile.vc clean
-nmake /f makefile.vc GRASS_VERSION=%1 plugin
-
-echo GDAL: %DATE% %TIME%
-cd ..\..\..\frmts\grass
-nmake /f makefile.vc clean
-nmake /f makefile.vc GRASS_VERSION=%1 plugin
-
-cd %P%
-
-mkdir package\gdal16-grass
-tar -C %OSGEO4W_ROOT% -cjf package/gdal16-grass-%VERSION%-%PACKAGE%.tar.bz2 ^
-	apps/gdal-16/bin/gdalplugins/ogr_GRASS.dll ^
-	apps/gdal-16/bin/gdalplugins/gdal_GRASS.dll
-
-:end
-echo END: %DATE% %TIME%

+ 55 - 0
mswindows/osgeo4w/geos-config

@@ -0,0 +1,55 @@
+#!/bin/sh
+
+usage()
+{
+    cat <<EOF
+Usage: geos-config [OPTIONS]
+Options:
+     [--prefix]
+     [--version]
+     [--libs]
+     [--cflags]
+     [--ldflags]
+     [--includes]
+     [--jtsport]
+EOF
+    exit $1
+}
+if test $# -eq 0; then
+  usage 1 1>&2
+fi
+while test $# -gt 0; do
+case "$1" in
+    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+    *) optarg= ;;
+esac
+case $1 in
+    --prefix)
+    echo $OSGEO4W_ROOT_MSYS
+     ;;
+    --version)
+    echo 3.2.2
+     ;;
+    --cflags)
+    echo -I$OSGEO4W_ROOT_MSYS/include
+      ;;
+    --libs)
+      echo $OSGEO4W_ROOT_MSYS/lib/geos_c_i.lib
+      ;;
+    --ldflags)
+      echo 
+      ;;
+    --includes)
+      echo $OSGEO4W_ROOT_MSYS/include
+      ;;
+    --jtsport)
+    echo 1.10.0 
+      ;;
+    *)
+      usage 1 1>&2
+      ;;
+  esac
+  shift
+done
+
+

+ 146 - 44
mswindows/osgeo4w/package.sh

@@ -1,65 +1,115 @@
 #!/c/OSGeo4W/apps/msys/bin/sh
 #!/c/OSGeo4W/apps/msys/bin/sh
 
 
-###set -e
+set -e
+
+PWD="$(pwd)"
 
 
 if ! [ -d mswindows ]; then
 if ! [ -d mswindows ]; then
 	echo Start from GRASS toplevel dir
 	echo Start from GRASS toplevel dir
 	exit 1
 	exit 1
 fi
 fi
 
 
-OSGEO4W_ROOT_MSYS=/c/OSGeo4W
-PATH=.:/c/mingw/bin:/usr/local/bin:/bin:$OSGEO4W_ROOT_MSYS/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem
-export OSGEO4W_ROOT_MSYS PATH
-
-version() {
-	(
-		read MAJOR
-		read MINOR
-		read PATCH
-		echo $MAJOR.$MINOR.$PATCH
-	) < include/VERSION
+if ! [ -d /tmp ]; then 
+    mkdir /tmp 
+    if ! [ -d /tmp ]; then 
+ 	echo /tmp does not exists 
+ 	exit 1 
+    fi 
+fi 
+
+export PACKAGE=${1:-1} 
+export POSTFIX=$2 
+export OSGEO4W_ROOT_MSYS=/c/OSGeo4W
+export PATH=.:/c/mingw/bin:/usr/local/bin:/bin:$OSGEO4W_ROOT_MSYS/bin:/c/WINDOWS/system32:/c/WINDOWS:/c/WINDOWS/System32/Wbem:/c/Subversion:$PWD/mswindows/osgeo4w
+
+T0=$(date +%s) 
+LT=$T0 
+CS="" 
+
+log() { 
+    local D T 
+    NOW=$(date) 
+    T=$(date +%s) 
+    
+    if [ -n "$CS" ]; then 
+        local D H M S 
+ 	(( S=T-$LT )) 
+ 	(( M=S/60 )); (( S=S%60 )) 
+ 	(( H=M/60 )); (( M=M%60 )) 
+ 	(( D=H/24 )); (( H=H%24 )) 
+ 	
+ 	echo -n "$NOW: FINISHED $CS AFTER " 
+ 	(( D>0 )) && echo -n "${D}d" 
+ 	(( H>0 )) && echo -n "${H}h" 
+ 	(( M>0 )) && echo -n "${M}m" 
+ 	echo "${S}s" 
+    fi 
+    
+    CS="$@" 
+    LT=$T 
+    if [ -n "$CS" ]; then 
+        echo $NOW: STARTING $CS 
+    elif [ -n "$T0" ]; then 
+ 	CS="COMPLETE RUN" 
+ 	LT=$T0 
+ 	T0="" 
+ 	log 
+    fi 
 }
 }
 
 
-VERSION=$(version)
-PACKAGE=3
-export VERSION PACKAGE
+exec 3<include/VERSION 
+read MAJOR <&3 
+read MINOR <&3 
+read PATCH <&3 
 
 
-GRASS_PYTHON=/c/OSGeo4W/apps/Python25
-PYTHONHOME=/c/OSGeo4W/apps/Python25
-export GRASS_PYTHON PYTHONHOME
+export VERSION=$MAJOR.$MINOR.$PATCH 
 
 
-LOG=mswindows/osgeo4w/package.log
+export GRASS_PYTHON=/c/OSGeo4W/apps/Python25
+export PYTHONHOME=/c/OSGeo4W/apps/Python25
 
 
-report() {
-    echo $(date): STARTING $1
-    echo $(date): STARTING $1 >>$LOG
-}
+if [ -f mswindows/osgeo4w/package.log ]; then 
+    i=0 
+    while [ -f mswindows/osgeo4w/package.log.$i ]; do 
+ 	(( i++ )) 
+    done 
+    mv mswindows/osgeo4w/package.log mswindows/osgeo4w/package.log.$i 
+fi 
 
 
-echo $(date): START > $LOG
+exec 3>&1 >> mswindows/osgeo4w/package.log 2>&1 
+
+[ -d mswindows/osgeo4w/lib ] || mkdir mswindows/osgeo4w/lib 
+cp -uv $OSGEO4W_ROOT_MSYS/lib/sqlite3_i.lib mswindows/osgeo4w/lib/libsqlite3.a 
+cp -uv $OSGEO4W_ROOT_MSYS/lib/proj.lib mswindows/osgeo4w/lib/libproj.a 
+cp -uv $OSGEO4W_ROOT_MSYS/lib/libtiff_i.lib mswindows/osgeo4w/lib/libtiff.a 
+cp -uv $OSGEO4W_ROOT_MSYS/lib/libpq.lib mswindows/osgeo4w/lib/libpq.a 
+cp -uv $OSGEO4W_ROOT_MSYS/lib/jpeg_i.lib mswindows/osgeo4w/lib/libjpeg.a 
+cp -uv $OSGEO4W_ROOT_MSYS/lib/zlib.lib mswindows/osgeo4w/lib/libz.a 
 
 
 if ! [ -f mswindows/osgeo4w/configure-stamp ]; then
 if ! [ -f mswindows/osgeo4w/configure-stamp ]; then
 
 
-	if [ -e include/Make/Platform.make ] ; then
-	    report "distclean"
-	    make distclean >>$LOG 2>&1
+	if [ -e include/Make/Grass.make ] ; then
+	    log make distclean
+	    make distclean
 	fi
 	fi
 
 
-	report "configure"
+	log configure
 	./configure \
 	./configure \
-		--with-libs="$OSGEO4W_ROOT_MSYS/apps/gdal-16/lib $OSGEO4W_ROOT_MSYS/lib" \
-		--with-includes="$OSGEO4W_ROOT_MSYS/apps/gdal-16/include $OSGEO4W_ROOT_MSYS/include" \
-		--exec-prefix=$OSGEO4W_ROOT_MSYS/apps/grass \
+		--with-libs="$OSGEO4W_ROOT_MSYS/lib $PWD/mswindows/osgeo4w/lib" \
+		--with-includes=$OSGEO4W_ROOT_MSYS/include \
+		--exec-prefix=$OSGEO4W_ROOT_MSYS/bin \
 		--libexecdir=$OSGEO4W_ROOT_MSYS/bin \
 		--libexecdir=$OSGEO4W_ROOT_MSYS/bin \
 		--prefix=$OSGEO4W_ROOT_MSYS/apps/grass \
 		--prefix=$OSGEO4W_ROOT_MSYS/apps/grass \
 		--includedir=$OSGEO4W_ROOT_MSYS/include \
 		--includedir=$OSGEO4W_ROOT_MSYS/include \
 		--disable-x --without-x \
 		--disable-x --without-x \
 		--with-cxx \
 		--with-cxx \
 		--enable-shared \
 		--enable-shared \
+		--enable-largefile \
 		--with-opengl=windows \
 		--with-opengl=windows \
 		--with-fftw \
 		--with-fftw \
 		--with-freetype \
 		--with-freetype \
 		--with-proj-share=$OSGEO4W_ROOT_MSYS/share/proj \
 		--with-proj-share=$OSGEO4W_ROOT_MSYS/share/proj \
-		--with-gdal=$OSGEO4W_ROOT_MSYS/bin/gdal-config \
+		--with-gdal=$PWD/mswindows/osgeo4w/gdal-config \
+		--with-geos=$PWD/mswindows/osgeo4w/geos-config \
 		--with-tcltk \
 		--with-tcltk \
 		--with-sqlite \
 		--with-sqlite \
 		--with-postgres \
 		--with-postgres \
@@ -67,23 +117,75 @@ if ! [ -f mswindows/osgeo4w/configure-stamp ]; then
 		--with-regex \
 		--with-regex \
 		--with-nls \
 		--with-nls \
 		--with-freetype-includes=$OSGEO4W_ROOT_MSYS/include/freetype2 \
 		--with-freetype-includes=$OSGEO4W_ROOT_MSYS/include/freetype2 \
-	        --without-cairo \
-	        --enable-largefile \
-		--with-odbc >>$LOG 2>&1
-		
+		--with-odbc
+
 	touch mswindows/osgeo4w/configure-stamp
 	touch mswindows/osgeo4w/configure-stamp
 fi
 fi
 
 
-report "make"
-make >>$LOG 2>&1
+log make 
+make -k || make || ( cat error.log >&3 && false ) 
+
+log make install
+make install
+
+log cleanup
+mv $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib/*.dll $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/bin
+mv $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h.mingw
+cp mswindows/osgeo4w/config.h.switch $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass/config.h
+cp mswindows/osgeo4w/config.h.vc $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/include/grass
+if [ -n "$POSTFIX" ] ; then
+    sed -e "s#@VERSION@#$VERSION#g" -e "s#@POSTFIX@#$POSTFIX#g" mswindows/osgeo4w/grass.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/grass$POSTFIX.bat.tmpl 
+    sed -e "s#@VERSION@#$VERSION#g" -e "s#@POSTFIX@#$POSTFIX#g" mswindows/osgeo4w/grass.tmpl >$OSGEO4W_ROOT_MSYS/bin/grass$POSTFIX.tmpl 
+    sed -e "s#@VERSION@#$VERSION#g" -e "s#@POSTFIX@#$POSTFIX#g" mswindows/osgeo4w/ini.bat.tmpl >$OSGEO4W_ROOT_MSYS/bin/grass$POSTFIX-env.bat.tmpl 
+    sed -e "s#@VERSION@#$VERSION#g" -e "s#@POSTFIX@#$POSTFIX#g" mswindows/osgeo4w/postinstall.bat >$OSGEO4W_ROOT_MSYS/etc/postinstall/grass$POSTFIX.bat 
+    sed -e "s#@VERSION@#$VERSION#g" -e "s#@POSTFIX@#$POSTFIX#g" mswindows/osgeo4w/preremove.bat >$OSGEO4W_ROOT_MSYS/etc/preremove/grass$POSTFIX.bat 
+fi
 
 
-report "make install"
-make install >>$LOG 2>&1
+if [ -f /c/mingw/bin/libgnurx-0.dll ]; then
+    cp /c/mingw/bin/libgnurx-0.dll $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/bin 
+    cp /c/mingw/bin/libiconv-2.dll $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/bin 
+    cp /c/mingw/bin/libintl-8.dll $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/bin
+fi
 
 
-report "cleanup"
-mv "$OSGEO4W_ROOT_MSYS"/apps/grass/grass-$VERSION/lib/*.$VERSION.dll \
-   "$OSGEO4W_ROOT_MSYS/bin"
+P="$(pwd -W)"
+P="${P//\//\\\\}\\\\dist.i686-pc-mingw32"
+
+sed -e "s#$P#@osgeo4w@#g" $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/fontcap >$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/fontcap.tmpl
+rm "$OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/etc/fontcap"
+if [ -f $OSGEO4W_ROOT_MSYS/apps/grass/bin/grass$MAJOR$MINOR ]; then 
+    sed -e "s#$P#@osgeo4w_msys@#g" $OSGEO4W_ROOT_MSYS/apps/grass/bin/grass$MAJOR$MINOR >$OSGEO4W_ROOT_MSYS/bin/grass$POSTFIX.tmpl 
+    rm $OSGEO4W_ROOT_MSYS/apps/grass/bin/grass$MAJOR$MINOR 
+elif [ -f dist.i686-pc-mingw32/grass$MAJOR$MINOR ]; then 
+    sed -e "s#$P#@osgeo4w_msys@/apps/grass/grass-$VERSION#g" dist.i686-pc-mingw32/grass$MAJOR$MINOR.tmp >$OSGEO4W_ROOT_MSYS/bin/grass$POSTFIX.tmpl 
+fi 
+
+if [ -n "$1" ] && [ -n "$2" ] ; then
+    log building vc libraries 
+    sh mswindows/osgeo4w/mklibs.sh $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/bin/*.$VERSION.dll 
+    mv mswindows/osgeo4w/vc/grass*.lib $OSGEO4W_ROOT_MSYS/apps/grass/grass-$VERSION/lib 
+    
+    # log BUILDING GDAL GRASS plugins 
+    # $COMSPEC /c "mswindows\\osgeo4w\\gdalplugins.cmd $VERSION" 
+    
+    log CREATING PACKAGES 
+    mkdir -p package/grass$POSTFIX 
+    
+    PDIR=$PWD/package 
+    cd $OSGEO4W_ROOT_MSYS 
+    
+    tar -cjf $PDIR/grass$POSTFIX/grass$POSTFIX-$VERSION-$PACKAGE.tar.bz2 \ 
+    apps/grass/grass-$VERSION \ 
+    bin/grass$POSTFIX.bat.tmpl \ 
+    bin/grass$POSTFIX.tmpl \ 
+    bin/grass$POSTFIX-env.bat.tmpl \ 
+    etc/postinstall/grass$POSTFIX.bat \ 
+    etc/preremove/grass$POSTFIX.bat 
+    
+    cd $PDIR/.. 
+    svn diff >/tmp/grass$POSTFIX-$VERSION.diff 
+    tar -C /tmp -cjf $PDIR/grass$POSTFIX/grass$POSTFIX-$VERSION-$PACKAGE-src.tar.bz2 grass$POSTFIX-$VERSION.diff 
+fi
 
 
-echo $(date): END >> $LOG
+log 
 
 
 exit 0
 exit 0

+ 11 - 12
mswindows/osgeo4w/postinstall.bat

@@ -1,15 +1,14 @@
-set ICON=%OSGEO4W_ROOT%\apps\grass\grass-7.0.0svn\etc\gui\icons\grass.ico
-set BATCH=%OSGEO4W_ROOT%\bin\grass70.bat
+set ICON=%OSGEO4W_ROOT%\apps\grass\grass-@VERSION@\etc\gui\icons\grass.ico
+set BATCH=%OSGEO4W_ROOT%\bin\grass@POSTFIX@.bat
 
 
-textreplace -std -t "%OSGEO4W_ROOT%"\bin\grass70.bat
-textreplace -std -t "%OSGEO4W_ROOT%"\apps\grass\grass-7.0.0svn\etc\fontcap
-textreplace -std -t "%OSGEO4W_ROOT%"\apps\grass\bin\grass70
+textreplace -std -t "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@-env.bat 
+textreplace -std -t "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@.bat 
+textreplace -std -t "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@ 
+textreplace -std -t "%OSGEO4W_ROOT%"\apps\grass\grass-@VERSION@\etc\fontcap 
 
 
-mkdir "%OSGEO4W_STARTMENU%\GRASS GIS"
-xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS\wxPython.lnk"   "%BATCH%" "-wxpython" \ "wxPython interface" 1 "%ICON%"
-xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS\TclTk.lnk"      "%BATCH%" "-tcltk" \ "Tcl/Tk interface" 1 "%ICON%"
-xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS\Text.lnk"       "%BATCH%" "-text" \ "Text interface" 1 "%ICON%"
+mkdir "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@" 
+xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@\wxPython @VERSION@.lnk"   "%BATCH%" "-wxpython" \ "wxPython interface" 1 "%ICON%" 
+xxmklink "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@\Text @VERSION@.lnk"       "%BATCH%" "-text" \ "Text interface" 1 "%ICON%" 
 
 
-xxmklink "%ALLUSERSPROFILE%\Desktop\GRASS GIS (wxpython).lnk" "%BATCH%" "-wxpython" \ "wxPython" 1 "%ICON%"
-xxmklink "%ALLUSERSPROFILE%\Desktop\GRASS GIS (TclTk).lnk" "%BATCH%" "-tcltk" \ "Tcl/Tk" 1 "%ICON%"
-xxmklink "%ALLUSERSPROFILE%\Desktop\GRASS GIS (Text).lnk" "%BATCH%" "-text" \ "Text interface" 1 "%ICON%"
+xxmklink "%ALLUSERSPROFILE%\Desktop\GRASS GIS @VERSION@ (wxpython).lnk" "%BATCH%" "-wxpython" \ "wxPython" 1 "%ICON%" 
+xxmklink "%ALLUSERSPROFILE%\Desktop\GRASS GIS @VERSION@ (Text).lnk" "%BATCH%" "-text" \ "Text interface" 1 "%ICON%" 

+ 9 - 13
mswindows/osgeo4w/preremove.bat

@@ -1,15 +1,11 @@
-del "%OSGEO4W_STARTMENU%\GRASS.lnk"
-del "%ALLUSERSPROFILE%\Desktop\grass.lnk"
+del "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@\wxpython.lnk" 
+del "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@\text.lnk" 
+rmdir "%OSGEO4W_STARTMENU%\GRASS GIS @VERSION@" 
 
 
-del "%OSGEO4W_STARTMENU%\GRASS GIS\wxpython.lnk"
-del "%OSGEO4W_STARTMENU%\GRASS GIS\tcltk.lnk"
-del "%OSGEO4W_STARTMENU%\GRASS GIS\text.lnk"
-rmdir "%OSGEO4W_STARTMENU%\GRASS GIS"
+del "%ALLUSERSPROFILE%\Desktop\GRASS GIS @VERSION@ (wxPython).lnk" 
+del "%ALLUSERSPROFILE%\Desktop\GRASS GIS @VERSION@ (Text).lnk"
 
 
-del "%ALLUSERSPROFILE%\Desktop\GRASS GIS (wxPython).lnk"
-del "%ALLUSERSPROFILE%\Desktop\GRASS GIS (TclTk).lnk"
-del "%ALLUSERSPROFILE%\Desktop\GRASS GIS (Text).lnk"
-
-del "%OSGEO4W_ROOT%"\apps\grass\grass-7.0.0svn\etc\fontcap
-del "%OSGEO4W_ROOT%"\apps\grass\bin\grass70
-del "%OSGEO4W_ROOT%"\bin\grass70.bat
+del "%OSGEO4W_ROOT%"\apps\grass\grass-@VERSION@\etc\fontcap 
+del "%OSGEO4W_ROOT%"\apps\grass\bin\grass@POSTFIX@ 
+del "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@-env.bat 
+del "%OSGEO4W_ROOT%"\bin\grass@POSTFIX@.bat