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