#!/bin/sh # # XDriver System V IPC: replacement of XDriver fifos # (needed to improve speed and to run GRASS Monitors on Windows?) # # Contact: Huidae Cho # # The source code from Ronald Wiemer (MessQ.tar.Z) is merged into # the current driver code by Huidae Cho. # # The updated files including the IPC are here: # src/display/devices/XDRIVER/XDRIVER24/ipc.new/ # src/display/devices/XDRIVER/lib/ipc.new/ # src/libes/raster/ipc.new/ # # TODO: # The updated driver has to be tested and finally made to be standard # driver. # # NOTE: # The $GISBASE/dev/fifo* files are still required. However, these files # need not to be FIFO files. It's ok if these files are just zero size # file, not FIFO nor other special file. IPC drivers communicate through # these files. # # KNOWN BUGS: # Killing the monitor has to be done with d.mon stop=name. This is # the only way to get rid of the message-queues. If you destroy a monitor # without d.mon, the monitor will be unusable till your computer reboot, # maybe. ############################################################################# # # Please test new XDRIVER and report bugs to developers list. # # ./README.ipc new # # Then you can revert to original XDRIVER. # # ./README.ipc orig # ############################################################################# SOURCES=" src/display/devices/XDRIVER/XDRIVER24/IPC_NEW/SWITCHER.c src/display/devices/XDRIVER/lib/IPC_NEW/connect.c src/libes/raster/IPC_NEW/io.c " ############################################################################# if [ ! -f INSTALL -o ! -f NEWS.html -o "$0" != "./README.ipc" ] then echo echo "This should be run under grass root directory." echo exit fi ########## MANUAL EXECUTION if [ ! "$GRASS_IN_CONFIGURE" ] then if [ ! -f config.status -o ! -f Makefile ] then echo echo "You must ./configure first. Or GRASS is not installed." echo "Read INSTALL for more information." echo exit fi GISBASE=`grep '^GISBASE=' Makefile | sed 's/^GISBASE=[ ]*//'` if [ ! -d $GISBASE/dev ] then echo echo "You must install GRASS first." echo "Read INSTALL for more information." echo exit fi GRASS_BIN=`grep '^GRASS_BIN=' Makefile | sed 's/^GRASS_BIN=[ ]*//'` GMAKE5= # Search for gmake5 command in user's path for i in `echo $PATH | sed 's/^:/.:/ s/::/:.:/g s/:$/:./ s/:/ /g'` $GRASS_BIN do if [ -f $i/gmake5 ] ; then # Save the path of the gmake5 command GMAKE5=$i/gmake5 # Use the first one in user's path break fi done if [ ! "$GMAKE5" ] then echo echo "gmake5 is not under \$PATH nor $GRASS_BIN." echo exit fi if [ $# -eq 0 -o "$1" = "help" ] then echo echo "Please read README.ipc first." echo echo "Usage:" echo " ./README.ipc [-n] [-f] [-m] [new|orig]" echo echo " -n: Do not compile" echo " -f: Force to compile" echo " -m: Compile d.mon only" echo exit fi ########## END OF MANUAL EXECUTION fi compile=1 dmon=0 sources="" cmd="" for i do case $i in -n) compile=0 sources=" sources" ;; -f) compile=2 sources="" ;; -m) dmon=1 if [ $compile -eq 0 ] then compile=1 fi sources="" ;; new|orig) cmd=$i ;; *) echo echo "$i: Invalid argument" echo exit ;; esac shift done if [ "$cmd" = "" ] then echo echo "Using current sources" echo fi changed=0 if [ "$cmd" = "new" ] then for i in $SOURCES do src=`echo $i | sed 's|IPC_NEW/||'` new=`echo $i | sed 's|IPC_NEW/|ipc.new/|'` diff $new $src > /dev/null 2>&1 if [ $? -eq 0 ] then continue fi changed=1 echo cp $new $src cp $new $src done elif [ "$cmd" = "orig" ] then for i in $SOURCES do src=`echo $i | sed 's|IPC_NEW/||'` org=`echo $i | sed 's|IPC_NEW/|fifo.orig/|'` diff $org $src > /dev/null 2>&1 if [ $? -eq 0 ] then continue fi changed=1 echo cp $org $src cp $org $src done fi if [ "$GRASS_IN_CONFIGURE" ] then exit fi if [ ! -f $GISBASE/dev/create_ipcs.sh ] then cp src/scripts/shells/create_ipcs.sh $GISBASE/dev/create_ipcs.sh chmod 755 $GISBASE/dev/create_ipcs.sh fi if [ ! -f $GISBASE/dev/create_fifos.sh ] then cp src/scripts/shells/create_fifos.sh $GISBASE/dev/create_fifos.sh chmod 755 $GISBASE/dev/create_fifos.sh fi if [ "$cmd" = "new" -a -p $GISBASE/dev/fifo.1a ] then sh $GISBASE/dev/create_ipcs.sh $GISBASE elif [ "$cmd" = "orig" -a -f $GISBASE/dev/fifo.1a ] then sh $GISBASE/dev/create_fifos.sh $GISBASE fi if [ $changed -eq 0 -a $compile -ne 2 -a "$cmd" != "" ] then echo if [ "$cmd" = "new" ] then echo "It's already new driver$sources." elif [ "$cmd" = "orig" ] then echo "It's already original driver$sources." fi echo exit fi if [ $compile -eq 0 ] then exit fi (cd src/display/devices/XDRIVER && $GMAKE5) (cd src/libes/raster && $GMAKE5) if [ $dmon -eq 1 ] then (cd src/display/d.mon && $GMAKE5) else (cd src/display && $GMAKE5) (cd src/raster && $GMAKE5) (cd src/mapdev && $GMAKE5) (cd src/paint/Drivers/preview && $GMAKE5) (cd src/paint/Drivers/preview2 && $GMAKE5) fi echo echo "Thanks for your time." echo "If you have more time, you might want to recompile entire sources. :-)" echo