Commits

BarryFSmith committed 03fab7d

apple installer now makes two examples work as stand-alone code not requiring PETSc source tree

Comments (0)

Files changed (1)

systems/Apple/OSX/bin/makedmg

 #
 # Make sure that "Enable access for assistive devices" is checked in System Preferences>>Universal Access. It is required for the AppleScript to work.
 #
+hdiutil detach /Volumes/PETSc
+#
 echo "Creating ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg from ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework and ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset"
 rm -rf pack.temp.dmg tempsource ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg
 mkdir tempsource
-cp -r ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset ${PETSC_DIR}/systems/Apple/OSX/examples tempsource
-cp ${PETSC_DIR}/src/snes/examples/tutorials/ex19.c tempsource/PETSc\ command\ line\ example/examples/PETSc\ command\ line\ example
-cp ${PETSC_DIR}/src/snes/examples/tutorials/ex19.c tempsource/PETSc\ cocoa\ example/examples/PETSc\ cocoa\ example
+cp -r ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset tempsource
+cp -r  ${PETSC_DIR}/systems/Apple/OSX/examples tempsource/PETSc.examples
+
+# copy the PETSc source for the examples into the example directories and modify the include to point to them 
+# in the PETSc tree the examples point to the original source elsewhere in the PETSc tree
+cp ${PETSC_DIR}/src/snes/examples/tutorials/ex19.c tempsource/PETSc.examples/PETSc\ command\ line\ example/PETSc\ command\ line\ example
+sed -i "" s?../../../../../../src/snes/examples/tutorials/??g tempsource/PETSc.examples/PETSc\ command\ line\ example/PETSc\ command\ line\ example/main.c
+cp ${PETSC_DIR}/src/snes/examples/tutorials/ex19.c tempsource/PETSc.examples/PETSc\ cocoa\ example/PETSc\ cocoa\ example
+sed -i "" s?../../../../../../src/snes/examples/tutorials/??g tempsource/PETSc.examples/PETSc\ cocoa\ example/PETSc\ cocoa\ example/AppDelegate.m
 
 let size=`du  -c tempsource | tail -1 | cut -f1`
 let size=2*$size
            set statusbar visible of container window to false
            make new alias file at container window to POSIX file "/Library/Frameworks" with properties {name:"Copy in PETSc.frameworks"}
            make new alias file at container window to POSIX file "/Applications/Xcode.app/Contents/Developer/Documentation/DocSets" with properties {name:"Copy in PETSc.docset"}
-           make new alias file at container window to POSIX file "/Users/barrysmith/" with properties {name:"Copy in examples"}
+           make new alias file at container window to (path to home folder) with properties {name:"Copy in PETSc.examples"}
            eject
      end tell
    end tell