MAKE=make
PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
XCODEBUILD=xcodebuild
+PMSURVEY=$(CURDIR)/pmsurvey
# prefix
# graphviz
#
-graphviz.pkg: graphviz.pmdoc usr/local/bin/$(DOT) Release/Graphviz.app postinstall
+graphviz.pkg: usr/local/bin/$(DOT) graphviz.pmdoc/02graphviz-contents.xml postinstall
@echo
@echo PACKAGING GRAPHVIZ...
@echo
- "$(PACKAGEMAKER)" --doc graphviz.pmdoc --out $@
+ "$(PACKAGEMAKER)" --verbose --doc graphviz.pmdoc --out $@
+
+graphviz.pmdoc/02graphviz-contents.xml: Release/Graphviz.app
+ @echo
+ @echo SURVEYING GRAPHVIZ...
+ @echo
+ "$(PMSURVEY)" "$(CURDIR)/Release/Graphviz.app" >$@
usr/local/bin/$(DOT): $(GV_DIR)/cmd/dot/.libs/$(DOT)
@echo
-<pkgref spec="1.12" uuid="9C7B00A4-EC80-4DFD-B683-A517A4FEE263"><config><identifier>com.att.graphviz.cli.pkg</identifier><version>@VERSION@</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true">usr/local</installFrom><installTo mod="true">/usr/local</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>parent</mod><mod>scripts.postinstall.path</mod><mod>installFrom.isRelativeType</mod><mod>installTo.path</mod><mod>version</mod><mod>installTo</mod><mod>identifier</mod></config><scripts><postinstall relative="true" mod="true">postinstall</postinstall></scripts></pkgref>
+<pkgref spec="1.12" uuid="9C7B00A4-EC80-4DFD-B683-A517A4FEE263"><config><identifier>com.att.graphviz.cli.pkg</identifier><version>@VERSION@</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true">usr/local</installFrom><installTo mod="true">/usr/local</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>parent</mod><mod>scripts.postinstall.path</mod><mod>installFrom.isRelativeType</mod><mod>installTo.path</mod><mod>version</mod><mod>installTo</mod><mod>identifier</mod></config><scripts><postinstall relative="true" mod="true">postinstall</postinstall></scripts><contents><file-list>01local-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
-<pkgref spec="1.12" uuid="03F0738B-6325-4254-B837-515A7C080003"><config><identifier>com.att.graphviz.gui.pkg</identifier><version>@VERSION@</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true" mod="true" includeRoot="true">Release/Graphviz.app</installFrom><installTo relocatable="true">/Applications</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>parent</mod><mod>relocatable</mod><mod>version</mod><mod>includeRoot</mod><mod>installFrom.path</mod><mod>identifier</mod></config><contents><file-list>02graphviz-contents.xml</file-list><component id="com.att.graphviz" version="@VERSION@"><mod>isRelocatable</mod><mod>pathMapping</mod></component><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
+<pkgref spec="1.12" uuid="03F0738B-6325-4254-B837-515A7C080003"><config><identifier>com.att.graphviz.gui.pkg</identifier><version>@VERSION@</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true" mod="true" includeRoot="true">Release/Graphviz.app</installFrom><installTo relocatable="true">/Applications</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>parent</mod><mod>relocatable</mod><mod>version</mod><mod>installFrom.isRelativeType</mod><mod>identifier</mod></config><contents><file-list>02graphviz-contents.xml</file-list><component id="com.att.graphviz" path="@abs_top_builddir@/macosx/build/Release/Graphviz.app" version="@VERSION@"><mod>isRelocatable</mod></component><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
-<pkmkdoc spec="1.12"><properties><title>Graphviz</title><organization>com.att</organization><userSees ui="both"/><min-target os="3"/><domain system="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><contents><choice title="Command Line Tools and Libraries" id="cli" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.att.graphviz.cli.pkg"/></choice><choice title="Viewer Application" id="gui" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.att.graphviz.gui.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="en"><resource relative="true" mod="true" type="license">English.lproj/License.rtf</resource></locale></resources><flags/><item type="file">01local.xml</item><item type="file">02graphviz.xml</item><mod>properties.title</mod><mod>properties.systemDomain</mod><mod>properties.anywhereDomain</mod></pkmkdoc>
\ No newline at end of file
+<pkmkdoc spec="1.12"><properties><title>Graphviz</title><organization>com.att</organization><userSees ui="both"/><min-target os="3"/><domain system="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><contents><choice title="Command Line Tools and Libraries" id="cli" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.att.graphviz.cli.pkg"/></choice><choice title="Viewer Application" id="gui" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="com.att.graphviz.gui.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="en"><resource relative="true" mod="true" type="license">English.lproj/License.rtf</resource></locale></resources><flags/><item type="file">01local.xml</item><item type="file">02graphviz.xml</item><mod>properties.systemDomain</mod><mod>properties.anywhereDomain</mod><mod>properties.title</mod></pkmkdoc>
--- /dev/null
+#!/bin/bash
+
+# set up owner, group and permissions for system or user directories (2nd parameter)
+OWNER=root
+GROUP=admin
+DIRMOD=16893 # drwxrwxr-x
+EXEMOD=33277 # -rwxrwxr-x
+LINKMOD=41469 # lrwxrwxr-x
+FILEMOD=33204 # -rw-rw-r--
+
+# recursive survey of directory:
+# ignore cvs, svn and Finder crap
+# choose file mode depending on what kind of file we got
+
+survey ()
+{
+ for file in `ls -1A $1`
+ do
+ case $file in
+ CVS | .svn | .cvsignore | .cvspass | .DS_Store )
+ ;;
+ * )
+ if [ -d "$1/$file" ]
+ then
+ echo "<f n='$file' o='$OWNER' g='$GROUP' p='$DIRMOD'>"
+ survey "$1/$file"
+ echo "<mod>mode</mod>"
+ echo "</f>"
+ elif [ -x "$1/$file" ]
+ then
+ echo "<f n='$file' o='$OWNER' g='$GROUP' p='$EXEMOD'>"
+ echo "<mod>mode</mod>"
+ echo "</f>"
+ elif [ -L "$1/$file" ]
+ then
+ echo "<f n='$file' o='$OWNER' g='$GROUP' p='$LINKMOD'>"
+ echo "<mod>mode</mod>"
+ echo "</f>"
+ else
+ echo "<f n='$file' o='$OWNER' g='$GROUP' p='$FILEMOD'>"
+ echo "<mod>mode</mod>"
+ echo "</f>"
+ fi
+ ;;
+ esac
+ done
+}
+
+# output root XML and top directory, then recursively survey the directories
+
+echo "<?xml version='1.0'?>"
+echo "<pkg-contents spec='1.12'>"
+echo "<f n='${1##*/}' o='$OWNER' g='$GROUP' p='$DIRMOD' pt='$1' m='true' t='file'>"
+survey "$1"
+echo "<mod>mode</mod>"
+echo "</f>"
+echo "</pkg-contents>"