[GRASS-dev] Re: [GRASS GIS] #595: WinGRASS g.version -c fails

GRASS GIS trac at osgeo.org
Fri Oct 2 23:55:08 EDT 2009


#595: WinGRASS g.version -c fails
---------------------------+------------------------------------------------
  Reporter:  hamish        |       Owner:  grass-dev at lists.osgeo.org
      Type:  defect        |      Status:  new                      
  Priority:  blocker       |   Milestone:  6.4.0                    
 Component:  License       |     Version:  6.4.0 RCs                
Resolution:                |    Keywords:  wingrass gpl             
  Platform:  MSWindows XP  |         Cpu:  x86-32                   
---------------------------+------------------------------------------------
Comment (by glynn):

 Replying to [comment:5 hamish]:

 > so what is this Makefile line doing exactly?
 >  - It's copying the COPYING file into the $GISBASE/etc/VERSION file
 >  - it's terminating each line with a literal '\n'
 >  - it's removing all actual newline chars from the file.
 >
 > So this is getting the file ready to be a string embedded in the C code.

 Yep.

 > The g.version Makefile has it with comments:
 {{{
 > EXTRA_CFLAGS=...

 >   -DCOPYING="\"$(COPYING)\""
 }}}

 > On linux 'strings' shows the COPYING text within the binary, from the
 native WinGrass Msys prompt it doesn't.

 I suspect that the -DCOPYING=... may run into problems with the maximum
 length of a command line on Windows.

 It would be better to convert the COPYING file to a complete C source file
 (including the quotes) which can then be #include'd. E.g.:

 {{{
 EXTRA_CFLAGS=-DGRASS_VERSION_FILE="\"$(GRASS_VERSION_FILE)\"" ...

 $(GRASS_VERSION_FILE): ../../COPYING
         sed -e 's/^.*$/"&\\n"/' $< > $@
 }}}

 and:
 {{{
 static const char COPYING[] =
 #include GRASS_VERSION_FILE
 ;
 }}}

 > so the COPYING: ... > VERSION make rule could be simplified into a
 straight cp?

 No. The VERSION file has "\n" instead of newline.

 Maybe it's provided as a convenience for add-on modules (nothing in the
 GRASS source tree uses it)?

 > interestingly the build info string does make it into the WinGrass
 binary and the $GISBASE/etc/BUILD file also has the correct content in it.

 I note that -DGRASS_CONFIGURE_PARAMS=... comes first; maybe the command
 gets truncated at that point (does g.version have the '''complete''' build
 command?)

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/595#comment:6>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list