]> granicus.if.org Git - graphviz/commitdiff
macbuild now has get, prep and build options; make pkg will generate a Mac OS X packa...
authorglenlow <devnull@localhost>
Fri, 15 Feb 2008 23:22:38 +0000 (23:22 +0000)
committerglenlow <devnull@localhost>
Fri, 15 Feb 2008 23:22:38 +0000 (23:22 +0000)
Makefile.am
macbuild

index 578021c9db7eea03bfc59bdcea69c8e2486d608f..897a0b974b2dd9f74289b84078f394b2721678c3 100644 (file)
@@ -41,5 +41,10 @@ EXTRA_DIST = $(txt) $(html) graphviz.spec.in graphviz.spec \
 .PHONY: rpm
 rpm: dist
        rpmbuild -ta graphviz-@VERSION@.tar.gz
+       
+.PHONY: pkg
+pkg: dist
+       ./macbuild --prep=graphviz-@VERSION@.tar.gz
+
 
 DISTCLEANFILES = config.cache builddate.h ast_common.h FEATURE/* graphviz-@VERSION@*
index cd76e52d3d2ce423c7619e3006360aa9afcafa00..c1fed304e37f86ea78556b5db7a06544e65623ab 100755 (executable)
--- a/macbuild
+++ b/macbuild
-#!/bin/sh
+#!/bin/bash
 
 PACKAGEMAKER="/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"
 XCODEBUILD="xcodebuild"
 
-# configure for Universal Binaries
-./configure --disable-dependency-tracking --with-quartz CFLAGS="-arch i386 -arch ppc" LDFLAGS="-arch i386 -arch ppc"
-make
+GRAPHVIZ_BUILDING=
+PACKAGE=
 
-# make into the macosx build directory
-rm -rf macosx/build/usr/local/*
-make DESTDIR=$PWD/macosx/build install
+# first pass -- getting + prepping
 
-# build the GUI application
-$XCODEBUILD -project macosx/graphviz.xcodeproj -configuration Release
+for ARG
+do
+       GET=
+       PREP=
+       BUILD=
+       case $ARG in
+               --help )
+                       cat <<EOF
+Usage: macbuild [options]
 
-# convert the build directory into a package
-$PACKAGEMAKER --doc macosx/graphviz.pmdoc --out $1
+       --help                  display this help and exit
+
+Choose one of the following for each project to build:
+       --get=URL               get the url, prep, build and package
+       --prep=TARBALL  prep the tarball, build and package
+       --build=DIR             build the dir and package
+       
+Optionally specify the following for the output:
+       --package=PACK  output a OS X flat package
+       
+EOF
+                       exit 0
+                       ;;
+               --get=* )
+                       GET=${ARG#*=}
+                       ;;
+               --prep=* )
+                       PREP=${ARG#*=}
+                       ;;
+               --build=* )
+                       BUILD=${ARG#*=}
+                       ;;
+               --package=* )
+                       PACKAGE=${ARG$*=}
+                       ;;
+       esac
+
+       # get the URL of the tarball
+       if [[ $GET != "" ]]
+       then
+               echo
+               echo "GETTING $GET ..."
+               echo
+               
+               PREP=`basename $GET`
+               if [[ ${PREP%%://*} == "scp" ]]
+               then
+                       HOSTFILE="${PREP#scp://}"
+                       scp "${HOSTFILE%%/*}:${HOSTFILE#*/}" "$PREP"
+               else
+                       curl --url "$GET" --output "$PREP"
+               fi
+       fi
+       
+       # prep the tarball
+       if [[ $PREP != "" ]]
+       then
+               echo
+               echo "PREPPING $PREP ..."
+               echo
+               
+               BUILD=`tar -tzf "$PREP" | head -1`
+               BUILD=${BUILD%/}
+               # rm -rf "$BUILD"
+               tar -xzf "$PREP"
+       fi
+       
+       # record the build location for now
+       if [[ $BUILD != "" ]]
+       then
+               pushd "$BUILD"
+               if [[ `expr "${PWD##*/}" : '.*\(graphviz\)'` ]]
+               then
+                       GRAPHVIZ_BUILDING=$PWD
+               fi
+               BUILDINGS[${#BUILDINGS[@]}]=$BUILD
+               popd
+       fi
+done
+
+if [[ $GRAPHVIZ_BUILDING == "" ]]
+then
+       echo
+       echo "Need to specify graphviz URL, tarball or directory for building. Use --get, --prep or --build first."
+       exit 1
+fi
+
+# second pass -- building
+
+for BUILDING in ${BUILDINGS[@]}
+do
+       pushd "$BUILDING"
+       if [[ `expr "${PWD##*/}" : '.*\(graphviz\)'` ]]
+       then
+               echo
+               echo "CONFIGURING $BUILDING ..."
+               echo
+               
+               ./configure --disable-dependency-tracking --with-quartz CFLAGS="-arch i386 -arch ppc -I$GRAPHVIZ_BUILDING/macosx/build/usr/local/include" LDFLAGS="-arch i386 -arch ppc -L$GRAPHVIZ_BUILDING/macosx/build/usr/local/lib"
+               
+               echo
+               echo "MAKING $BUILDING ..."
+               echo
+               
+               make
+               
+               echo
+               echo "XCODEBUILDING $BUILDING ..."
+               echo
+               
+               $XCODEBUILD -project macosx/graphviz.xcodeproj -configuration Release
+               
+               echo
+               echo "INSTALLING $BUILDING ..."
+               echo
+               
+               make DESTDIR="$GRAPHVIZ_BUILDING/macosx/build" install
+       else
+               echo
+               echo "CONFIGURING $BUILDING ..."
+               echo
+               
+               ./configure --disable-dependency-tracking CFLAGS="-arch i386 -arch ppc -I$GRAPHVIZ_BUILDING/macosx/build/usr/local/include" LDFLAGS="-arch i386 -arch ppc -L$GRAPHVIZ_BUILDING/macosx/build/usr/local/lib"
+               
+               echo
+               echo "MAKING $BUILDING ..."
+               echo
+               
+               make
+               
+               echo
+               echo "INSTALLING $BUILDING ..."
+               echo
+               
+               make DESTDIR="$GRAPHVIZ_BUILDING/macosx/build" install
+       fi
+       popd
+done
+
+# third pass -- package everything up
+
+if [[ $PACKAGE == "" ]]
+then
+       PACKAGE="${GRAPHVIZ_BUILDING##*/}.pkg"
+fi
+
+echo
+echo "PACKAGING $PACKAGE ..."
+echo
+
+$PACKAGEMAKER --doc "$GRAPHVIZ_BUILDING/macosx/graphviz.pmdoc" --out $PACKAGE