Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2004:
[Freeciv-Dev] (PR#8386) building out of a builddir: autogen.sh
Home

[Freeciv-Dev] (PR#8386) building out of a builddir: autogen.sh

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8386) building out of a builddir: autogen.sh
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Mar 2004 15:27:33 -0800
Reply-to: rt@xxxxxxxxxxx

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

As explained in PR#8164 it is hard to build freeciv out of a builddir 
different from the srcdir.

Autogen.sh can only be run from the srcdir, and creates configure in 
that srcdir.  This means to use a separate builddir you must run "make 
distclean" before re-running configure from the builddir.

This patch allows autogen.sh to be run from the builddir.  Basically we 
just have to chdir to the srcdir to do the auto* stuff, then chdir back 
to the builddir before running configure.

This allows stuff like:

   cvs co freeciv
   mkdir build
   cd build
   ../freeciv/autogen.sh && make

and you'll get Freeciv with 'build' as your builddir.

If you run the autogen.sh step more than once simultaneously you'll 
still get problems.  So to have several builddirs you must first run 
autogen.sh from one of them, then run configure directly from the others.

Another alternative would be to have autogen.sh not call configure. 
However this would take a lot more work and would require the removal of 
several features of autogen.sh.

jason

? Womoks
Index: autogen.sh
===================================================================
RCS file: /home/freeciv/CVS/freeciv/autogen.sh,v
retrieving revision 1.14
diff -u -r1.14 autogen.sh
--- autogen.sh  8 Sep 2003 16:33:28 -0000       1.14
+++ autogen.sh  25 Mar 2004 23:22:16 -0000
@@ -5,6 +5,9 @@
 package=freeciv
 srcfile=client/civclient.h
 
+SRCDIR=`dirname $0`
+BUILDDIR=`pwd`
+
 # Uncomment the line below to debug this file
 #DEBUG=defined
 
@@ -105,8 +108,11 @@
   fi
 }
 
+# Chdir to the srcdir, then run auto* tools.
+cd $SRCDIR
+
 [ -f $srcfile ] || {
-  echo "You must run this script in the top-level $package directory"
+  echo "Are you sure $SRCDIR is a valid source directory?"
   exit 1
 }
 
@@ -196,6 +202,9 @@
   exit 1
 }
 
+# Chdir back to the builddir before the configure step.
+cd $BUILDDIR
+
 # now remove the cache, because it can be considered dangerous in this case
 echo "+ removing config.cache ... "
 rm -f config.cache
@@ -210,21 +219,21 @@
 fi
 echo
 
-./configure $FC_NEWARGLINE || {
+$SRCDIR/configure $FC_NEWARGLINE || {
   echo
   echo "configure failed"
   exit 1
 }
 
 # Reverse changes to make tree sane
-[ -f configure.old ] && { 
-  mv configure.old configure.in 
+[ -f $SRCDIR/configure.old ] && { 
+  mv $SRCDIR/configure.old $SRCDIR/configure.in 
 }
-[ -f configure.old2 ] && { 
-  mv configure.old2 configure.ac 
+[ -f $SRCDIR/configure.old2 ] && { 
+  mv $SRCDIR/configure.old2 $SRCDIR/configure.ac 
 }
-[ -f acconfig.h ] && { 
-  mv acconfig.h acconfig.old
+[ -f $SRCDIR/acconfig.h ] && { 
+  mv $SRCDIR/acconfig.h $SRCDIR/acconfig.old
 }
 
 # abort if we did --help

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#8386) building out of a builddir: autogen.sh, Jason Short <=