[GRASS-dev] GRASS startup window patches

Michael Barton michael.barton at asu.edu
Sat Jan 6 14:42:59 EST 2007


Paul and others,

See below.

On 1/6/07 10:45 AM, "Brad Douglas" <rez at touchofmadness.com> wrote:

> On Sat, 2007-01-06 at 09:39 -0700, Michael Barton wrote:
>> Hi Brad,
>> 
>> The line in my Platform.make file is correct--both in source and binary...
>> 
>> PROJSHARE           = /Library/Frameworks/PROJ.framework/Resources/proj
>> 
>> 
>> But this does not seem to be doing anything. That is, the PROJSHARE value is
>> not accessible in the normal ways I know of. I'm trying to figure out how to
>> actually read this inside TclTk. Should a line be added to init.sh to make
>> this an environmental variable?
> 
> This is for gis_set.tcl, right?

Actually, this is for use in epsg_option.tcl (epsg_option.tcl.ini in source
for some odd reason).

> 
> If so, lib/init/Makefile needs to be edited to apply the same technique
> used on make_location_epsg.sh.  During the build, a sed script gets run
> and replaces PROJSHARE with the literal path.
> 

OK. This finally tells me how this works. Thanks much. IMHO, this is really
klunky and roundabout. And it doesn't work on my Mac for some reason.

For the benefit of others...

/lib/init/Makefile checks to see of PROJSHARE has been set in configure (as
an environmental variable?). If not, it uses PROJSHAREDEFAULT (a different
environmental variable?).

In either case, it then runs a unix shell script (problems on Windows boxes
and Macs?) that calls sed to replace the string "PROJSHARE" in the
epsg_option.tcl.ini tcltk script with a literal path derived either from
PROJSHARE or PROJSHAREDEFAULT.

================================

Here's the current code in /init/Make...

    if [ -z "$(PROJSHARE)" ] ; then \
        sh ./projshare.sed "$(PROJSHAREDEFAULT)" epsg_option.tcl.in > $@ ; \
        else \
        sh ./projshare.sed "$(PROJSHARE)" epsg_option.tcl.in > $@ ; \
    fi
    chmod 755 $@

Here is the code for the projshare.sed script...

projshare=$1
file=$2

# MS-Windows TclTk does not recognize POSIX path.
if [ "$file" = "epsg_option.tcl.in" -a -n "$MSYSCON" ] ; then
    msys_path=`echo $WD | sed -e 's+\\\\+/+g' -e 's+//bin/$++'`
    projshare=`echo "$projshare" | sed "s+^/usr+$msys_path+"`
fi
sed -e "s+PROJSHARE+$projshare+" $file

================================

IMHO, this could be considerably simplified and made more reliable
cross-platform if PROJSHARE could be set as an environmental variable in
init.sh (using the same methods of doing this as setting other variables at
compile time in init.sh), be set as a GRASS environmental variable that
could go into .grassrc6, or be put into a text file that could be read by
the tcltk script. AFAICT, nothing except the TclTk script epsg_option.tcl
needs to know where the epsg data file is located and I don't think it's a
good idea to have a shell script try to alter a TclTk script. It isn't
working on my Mac and I doubt if it works for Windows. Unfortunately, I
don't understand the make system enough to make such changes myself and not
mess something else up.

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





More information about the grass-dev mailing list