xref: /petsc/systems/Apple/OSX/bin/makedmg (revision 5c3bfe30a1d40c507bf27de7728a9575308b2c1f)
1e6363104SBarry Smith#!/bin/sh
2e6363104SBarry Smith#
3409736cdSBarry Smith# This script makes a Apple Mac OS X dmg from the PETSc framework and docset, see ./makeall
4e6363104SBarry Smith#
5e6363104SBarry Smith# Make sure that "Enable access for assistive devices" is checked in System Preferences>>Universal Access. It is required for the AppleScript to work.
63923b477SBarry Smith#
7a211788bSBarry Smithecho "Creating ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg from ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework and ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset"
8e6363104SBarry Smithrm -rf pack.temp.dmg tempsource ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg
9e6363104SBarry Smithmkdir tempsource
101263af9aSBarry Smithcp -r ${PETSC_DIR}/${PETSC_ARCH}/PETSc.framework ${PETSC_DIR}/${PETSC_ARCH}/PETSc.docset ${PETSC_DIR}/systems/Apple/OSX/examples tempsource
11*5c3bfe30SBarry Smithcp ${PETSC_DIR}/src/snes/examples/tutorials/ex19.c tempsource/PETSc\ command\ line\ example/examples/PETSc\ command\ line\ example
12*5c3bfe30SBarry Smithcp ${PETSC_DIR}/src/snes/examples/tutorials/ex19.c tempsource/PETSc\ cocoa\ example/examples/PETSc\ cocoa\ example
13*5c3bfe30SBarry Smith
14e6363104SBarry Smithlet size=`du  -c tempsource | tail -1 | cut -f1`
15e6363104SBarry Smithlet size=2*$size
16e6363104SBarry Smith
17e6363104SBarry Smithhdiutil create -srcfolder tempsource -volname PETSc -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${size}k pack.temp.dmg
18e6363104SBarry Smithsleep 5
19e6363104SBarry Smithdevice=`hdiutil attach -readwrite -noverify -noautoopen "pack.temp.dmg" | head -1 | cut -f1`
20e6363104SBarry Smithecho Created device $device
211263af9aSBarry Smithsleep 5
22e6363104SBarry Smithecho '
23e6363104SBarry Smith   tell application "Finder"
24e6363104SBarry Smith     tell disk "PETSc"
25e6363104SBarry Smith           open
26e6363104SBarry Smith           set current view of container window to icon view
27e6363104SBarry Smith           set toolbar visible of container window to false
28e6363104SBarry Smith           set statusbar visible of container window to false
29a211788bSBarry Smith           make new alias file at container window to POSIX file "/Library/Frameworks" with properties {name:"Copy in PETSc.frameworks"}
30a211788bSBarry 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"}
311263af9aSBarry Smith           make new alias file at container window to POSIX file "/Users/barrysmith/" with properties {name:"Copy in examples"}
32e6363104SBarry Smith           eject
33e6363104SBarry Smith     end tell
34e6363104SBarry Smith   end tell
35e6363104SBarry Smith' | osascript
36e6363104SBarry Smithsleep 8
37e6363104SBarry Smithsync
38e6363104SBarry Smithsync
39b0fb1394SBarry Smithecho 'Completed osascript'
40e6363104SBarry Smith#hdiutil detach ${device}
41e6363104SBarry Smithhdiutil convert "pack.temp.dmg" -format UDZO -imagekey zlib-level=9 -o ${PETSC_DIR}/${PETSC_ARCH}/PETSc.dmg
42e6363104SBarry Smithrm -rf pack.temp.dmg tempsource
43*5c3bfe30SBarry Smithsync
44*5c3bfe30SBarry Smithsleep 2
45a211788bSBarry Smithhdiutil detach /Volumes/PETSc
461263af9aSBarry Smith
471263af9aSBarry Smith#           set the bounds of container window to {400, 100, 885, 630}
481263af9aSBarry Smith#           set theViewOptions to the icon view options of container window
491263af9aSBarry Smith#           set icon size of theViewOptions to 72
501263af9aSBarry Smith#           set arrangement of theViewOptions to not arranged
51