1#!/bin/sh 2# 3# This script makes a Apple Mac OSX dmg from the PETSc iOS framework and docset, see ./makeall 4# 5# Make sure that "Enable access for assistive devices" is checked in System Preferences>>Universal Access. It is required for the AppleScript to work. 6# 7hdiutil detach /Volumes/PETSc 8# 9echo "Creating ${PETSC_DIR}/PETSc-iOS.dmg from frameworks in ${PETSC_DIR}/arch-ios-simulator/PETSc-iOS and ${PETSC_DIR}/PETSc.docset" 10echo " and examples in ${PETSC_DIR}/systems/Apple/iOS/examples" 11 12rm -rf pack.temp.dmg tempsource ${PETSC_DIR}/PETSc-iOS.dmg 13mkdir tempsource 14cp -r ${PETSC_DIR}/arch-ios-simulator/PETSc-iOS tempsource 15cp -r ${PETSC_DIR}/PETSc.docset tempsource 16cp -r ${PETSC_DIR}/systems/Apple/iOS/examples tempsource/PETSc-iOS.examples 17 18# copy the PETSc source for the examples into the example directories and modify the include to point to them 19# in the PETSc tree the examples point to the original source elsewhere in the PETSc tree 20cp ${PETSC_DIR}/src/snes/tutorials/ex19.c tempsource/PETSc-iOS.examples/Basic/Classes 21cp ${PETSC_DIR}/src/snes/tutorials/ex48.c tempsource/PETSc-iOS.examples/Basic/Classes 22sed -i "" s?../../../../../../src/snes/tutorials/??g tempsource/PETSc-iOS.examples/Basic/Classes/iphoneViewController.m 23cp ${PETSC_DIR}/src/snes/tutorials/ex19.c tempsource/PETSc-iOS.examples/testopengl/Classes 24cp ${PETSC_DIR}/src/snes/tutorials/ex48.c tempsource/PETSc-iOS.examples/testopengl/Classes 25cp ${PETSC_DIR}/src/sys/classes/draw/tests/ex3.c tempsource/PETSc-iOS.examples/testopengl/Classes 26cp ${PETSC_DIR}/src/sys/classes/draw/tests/ex4.c tempsource/PETSc-iOS.examples/testopengl/Classes 27sed -i "" s?../../../../../../src/snes/tutorials/??g tempsource/PETSc-iOS.examples/testopengl/Classes/iphoneViewController.m 28sed -i "" s?../../../../../../src/sys/classes/draw/tests/??g tempsource/PETSc-iOS.examples/testopengl/Classes/iphoneViewController.m 29 30 31let size=`du -c tempsource | tail -1 | cut -f1` 32let size=2*$size 33 34hdiutil create -srcfolder tempsource -volname PETSc -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${size}k pack.temp.dmg 35sleep 5 36device=`hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | head -1 | cut -f1` 37echo Created device $device 38sleep 5 39echo " 40 tell application \"Finder\" 41 tell disk \"PETSc\" 42 open 43 set current view of container window to icon view 44 set toolbar visible of container window to false 45 set statusbar visible of container window to false 46 make new alias file at container window to POSIX file \"/Library/Frameworks\" with properties {name:\"Copy in PETSc-iOS\"} 47 make new alias file at container window to POSIX file \"${HOME}/Library/Developer/Shared/Documentation/DocSets\" with properties {name:\"Copy in PETSc.docset\"} 48 make new alias file at container window to (path to home folder) with properties {name:\"Copy in PETSc-iOS.examples\"} 49 eject 50 end tell 51 end tell 52" | osascript 53sleep 8 54sync 55sync 56echo 'Completed osascript' 57#hdiutil detach ${device} 58hdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o ${PETSC_DIR}/PETSc-iOS.dmg 59rm -rf pack.temp.dmg tempsource 60sync 61sleep 2 62hdiutil detach /Volumes/PETSc 63 64# set the bounds of container window to {400, 100, 885, 630} 65# set theViewOptions to the icon view options of container window 66# set icon size of theViewOptions to 72 67# set arrangement of theViewOptions to not arranged 68