Skip to content

Commit

Permalink
Merge pull request seub#2 from such/master
Browse files Browse the repository at this point in the history
mate un peu (build mac osx)
  • Loading branch information
seub committed Oct 28, 2012
2 parents 0f6b4a0 + a10b9c7 commit 83c54a4
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CirclePackings.pro
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,5 @@ SOURCES += \
RESOURCES += \
resources.qrc

mac:ICON = images/icon-osx.icns
win32:RC_FILE = CirclePackings.rc
unix:ICON = images/icon.ico
36 changes: 36 additions & 0 deletions build-osx.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/sh

qmake
make
macdeployqt CirclePackings.app
ACTUAL_SIZE=`du -sm "CirclePackings.app" | awk '{print $1}'`
DISK_IMAGE_SIZE=$(expr $ACTUAL_SIZE + 20)
VOLUME_NAME="CirclePackings"
DMG_TEMP_NAME="CirclePackings.tmp"
VOLUME_ICON_FILE="images/icon-osx.icns"

rm -f ${DMG_TEMP_NAME}.dmg
hdiutil create -srcfolder "CirclePackings.app" -volname "${VOLUME_NAME}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${DISK_IMAGE_SIZE}m "${DMG_TEMP_NAME}"
MOUNT_DIR="/Volumes/${VOLUME_NAME}"
echo "Mount directory: $MOUNT_DIR"
DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}.dmg" | egrep '^/dev/' | sed 1q | awk '{print $1}')

echo "making link to Applications dir"
ln -s /Applications "$MOUNT_DIR/Applications"

echo "Copying volume icon file '$VOLUME_ICON_FILE'..."
cp "$VOLUME_ICON_FILE" "$MOUNT_DIR/.VolumeIcon.icns"
SetFile -c icnC "$MOUNT_DIR/.VolumeIcon.icns"

# make sure it's not world writeable
echo "Fixing permissions..."
chmod -Rf go-w "${MOUNT_DIR}" &> /dev/null || true
echo "Done fixing permissions."

# unmount
echo "Unmounting disk image..."
hdiutil detach "${DEV_NAME}"

echo "Compressing disk image..."
hdiutil convert "${DMG_TEMP_NAME}.dmg" -format UDZO -imagekey zlib-level=9 -o "CirclePackings.dmg"
rm -f "${DMG_TEMP_NAME}.dmg"
Binary file added images/icon-osx.icns
Binary file not shown.

0 comments on commit 83c54a4

Please sign in to comment.