Improved Mac experience; QDoubleSpinBox for BitcoinAmountField
[novacoin.git] / contrib / create_osx_dmg.sh
1 #!/usr/bin/env bash
2
3 # Creates a Bitcoin.dmg OSX file from the contrib/BitcoinTemplate.dmg file
4 #
5 # Recipe from: http://digital-sushi.org/entry/how-to-create-a-disk-image-installer-for-apple-mac-os-x/
6 #
7 # To make a prettier BitcoinTemplate.dmg:
8 #  + open (mount) BitcoinTemplate.dmg
9 #  + change the file properties, icon positions, background image, etc
10 #  + eject, then commit the changed BitcoinTemplate.dmg
11 #
12
13 CWD=$(pwd)
14
15 if [ $# -lt 1 ]; then
16     if [ $(basename $CWD) == "contrib" ]
17     then
18         TOP=$(dirname $CWD)
19     else
20         echo "Usage: $0 /path/to/bitcoin/tree"
21         exit 1
22     fi
23 else
24     TOP=$1
25 fi
26
27 CONTRIB=$TOP/contrib
28 BUILD_DIR=/tmp/bitcoin_osx_build
29
30 # First, compile bitcoin and bitcoind
31 cd "$TOP/src"
32 if [ ! -e bitcoin ]; then make -f makefile.osx bitcoin; fi
33 if [ ! -e bitcoind ]; then make -f makefile.osx bitcoind; fi
34 strip bitcoin bitcoind
35
36 mkdir -p "$BUILD_DIR"
37 cd "$BUILD_DIR"
38
39 rm -f Bitcoin.sparseimage
40 hdiutil convert "$CONTRIB/BitcoinTemplate.dmg" -format UDSP -o Bitcoin
41 hdiutil mount Bitcoin.sparseimage
42
43 # Copy over placeholders in /Volumes/Bitcoin
44 cp "$TOP/src/bitcoind" /Volumes/Bitcoin/
45 cp "$TOP/src/bitcoin" /Volumes/Bitcoin/Bitcoin.app/Contents/MacOS/
46
47 # Create source code .zip
48 cd "$TOP"
49 git archive -o /Volumes/Bitcoin/bitcoin.zip $(git branch 2>/dev/null|grep -e ^* | cut -d ' ' -f 2)
50
51 # Fix permissions
52 chmod -Rf go-w /Volumes/Bitcoin
53
54 cd "$BUILD_DIR"
55 hdiutil eject /Volumes/Bitcoin
56 rm -f "$CWD/Bitcoin.dmg"
57 hdiutil convert Bitcoin.sparseimage -format UDBZ -o "$CWD/Bitcoin.dmg"
58
59 cd "$CWD"
60 rm -rf "$BUILD_DIR"