[GRASS-dev] gis.m patch

Hi,

I've patched gis.m so that it can run on Windows natively with the help
of direct rendering. PDCurses lets the user to start in text mode, but
since there are no monitors available, gis.m is the only option for now.

http://geni.ath.cx/grass/native_wingrass.png shows gis.m running on
MS-Windows (not Cygwin).

Huidae

GRASS is now configured for: i686-pc-mingw32

Source directory: /home/song/usr/grass/grass6
Build directory: /home/song/usr/grass/grass6
Installation directory: /usr/local/grass-6.3.cvs
Startup script in directory: ${exec_prefix}/bin
C compiler: gcc -g -O2 -D__W98__
C++ compiler: c++ -g -O2
FORTRAN compiler:
Building shared libraries: yes
64bit support: no
OpenGL platform: Windows

  NVIZ: yes

  BLAS support: no
  C++ support: yes
  DWG support: no
  FFMPEG support: no
  FFTW support: yes
  FreeType support: yes
  GDAL support: yes
  GLw support: no
  JPEG support: yes
  LAPACK support: no
  Large File Support (LFS): no
  Motif support: no
  MySQL support: no
  NLS support: no
  ODBC support: no
  OGR support: yes
  OpenGL support: yes
  PNG support: yes
  PostgreSQL support: yes
  Python support: no
  Readline support: yes
  SQLite support: yes
  Tcl/Tk support: yes
  TIFF support: yes
  X11 support: yes

Index: gui/tcltk/gis.m/gm.tcl

RCS file: /grassrepository/grass6/gui/tcltk/gis.m/gm.tcl,v
retrieving revision 1.25
diff -u -r1.25 gm.tcl
--- gui/tcltk/gis.m/gm.tcl 24 Aug 2006 18:04:57 -0000 1.25
+++ gui/tcltk/gis.m/gm.tcl 2 Sep 2006 06:00:41 -0000
@@ -69,6 +69,12 @@
     set execom "spawn"
}

+if {[info exists env(MSYSCON)]} {
+ set mingw "1"
+} {
+ set mingw "0"
+}
+
#fetch GRASS Version number:
set fp [open $env(GISBASE)/etc/VERSIONNUMBER r]
set GRASSVERSION [read -nonewline $fp]
@@ -188,7 +194,13 @@
# Determine if an element already exists

proc Gm::element_exists {elem name} {
- set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"] >& /dev/null}]
+ global mingw
+
+ if { $mingw == "1" } {
+ set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"] >& nul}]
+ } {
+ set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"] >& /dev/null}]
+ }

   return [expr {! $failure}]
}
Index: gui/tcltk/gis.m/gmmenu.tcl

RCS file: /grassrepository/grass6/gui/tcltk/gis.m/gmmenu.tcl,v
retrieving revision 1.15
diff -u -r1.15 gmmenu.tcl
--- gui/tcltk/gis.m/gmmenu.tcl 20 Jul 2006 17:43:19 -0000 1.15
+++ gui/tcltk/gis.m/gmmenu.tcl 2 Sep 2006 06:00:41 -0000
@@ -19,6 +19,7 @@
global mon
global filename
global env
+global mingw

# Put this at the top of the file menu.
set GuiMenu::Menu_File_Top [subst {
@@ -48,10 +49,20 @@
lappend descmenu all
lappend descmenu options
lappend descmenu $tmenu
-lappend descmenu [subst {
- {command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual -i > /dev/null & } }
- {command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {} -command { exec g.manual gis.m > /dev/null & } }
- {command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command { source $env(GISBASE)/etc/gm/grassabout.tcl} }
- {command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command { exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
- }]

+# MinGW
+if { $mingw == "1" } {
+ lappend descmenu [subst {
+ {command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual -i >& nul } }
+ {command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {} -command { exec g.manual gis.m >& nul } }
+ {command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command { source $env(GISBASE)/etc/gm/grassabout.tcl} }
+ {command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command { exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
+ }]
+} {
+ lappend descmenu [subst {
+ {command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual -i > /dev/null & } }
+ {command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {} -command { exec g.manual gis.m > /dev/null & } }
+ {command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command { source $env(GISBASE)/etc/gm/grassabout.tcl} }
+ {command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command { exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
+ }]
+}
Index: gui/tcltk/gis.m/runandoutput.tcl

RCS file: /grassrepository/grass6/gui/tcltk/gis.m/runandoutput.tcl,v
retrieving revision 1.12
diff -u -r1.12 runandoutput.tcl
--- gui/tcltk/gis.m/runandoutput.tcl 27 Aug 2006 21:19:26 -0000 1.12
+++ gui/tcltk/gis.m/runandoutput.tcl 2 Sep 2006 06:00:41 -0000
@@ -169,11 +169,17 @@

###############################################################################
proc run {cmd args} {
+ global mingw
+
   # This and runcmd are being used to run command in the background
   # These used to go to stdout and stderr
   # but we don't want to pollute that console.
   # eval exec -- $cmd $args >@ stdout 2>@ stderr
- eval [list exec -- $cmd] $args >& /dev/null
+ if { $mingw == "1" } {
+ eval [list exec -- $cmd] $args >& nul
+ } {
+ eval [list exec -- $cmd] $args >& /dev/null
+ }
}

###############################################################################
Index: lib/gtcltk/gronsole.tcl

RCS file: /grassrepository/grass6/lib/gtcltk/gronsole.tcl,v
retrieving revision 1.6
diff -u -r1.6 gronsole.tcl
--- lib/gtcltk/gronsole.tcl 27 Aug 2006 21:19:26 -0000 1.6
+++ lib/gtcltk/gronsole.tcl 2 Sep 2006 06:00:43 -0000
@@ -425,10 +425,16 @@

proc Gronsole::execout {path cmd ci execcmd} {
   global env
+ global mingw
+
   set mark cmdinsert$ci

   # Actually run the program
- set cmd [concat | $cmd 2>@ stdout]
+ if { $mingw == "1" } {
+ set cmd [concat | $cmd]
+ } {
+ set cmd [concat | $cmd 2>@ stdout]
+ }

   set message_env [exec g.gisenv get=GRASS_MESSAGE_FORMAT]
         set env(GRASS_MESSAGE_FORMAT) gui
Index: lib/gtcltk/options.tcl

RCS file: /grassrepository/grass6/lib/gtcltk/options.tcl,v
retrieving revision 1.7
diff -u -r1.7 options.tcl
--- lib/gtcltk/options.tcl 19 May 2006 21:19:16 -0000 1.7
+++ lib/gtcltk/options.tcl 2 Sep 2006 06:00:43 -0000
@@ -98,3 +98,9 @@
if { $osxaqua == "1"} {
     set keycontrol "Command"
}
+
+if {[info exists env(MSYSCON)]} {
+ set mingw "1"
+} else {
+ set mingw "0"
+}

Huidae Cho wrote:

Hi,

I've patched gis.m so that it can run on Windows natively with the help
of direct rendering. PDCurses lets the user to start in text mode, but
since there are no monitors available, gis.m is the only option for now.

http://geni.ath.cx/grass/native_wingrass.png shows gis.m running on
MS-Windows (not Cygwin).

Oh shoot, great!

Can you re-send the patch as an attachment?

Michael,

Aply it?

Maciek

Find attached the patch.

Huidae

On Sat, Sep 02, 2006 at 11:39:58AM +0200, Maciej Sieczka wrote:

Huidae Cho wrote:
> Hi,
>
> I've patched gis.m so that it can run on Windows natively with the help
> of direct rendering. PDCurses lets the user to start in text mode, but
> since there are no monitors available, gis.m is the only option for now.
>
> http://geni.ath.cx/grass/native_wingrass.png shows gis.m running on
> MS-Windows (not Cygwin).

Oh shoot, great!

Can you re-send the patch as an attachment?

Michael,

Aply it?

Maciek

(attachments)

gism-mingw-2006-09-02.patch (5.27 KB)

Huidae Cho wrote:

I've patched gis.m so that it can run on Windows natively with the help
of direct rendering. PDCurses lets the user to start in text mode, but
since there are no monitors available, gis.m is the only option for now.

+ if { $mingw == "1" } {
+ set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"] >& nul}]
+ } {
+ set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"] >& /dev/null}]
+ }

Rather than duplicate entire commands, I would be inclined to create a
global variable, e.g.:

  set devnull [expr {$mingw == 1 ? "nul" : "/dev/null"}]

then use:

  global devnull
  ...
  set failure [catch {exec "|g.findfile" "element=$elem" "file=$name" >& $devnull}]

[Note that the original exec command was broken.]

--
Glynn Clements <glynn@gclements.plus.com>

This is GREAT. Thanks very much. I have a couple questions.

1. Is there a binary version of this available for people to try?
2. Do your changes affect how gism runs on any other platform?
3. Could you give me a brief one-liner of what each change to gism is
intended to do so I can find a way to keep this in the code if it does have
issues on other platforms?
4. Does NVIZ work?

Great news (even though I don't use Windows)

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

From: Huidae Cho <grass4u@gmail.com>
Date: Sat, 2 Sep 2006 01:32:19 -0500
To: <grass-dev@grass.itc.it>
Subject: [GRASS-dev] gis.m patch

Hi,

I've patched gis.m so that it can run on Windows natively with the help
of direct rendering. PDCurses lets the user to start in text mode, but
since there are no monitors available, gis.m is the only option for now.

http://geni.ath.cx/grass/native_wingrass.png shows gis.m running on
MS-Windows (not Cygwin).

Huidae

GRASS is now configured for: i686-pc-mingw32

Source directory: /home/song/usr/grass/grass6
Build directory: /home/song/usr/grass/grass6
Installation directory: /usr/local/grass-6.3.cvs
Startup script in directory: ${exec_prefix}/bin
C compiler: gcc -g -O2 -D__W98__
C++ compiler: c++ -g -O2
FORTRAN compiler:
Building shared libraries: yes
64bit support: no
OpenGL platform: Windows

  NVIZ: yes

  BLAS support: no
  C++ support: yes
  DWG support: no
  FFMPEG support: no
  FFTW support: yes
  FreeType support: yes
  GDAL support: yes
  GLw support: no
  JPEG support: yes
  LAPACK support: no
  Large File Support (LFS): no
  Motif support: no
  MySQL support: no
  NLS support: no
  ODBC support: no
  OGR support: yes
  OpenGL support: yes
  PNG support: yes
  PostgreSQL support: yes
  Python support: no
  Readline support: yes
  SQLite support: yes
  Tcl/Tk support: yes
  TIFF support: yes
  X11 support: yes

Index: gui/tcltk/gis.m/gm.tcl

RCS file: /grassrepository/grass6/gui/tcltk/gis.m/gm.tcl,v
retrieving revision 1.25
diff -u -r1.25 gm.tcl
--- gui/tcltk/gis.m/gm.tcl 24 Aug 2006 18:04:57 -0000 1.25
+++ gui/tcltk/gis.m/gm.tcl 2 Sep 2006 06:00:41 -0000
@@ -69,6 +69,12 @@
     set execom "spawn"
}

+if {[info exists env(MSYSCON)]} {
+ set mingw "1"
+} {
+ set mingw "0"
+}
+
#fetch GRASS Version number:
set fp [open $env(GISBASE)/etc/VERSIONNUMBER r]
set GRASSVERSION [read -nonewline $fp]
@@ -188,7 +194,13 @@
# Determine if an element already exists

proc Gm::element_exists {elem name} {
- set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"]
>& /dev/null}]
+ global mingw
+
+ if { $mingw == "1" } {
+ set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"]
>& nul}]
+ } {
+ set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"]
>& /dev/null}]
+ }

return [expr {! $failure}]
}
Index: gui/tcltk/gis.m/gmmenu.tcl

RCS file: /grassrepository/grass6/gui/tcltk/gis.m/gmmenu.tcl,v
retrieving revision 1.15
diff -u -r1.15 gmmenu.tcl
--- gui/tcltk/gis.m/gmmenu.tcl 20 Jul 2006 17:43:19 -0000 1.15
+++ gui/tcltk/gis.m/gmmenu.tcl 2 Sep 2006 06:00:41 -0000
@@ -19,6 +19,7 @@
global mon
global filename
global env
+global mingw

# Put this at the top of the file menu.
set GuiMenu::Menu_File_Top [subst {
@@ -48,10 +49,20 @@
lappend descmenu all
lappend descmenu options
lappend descmenu $tmenu
-lappend descmenu [subst {
- {command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual -i
> /dev/null & } }
- {command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {}
-command { exec g.manual gis.m > /dev/null & } }
- {command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command {
source $env(GISBASE)/etc/gm/grassabout.tcl} }
- {command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command {
exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
- }]

+# MinGW
+if { $mingw == "1" } {
+ lappend descmenu [subst {
+ {command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual
-i >& nul } }
+ {command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {}
-command { exec g.manual gis.m >& nul } }
+ {command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command {
source $env(GISBASE)/etc/gm/grassabout.tcl} }
+ {command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command
{ exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
+ }]
+} {
+ lappend descmenu [subst {
+ {command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual
-i > /dev/null & } }
+ {command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {}
-command { exec g.manual gis.m > /dev/null & } }
+ {command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command {
source $env(GISBASE)/etc/gm/grassabout.tcl} }
+ {command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command
{ exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
+ }]
+}
Index: gui/tcltk/gis.m/runandoutput.tcl

RCS file: /grassrepository/grass6/gui/tcltk/gis.m/runandoutput.tcl,v
retrieving revision 1.12
diff -u -r1.12 runandoutput.tcl
--- gui/tcltk/gis.m/runandoutput.tcl 27 Aug 2006 21:19:26 -0000 1.12
+++ gui/tcltk/gis.m/runandoutput.tcl 2 Sep 2006 06:00:41 -0000
@@ -169,11 +169,17 @@

##############################################################################>
#

proc run {cmd args} {
+ global mingw
+
# This and runcmd are being used to run command in the background
# These used to go to stdout and stderr
# but we don't want to pollute that console.
# eval exec -- $cmd $args >@ stdout 2>@ stderr
- eval [list exec -- $cmd] $args >& /dev/null
+ if { $mingw == "1" } {
+ eval [list exec -- $cmd] $args >& nul
+ } {
+ eval [list exec -- $cmd] $args >& /dev/null
+ }
}

##############################################################################>
#

Index: lib/gtcltk/gronsole.tcl

RCS file: /grassrepository/grass6/lib/gtcltk/gronsole.tcl,v
retrieving revision 1.6
diff -u -r1.6 gronsole.tcl
--- lib/gtcltk/gronsole.tcl 27 Aug 2006 21:19:26 -0000 1.6
+++ lib/gtcltk/gronsole.tcl 2 Sep 2006 06:00:43 -0000
@@ -425,10 +425,16 @@

proc Gronsole::execout {path cmd ci execcmd} {
global env
+ global mingw
+
set mark cmdinsert$ci

# Actually run the program
- set cmd [concat | $cmd 2>@ stdout]
+ if { $mingw == "1" } {
+ set cmd [concat | $cmd]
+ } {
+ set cmd [concat | $cmd 2>@ stdout]
+ }

set message_env [exec g.gisenv get=GRASS_MESSAGE_FORMAT]
         set env(GRASS_MESSAGE_FORMAT) gui
Index: lib/gtcltk/options.tcl

RCS file: /grassrepository/grass6/lib/gtcltk/options.tcl,v
retrieving revision 1.7
diff -u -r1.7 options.tcl
--- lib/gtcltk/options.tcl 19 May 2006 21:19:16 -0000 1.7
+++ lib/gtcltk/options.tcl 2 Sep 2006 06:00:43 -0000
@@ -98,3 +98,9 @@
if { $osxaqua == "1"} {
     set keycontrol "Command"
}
+
+if {[info exists env(MSYSCON)]} {
+ set mingw "1"
+} else {
+ set mingw "0"
+}

On Sat, Sep 02, 2006 at 01:06:50PM -0700, Michael Barton wrote:

This is GREAT. Thanks very much. I have a couple questions.

1. Is there a binary version of this available for people to try?

No, not yet. Since the native winGRASS runs on MSys, users need to
install various MSys/GnuWin32 packages as well as GRASS. I want to
distribute a whole system including MSys/GnuWin32 binaries, but I'm not
sure about license issues related to redistribution. It looks like most
of packages are under GPL licenses, so can I? It could be really
annoying for non-techy users to choose right packages from their sites
(it's not like Cygwin).

2. Do your changes affect how gism runs on any other platform?

No. It shouldn't because what I've done is to change /dev/null to nul
only if its platform is MSys.

3. Could you give me a brief one-liner of what each change to gism is
intended to do so I can find a way to keep this in the code if it does have
issues on other platforms?

As mentioned above, the only problem was the null device. On Windows,
it's called "nul" and that's the only change that I made.

4. Does NVIZ work?

No. The configure message below is misleading because I tried to use
libW11, which WAS part of grass5.

Great news (even though I don't use Windows)

Me neither except for building winGRASS :-(.

Huidae

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

> From: Huidae Cho <grass4u@gmail.com>
> Date: Sat, 2 Sep 2006 01:32:19 -0500
> To: <grass-dev@grass.itc.it>
> Subject: [GRASS-dev] gis.m patch
>
> Hi,
>
> I've patched gis.m so that it can run on Windows natively with the help
> of direct rendering. PDCurses lets the user to start in text mode, but
> since there are no monitors available, gis.m is the only option for now.
>
> http://geni.ath.cx/grass/native_wingrass.png shows gis.m running on
> MS-Windows (not Cygwin).
>
> Huidae
>
> GRASS is now configured for: i686-pc-mingw32
>
> Source directory: /home/song/usr/grass/grass6
> Build directory: /home/song/usr/grass/grass6
> Installation directory: /usr/local/grass-6.3.cvs
> Startup script in directory: ${exec_prefix}/bin
> C compiler: gcc -g -O2 -D__W98__
> C++ compiler: c++ -g -O2
> FORTRAN compiler:
> Building shared libraries: yes
> 64bit support: no
> OpenGL platform: Windows
>
> NVIZ: yes
>
> BLAS support: no
> C++ support: yes
> DWG support: no
> FFMPEG support: no
> FFTW support: yes
> FreeType support: yes
> GDAL support: yes
> GLw support: no
> JPEG support: yes
> LAPACK support: no
> Large File Support (LFS): no
> Motif support: no
> MySQL support: no
> NLS support: no
> ODBC support: no
> OGR support: yes
> OpenGL support: yes
> PNG support: yes
> PostgreSQL support: yes
> Python support: no
> Readline support: yes
> SQLite support: yes
> Tcl/Tk support: yes
> TIFF support: yes
> X11 support: yes
>
>
> Index: gui/tcltk/gis.m/gm.tcl
> ===================================================================
> RCS file: /grassrepository/grass6/gui/tcltk/gis.m/gm.tcl,v
> retrieving revision 1.25
> diff -u -r1.25 gm.tcl
> --- gui/tcltk/gis.m/gm.tcl 24 Aug 2006 18:04:57 -0000 1.25
> +++ gui/tcltk/gis.m/gm.tcl 2 Sep 2006 06:00:41 -0000
> @@ -69,6 +69,12 @@
> set execom "spawn"
> }
>
> +if {[info exists env(MSYSCON)]} {
> + set mingw "1"
> +} {
> + set mingw "0"
> +}
> +
> #fetch GRASS Version number:
> set fp [open $env(GISBASE)/etc/VERSIONNUMBER r]
> set GRASSVERSION [read -nonewline $fp]
> @@ -188,7 +194,13 @@
> # Determine if an element already exists
>
> proc Gm::element_exists {elem name} {
> - set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"]
> >& /dev/null}]
> + global mingw
> +
> + if { $mingw == "1" } {
> + set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"]
> >& nul}]
> + } {
> + set failure [catch {exec [list "|g.findfile" "element=$elem" "file=$name"]
> >& /dev/null}]
> + }
>
> return [expr {! $failure}]
> }
> Index: gui/tcltk/gis.m/gmmenu.tcl
> ===================================================================
> RCS file: /grassrepository/grass6/gui/tcltk/gis.m/gmmenu.tcl,v
> retrieving revision 1.15
> diff -u -r1.15 gmmenu.tcl
> --- gui/tcltk/gis.m/gmmenu.tcl 20 Jul 2006 17:43:19 -0000 1.15
> +++ gui/tcltk/gis.m/gmmenu.tcl 2 Sep 2006 06:00:41 -0000
> @@ -19,6 +19,7 @@
> global mon
> global filename
> global env
> +global mingw
>
> # Put this at the top of the file menu.
> set GuiMenu::Menu_File_Top [subst {
> @@ -48,10 +49,20 @@
> lappend descmenu all
> lappend descmenu options
> lappend descmenu $tmenu
> -lappend descmenu [subst {
> - {command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual -i
> > /dev/null & } }
> - {command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {}
> -command { exec g.manual gis.m > /dev/null & } }
> - {command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command {
> source $env(GISBASE)/etc/gm/grassabout.tcl} }
> - {command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command {
> exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
> - }]
>
> +# MinGW
> +if { $mingw == "1" } {
> + lappend descmenu [subst {
> + {command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual
> -i >& nul } }
> + {command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {}
> -command { exec g.manual gis.m >& nul } }
> + {command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command {
> source $env(GISBASE)/etc/gm/grassabout.tcl} }
> + {command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command
> { exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
> + }]
> +} {
> + lappend descmenu [subst {
> + {command {[G_msg "GRASS help"]} {} "g.manual" {} -command { exec g.manual
> -i > /dev/null & } }
> + {command {[G_msg "GIS Manager &help"]} {} {[G_msg "GIS Manager help"]} {}
> -command { exec g.manual gis.m > /dev/null & } }
> + {command {[G_msg "About &GRASS"]} {} {[G_msg "About GRASS"]} {} -command {
> source $env(GISBASE)/etc/gm/grassabout.tcl} }
> + {command {[G_msg "About &System"]} {} {[G_msg "About System"]} {} -command
> { exec $env(GRASS_WISH) $env(GISBASE)/etc/gm/tksys.tcl --tcltk & }}
> + }]
> +}
> Index: gui/tcltk/gis.m/runandoutput.tcl
> ===================================================================
> RCS file: /grassrepository/grass6/gui/tcltk/gis.m/runandoutput.tcl,v
> retrieving revision 1.12
> diff -u -r1.12 runandoutput.tcl
> --- gui/tcltk/gis.m/runandoutput.tcl 27 Aug 2006 21:19:26 -0000 1.12
> +++ gui/tcltk/gis.m/runandoutput.tcl 2 Sep 2006 06:00:41 -0000
> @@ -169,11 +169,17 @@
>
>
>
##############################################################################>
#
> proc run {cmd args} {
> + global mingw
> +
> # This and runcmd are being used to run command in the background
> # These used to go to stdout and stderr
> # but we don't want to pollute that console.
> # eval exec -- $cmd $args >@ stdout 2>@ stderr
> - eval [list exec -- $cmd] $args >& /dev/null
> + if { $mingw == "1" } {
> + eval [list exec -- $cmd] $args >& nul
> + } {
> + eval [list exec -- $cmd] $args >& /dev/null
> + }
> }
>
>
>
##############################################################################>
#
> Index: lib/gtcltk/gronsole.tcl
> ===================================================================
> RCS file: /grassrepository/grass6/lib/gtcltk/gronsole.tcl,v
> retrieving revision 1.6
> diff -u -r1.6 gronsole.tcl
> --- lib/gtcltk/gronsole.tcl 27 Aug 2006 21:19:26 -0000 1.6
> +++ lib/gtcltk/gronsole.tcl 2 Sep 2006 06:00:43 -0000
> @@ -425,10 +425,16 @@
>
> proc Gronsole::execout {path cmd ci execcmd} {
> global env
> + global mingw
> +
> set mark cmdinsert$ci
>
> # Actually run the program
> - set cmd [concat | $cmd 2>@ stdout]
> + if { $mingw == "1" } {
> + set cmd [concat | $cmd]
> + } {
> + set cmd [concat | $cmd 2>@ stdout]
> + }
>
> set message_env [exec g.gisenv get=GRASS_MESSAGE_FORMAT]
> set env(GRASS_MESSAGE_FORMAT) gui
> Index: lib/gtcltk/options.tcl
> ===================================================================
> RCS file: /grassrepository/grass6/lib/gtcltk/options.tcl,v
> retrieving revision 1.7
> diff -u -r1.7 options.tcl
> --- lib/gtcltk/options.tcl 19 May 2006 21:19:16 -0000 1.7
> +++ lib/gtcltk/options.tcl 2 Sep 2006 06:00:43 -0000
> @@ -98,3 +98,9 @@
> if { $osxaqua == "1"} {
> set keycontrol "Command"
> }
> +
> +if {[info exists env(MSYSCON)]} {
> + set mingw "1"
> +} else {
> + set mingw "0"
> +}
>
>

Huidae Cho wrote:

> This is GREAT. Thanks very much. I have a couple questions.
>
> 1. Is there a binary version of this available for people to try?

No, not yet. Since the native winGRASS runs on MSys, users need to
install various MSys/GnuWin32 packages as well as GRASS. I want to
distribute a whole system including MSys/GnuWin32 binaries, but I'm not
sure about license issues related to redistribution. It looks like most
of packages are under GPL licenses, so can I? It could be really
annoying for non-techy users to choose right packages from their sites
(it's not like Cygwin).

Most of the packages you are likely to need will allow bundling with
GRASS in a single installer or archive.

The only case which might be problematic is if you are using
ActiveState Tcl/Tk; the licencing conditions for that looked like they
might be problematic, so I've been using the standard Tcl/Tk packages
built from source instead.

> 3. Could you give me a brief one-liner of what each change to gism is
> intended to do so I can find a way to keep this in the code if it does have
> issues on other platforms?

As mentioned above, the only problem was the null device. On Windows,
it's called "nul" and that's the only change that I made.

There is also this one:

  # Actually run the program
  - set cmd [concat | $cmd 2>@ stdout]
  + if { $mingw == "1" } {
  + set cmd [concat | $cmd]
  + } {
  + set cmd [concat | $cmd 2>@ stdout]
  + }

What happens without that change?

> 4. Does NVIZ work?

No. The configure message below is misleading because I tried to use
libW11, which WAS part of grass5.

Note that NVIZ does work natively under Windows (using MinGW/MSys);
the only problem I ran into was that you need to redirect NVIZ' stdin
from /dev/null otherwise "exec" hangs (redirect stdin within the exec
command doesn't work).

--
Glynn Clements <glynn@gclements.plus.com>

On Sun, Sep 03, 2006 at 10:07:35PM +0100, Glynn Clements wrote:

Huidae Cho wrote:

> > This is GREAT. Thanks very much. I have a couple questions.
> >
> > 1. Is there a binary version of this available for people to try?
>
> No, not yet. Since the native winGRASS runs on MSys, users need to
> install various MSys/GnuWin32 packages as well as GRASS. I want to
> distribute a whole system including MSys/GnuWin32 binaries, but I'm not
> sure about license issues related to redistribution. It looks like most
> of packages are under GPL licenses, so can I? It could be really
> annoying for non-techy users to choose right packages from their sites
> (it's not like Cygwin).

Most of the packages you are likely to need will allow bundling with
GRASS in a single installer or archive.

The only case which might be problematic is if you are using
ActiveState Tcl/Tk; the licencing conditions for that looked like they
might be problematic, so I've been using the standard Tcl/Tk packages
built from source instead.

Then the MSys version should be fine?

> > 3. Could you give me a brief one-liner of what each change to gism is
> > intended to do so I can find a way to keep this in the code if it does have
> > issues on other platforms?
>
> As mentioned above, the only problem was the null device. On Windows,
> it's called "nul" and that's the only change that I made.

There is also this one:

  # Actually run the program
  - set cmd [concat | $cmd 2>@ stdout]
  + if { $mingw == "1" } {
  + set cmd [concat | $cmd]
  + } {
  + set cmd [concat | $cmd 2>@ stdout]
  + }

What happens without that change?

I get the same error as http://intevation.de/rt/webrt?serial_num=5096.
$ret is set to 1 and it cannot make it to $execcmd.

> > 4. Does NVIZ work?
>
> No. The configure message below is misleading because I tried to use
> libW11, which WAS part of grass5.

Note that NVIZ does work natively under Windows (using MinGW/MSys);
the only problem I ran into was that you need to redirect NVIZ' stdin
from /dev/null otherwise "exec" hangs (redirect stdin within the exec
command doesn't work).

OK, I'll try.

Huidae

On Mon, Sep 04, 2006 at 01:13:57PM -0500, Huidae Cho wrote:

On Sun, Sep 03, 2006 at 10:07:35PM +0100, Glynn Clements wrote:
>
> Huidae Cho wrote:
>
> > > This is GREAT. Thanks very much. I have a couple questions.
> > >
> > > 1. Is there a binary version of this available for people to try?
> >
> > No, not yet. Since the native winGRASS runs on MSys, users need to
> > install various MSys/GnuWin32 packages as well as GRASS. I want to
> > distribute a whole system including MSys/GnuWin32 binaries, but I'm not
> > sure about license issues related to redistribution. It looks like most
> > of packages are under GPL licenses, so can I? It could be really
> > annoying for non-techy users to choose right packages from their sites
> > (it's not like Cygwin).
>
> Most of the packages you are likely to need will allow bundling with
> GRASS in a single installer or archive.
>
> The only case which might be problematic is if you are using
> ActiveState Tcl/Tk; the licencing conditions for that looked like they
> might be problematic, so I've been using the standard Tcl/Tk packages
> built from source instead.

Then the MSys version should be fine?

>
> > > 3. Could you give me a brief one-liner of what each change to gism is
> > > intended to do so I can find a way to keep this in the code if it does have
> > > issues on other platforms?
> >
> > As mentioned above, the only problem was the null device. On Windows,
> > it's called "nul" and that's the only change that I made.
>
> There is also this one:
>
> # Actually run the program
> - set cmd [concat | $cmd 2>@ stdout]
> + if { $mingw == "1" } {
> + set cmd [concat | $cmd]
> + } {
> + set cmd [concat | $cmd 2>@ stdout]
> + }
>
> What happens without that change?

I get the same error as http://intevation.de/rt/webrt?serial_num=5096.
$ret is set to 1 and it cannot make it to $execcmd.

>
> > > 4. Does NVIZ work?
> >
> > No. The configure message below is misleading because I tried to use
> > libW11, which WAS part of grass5.
>
> Note that NVIZ does work natively under Windows (using MinGW/MSys);
> the only problem I ran into was that you need to redirect NVIZ' stdin
> from /dev/null otherwise "exec" hangs (redirect stdin within the exec
> command doesn't work).

OK, I'll try.

How did you compile nviz without the lib/form library? The library
cannot be built currently because it requires fork(). Maybe, I'm
missing something?

Huidae

Huidae Cho wrote:

> > > This is GREAT. Thanks very much. I have a couple questions.
> > >
> > > 1. Is there a binary version of this available for people to try?
> >
> > No, not yet. Since the native winGRASS runs on MSys, users need to
> > install various MSys/GnuWin32 packages as well as GRASS. I want to
> > distribute a whole system including MSys/GnuWin32 binaries, but I'm not
> > sure about license issues related to redistribution. It looks like most
> > of packages are under GPL licenses, so can I? It could be really
> > annoying for non-techy users to choose right packages from their sites
> > (it's not like Cygwin).
>
> Most of the packages you are likely to need will allow bundling with
> GRASS in a single installer or archive.
>
> The only case which might be problematic is if you are using
> ActiveState Tcl/Tk; the licencing conditions for that looked like they
> might be problematic, so I've been using the standard Tcl/Tk packages
> built from source instead.

Then the MSys version should be fine?

Probably. I didn't actually realise there *was* an MSys version until
you mentioned it.

> > > 3. Could you give me a brief one-liner of what each change to gism is
> > > intended to do so I can find a way to keep this in the code if it does have
> > > issues on other platforms?
> >
> > As mentioned above, the only problem was the null device. On Windows,
> > it's called "nul" and that's the only change that I made.
>
> There is also this one:
>
> # Actually run the program
> - set cmd [concat | $cmd 2>@ stdout]
> + if { $mingw == "1" } {
> + set cmd [concat | $cmd]
> + } {
> + set cmd [concat | $cmd 2>@ stdout]
> + }
>
> What happens without that change?

I get the same error as http://intevation.de/rt/webrt?serial_num=5096.
$ret is set to 1 and it cannot make it to $execcmd.

Odd. Or maybe not; assuming that there even *is* a stdout is a bad
idea for a Windows program, particularly as gis.m runs itself in the
background by default.

The problem with simply removing the "2>@ stdout" is that "exec"
generates an error if the command writes anything to an unredirected
stderr.

It might be better to unconditionally use:

  set cmd [concat | $cmd |& cat]

so that both stdout and stderr go to the console widget (AFAIK, Tcl's
exec/open don't provide an equivalent of "2>&1").

Also, on Unix the 2>@stdout may cause gis.m to be suspended (with
SIGTTOU) if the TOSTOP mode ("stty tostop") is in force.

In any case, bug #5096 indicates that there is an error in the
error-handling code in gronsole.tcl. That needs to be fixed regardless
of how stderr is handled; there are other reasons why open might fail.

--
Glynn Clements <glynn@gclements.plus.com>

Huidae Cho wrote:

> > Note that NVIZ does work natively under Windows (using MinGW/MSys);
> > the only problem I ran into was that you need to redirect NVIZ' stdin
> > from /dev/null otherwise "exec" hangs (redirect stdin within the exec
> > command doesn't work).
>
> OK, I'll try.

How did you compile nviz without the lib/form library? The library
cannot be built currently because it requires fork(). Maybe, I'm
missing something?

I built with static libraries. NVIZ requires F_generate, from
lib/form/generate.c, but doesn't require anything from
lib/form/open.c, so open.o from libgrass_form won't get linked.

To get shared libraries to work, you'll need to conditionalise the
fork() in F_open().

--
Glynn Clements <glynn@gclements.plus.com>

Huidae Cho wrote:

> > No, not yet. Since the native winGRASS runs on MSys, users need
> > to install various MSys/GnuWin32 packages as well as GRASS. I
> > want to distribute a whole system including MSys/GnuWin32
> > binaries, but I'm not sure about license issues related to
> > redistribution. It looks like most of packages are under GPL
> > licenses, so can I? It could be really annoying for non-techy
> > users to choose right packages from their sites (it's not like
> > Cygwin).

Glynn:

> Most of the packages you are likely to need will allow bundling with
> GRASS in a single installer or archive.
>
> The only case which might be problematic is if you are using
> ActiveState Tcl/Tk; the licencing conditions for that looked like
> they might be problematic, so I've been using the standard Tcl/Tk
> packages built from source instead.

Huidae Cho wrote:

Then the MSys version should be fine?

MSys is put out by MinGW, and the the first sentence of www.mingw.org
reads "MinGW: A collection of freely available and freely distributable
Windows specific header files and import libraries combined with GNU
toolsets that allow one to produce native Windows programs that do not
rely on any 3rd-party C runtime DLLs."

further, the "G" in MinGW is GNU.... we can't get much more free
software than that.

http://www.mingw.org/licensing.shtml

says the MinGW specific parts are placed in the public domain.

but to be sure I've just downloaded the MSys source code.
in msys/1.0/10/rt/src there is:
COPYING (the GPL)
COPYING.LIB (the LGPL)
CYGWIN_LICENSE (the GPL + non-viral clause for linking software)

and...

========================================
File: MSYS_LICENSE
Copyright (C): 2001, Earnie Boyd <earnie@users.sf.net>
File $Revision: $
File Revision $Date: $
MSYS Release: 1.0.2
MSYS Release Date: November 30th, 2001

The software, both source and binary forms, are covered via differing
licenses. Each license has it's own set of rules so please make sure you
read them carefully to see how it applies to you, particularly if you're
going to distribute the software.

The MSYS runtime software source can found in the winsup/cygwin
directory. The existing code portions of this source is covered by the
CYGWIN_LICENSE which can be found in this directory in a file by the
name of CYGWIN_LICENSE. MSYS specific software code added regardless of
existing license is covered by the ESPL which can be found in a file by
the same name.

There is no ESPL file there, but a web search found something called the
"EcoSpold Public License v1.0 (ESPL 1.0)". I've asked on the MSys
mailing list for this to be fixed/clarified. As it only affects "MSYS
specific software code" [whatever that means], I guess it doesn't apply
to us.

Hamish