Allow passing a build directory on the command line. Also, if the
build directory is found to exist we don't clean it up. We also
use configure -C. All this lets us keep build directories, which
graeatly speeds up the process of debugging installers.
diff --git a/Mac/OSX/Dist/build b/Mac/OSX/Dist/build
index 809f8ff..a3f3722 100755
--- a/Mac/OSX/Dist/build
+++ b/Mac/OSX/Dist/build
@@ -22,7 +22,6 @@
 TMPDIR=/tmp/_py
 #TMPDIR=/projects/_py
 
-BUILDROOT=$TMPDIR/build
 INSTALLROOT=$TMPDIR/install
 DMGDIR=$TMPDIR/dmg
 RESOURCEDIR=$PROGDIR/resources
@@ -30,9 +29,24 @@
 PYTHONSRC=$PROGDIR/../../..
 WASTEDIR=$PYTHONSRC/../waste
 
+case x$1 in
+x)
+	BUILDROOT=$TMPDIR/build
+	;;
+*)
+	BUILDROOT=$1
+	;;
+esac
+
 # Setup
-mkdir -p $BUILDROOT
-mkdir -p $INSTALLROOT
+if [ -e $BUILDROOT ]; then
+	echo Using existing build directory $BUILDROOT
+	CLEANBUILD=no
+else
+	echo Creating clean build directory $BUILDROOT
+	CLEANBUILD=yes
+	mkdir -p $BUILDROOT
+fi
 rm -rf $DMGDIR
 mkdir -p $DMGDIR/root
 
@@ -68,9 +82,9 @@
     ln -s $WASTEDIR waste
 fi
 
-$PYTHONSRC/configure --enable-framework=$INSTALLROOT/Library/Frameworks LDFLAGS=-Wl,-x
+$PYTHONSRC/configure -C --enable-framework LDFLAGS=-Wl,-x
 make
-make DIRMODE=775 EXEMODE=775 FILEMODE=664 frameworkinstall
+make DIRMODE=775 EXEMODE=775 FILEMODE=664 DESTDIR=$INSTALLROOT frameworkinstall
 
 if [ "$builddocs" = "y" -o "$builddocs" = "Y" ]; then
     ./python.exe $PYTHONSRC/Mac/OSX/setupDocs.py build
@@ -122,12 +136,16 @@
 # Cleanup build/install dirs
 if [ $DOCLEANUP = yes ]; then
     echo "Cleaning up..."
-    rm -rf $BUILDROOT
+    if [ $CLEANBUILD = yes ]; then
+    	rm -rf $BUILDROOT
+    fi
     rm -rf $INSTALLROOT
     rm -rf $DMGDIR
 else
     echo "Cleanup is disabled.  You should remove these dirs when done:"
-    echo "          $BUILDROOT"
+    if [ $CLEANBUILD = yes ]; then
+    	echo "          $BUILDROOT"
+    fi
     echo "          $INSTALLROOT"
     echo "          $DMGDIR"
 fi