Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2004:
[Freeciv-Dev] (PR#8677) FREECIV_PATH overrides default path
Home

[Freeciv-Dev] (PR#8677) FREECIV_PATH overrides default path

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8677) FREECIV_PATH overrides default path
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 6 May 2004 08:57:39 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8677 >

> [marko.lindqvist@xxxxxxxxxxx - Wed May 05 15:04:03 2004]:
> 
> 
>   Today I found out from autoconf manual that it should define variables 
> called @abs_top_srcdir@ and @abs_top_builddir@. You may want to test 
> using them instead of 'cd ... pwd' tricks.

Indeed.  How about this patch?

jason

Index: civ.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/civ.in,v
retrieving revision 1.2
diff -u -r1.2 civ.in
--- civ.in      4 May 2004 18:33:00 -0000       1.2
+++ civ.in      6 May 2004 15:56:21 -0000
@@ -14,21 +14,16 @@
 #
 #***********************************************************************/
 
-DIR=`dirname $0`
+# Find absolute paths for srcdir and builddir.
+BUILDDIR="@abs_top_builddir@"
+SRCDIR="@abs_top_srcdir@"
 
-# Use cd + pwd instead of manual concatentation in case of absolute paths
-if [ "x$FREECIV_PATH" == "x" ] ; then
-  export FREECIV_PATH="$(cd $DIR ; cd @top_srcdir@/data ; pwd)"
-else
-  export FREECIV_PATH="$FREECIV_PATH:$(cd $DIR ; cd @top_srcdir@/data ; pwd)"
-fi
-
-[ -x $DIR/client/civclient ] && EXE=$DIR/client/civclient
-[ -x $DIR/civclient ] && EXE=$DIR/civclient
+[ -x $BUILDDIR/client/civclient ] && EXE=$BUILDDIR/client/civclient
+[ -x $BUILDDIR/civclient ] && EXE=$BUILDDIR/civclient
 
 if [ "$EXE" = "" ]; then
   echo $0: Unable to find civclient.
   exit 1
 fi
 
-exec $EXE ${1+"$@"}
+cd $SRCDIR && exec $EXE ${1+"$@"}
Index: ser.in
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ser.in,v
retrieving revision 1.2
diff -u -r1.2 ser.in
--- ser.in      4 May 2004 18:33:00 -0000       1.2
+++ ser.in      6 May 2004 15:56:21 -0000
@@ -14,21 +14,16 @@
 #
 #***********************************************************************/
 
-DIR=`dirname $0`
+# Find absolute paths for srcdir and builddir.
+BUILDDIR="@abs_top_builddir@"
+SRCDIR="@abs_top_srcdir@"
 
-# Use cd + pwd instead of manual concatentation in case of absolute paths
-if [ "x$FREECIV_PATH" == "x" ] ; then
-  export FREECIV_PATH="$(cd $DIR ; cd @top_srcdir@/data ; pwd)"
-else
-  export FREECIV_PATH="$FREECIV_PATH:$(cd $DIR ; cd @top_srcdir@/data ; pwd)"
-fi
-
-[ -x $DIR/server/civserver ] && EXE=$DIR/server/civserver
-[ -x $DIR/civserver ] && EXE=$DIR/civserver
+[ -x $BUILDDIR/server/civserver ] && EXE=$BUILDDIR/server/civserver
+[ -x $BUILDDIR/civserver ] && EXE=$BUILDDIR/civserver
 
 if [ "$EXE" = "" ]; then
   echo $0: Unable to find civserver.
   exit 1
 fi
 
-exec $EXE ${1+"$@"}
+cd $SRCDIR && exec $EXE ${1+"$@"}

[Prev in Thread] Current Thread [Next in Thread]