[6df03c1] | 1 | #!/bin/sh |
---|
| 2 | # |
---|
| 3 | # Run from the unpacked survex-1.0.X directory like so: |
---|
| 4 | # |
---|
| 5 | # ./buildmacosx.sh |
---|
| 6 | # |
---|
| 7 | # If wxWindows is installed somewhere such that wx-config isn't on your |
---|
| 8 | # PATH you need to indicate where wx-config is by running this script |
---|
| 9 | # something like this: |
---|
| 10 | # |
---|
| 11 | # env WXCONFIG=/path/to/wx-config ./buildmacosx.sh |
---|
| 12 | |
---|
| 13 | set -e |
---|
| 14 | test -n "$WXCONFIG" || WXCONFIG=`which wx-config` |
---|
| 15 | if test -z "$WXCONFIG" ; then |
---|
| 16 | echo "WXCONFIG not set and wx-config not on your PATH" |
---|
| 17 | exit 1 |
---|
| 18 | fi |
---|
| 19 | # Force static linking so the user doesn't need to install wxWindows. |
---|
| 20 | WXCONFIG=$WXCONFIG' --static' |
---|
| 21 | export WXCONFIG |
---|
| 22 | rm -rf *.dmg Survex macosx |
---|
| 23 | D="`pwd`/Survex" |
---|
| 24 | T="`pwd`/macosxtmp" |
---|
| 25 | ./configure --prefix="$D" --bindir="$D" --mandir="$T" |
---|
| 26 | make |
---|
| 27 | make install |
---|
| 28 | #mv Survex/survex Survex/Survex |
---|
| 29 | |
---|
| 30 | size=`du -s Survex|sed 's/[^0-9].*//'` |
---|
| 31 | # Allow 1000 extra sectors for various overheads (500 wasn't enough). |
---|
| 32 | sectors=`expr 1000 + $size` |
---|
| 33 | # Partition needs to be at least 4M and sectors are 512 bytes. |
---|
| 34 | if test $sectors -lt 8192 ; then |
---|
| 35 | sectors=8192 |
---|
| 36 | fi |
---|
| 37 | echo "Creating new blank image survex-macosx.dmg of $sectors sectors" |
---|
| 38 | # This just writes ASCII data to the file until it's the correct size. |
---|
| 39 | hdiutil create -sectors $sectors survex-macosx -layout NONE |
---|
| 40 | |
---|
| 41 | # Get the name of the next available device that can be used for mounting |
---|
| 42 | # (attaching). |
---|
| 43 | dev=`hdid -nomount survex-macosx.dmg|tail -1|sed 's!/dev/!!'` |
---|
| 44 | echo "Constructing new HFS+ filesystem on $dev" |
---|
| 45 | # This will initialize /dev/r$dev as a HFS Plus volume. |
---|
| 46 | sudo newfs_hfs -v Survex /dev/r$dev |
---|
| 47 | # We have to eject (detach) the device. |
---|
| 48 | # Note: 'hdiutil info' will show what devices are still attached. |
---|
| 49 | hdiutil eject $dev |
---|
| 50 | |
---|
| 51 | echo "Present image to the filesystems for mounting." |
---|
| 52 | # This will mount the image onto the Desktop. |
---|
| 53 | hdid survex-macosx.dmg |
---|
| 54 | ditto -rsrcFork Survex /Volumes/Survex/Survex |
---|
| 55 | ditto lib/INSTALL.OSX /Volumes/Survex/INSTALL |
---|
| 56 | hdiutil eject $dev |
---|
| 57 | |
---|
| 58 | version="`sed 's/.*AM_INIT_AUTOMAKE([^,]*, *\([0-9.]*\).*/\1/p;d' configure.in`" |
---|
| 59 | file="survex-macosx-`echo $version`.dmg" |
---|
| 60 | echo "Compressing image file survex-macosx.dmg to $file" |
---|
| 61 | hdiutil convert survex-macosx.dmg -format UDCO -o "$file" |
---|
| 62 | # Better compression but needs MacOS X 10.1 or above for unpacking: |
---|
| 63 | #hdiutil convert survex-macosx.dmg -format UDZO -o "$file" |
---|
| 64 | |
---|
| 65 | echo "$file created successfully." |
---|