d26dcc8242466130f5938a407c461d8261502a06
[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 # Create Bitcoin-Qt.app
28 cd "$TOP"
29 if [ ! -e Makefile ]; then qmake bitcoin-qt.pro; fi
30 make
31 macdeployqt Bitcoin-Qt.app
32 # Workaround a bug in macdeployqt: https://bugreports.qt.nokia.com/browse/QTBUG-21913
33 # (when fixed, this won't be necessary)
34 cp /opt/local/lib/db48/libdb_cxx-4.8.dylib Bitcoin-Qt.app/Contents/Frameworks/
35 install_name_tool -id @executable_path/../Frameworks/libdb_cxx-4.8.dylib \
36     Bitcoin-Qt.app/Contents/Frameworks/libdb_cxx-4.8.dylib
37 install_name_tool -change libqt.3.dylib \
38         @executable_path/../Frameworks/libqt.3.dylib \
39         Bitcoin-Qt.app/Contents/MacOS/Bitcoin-Qt
40
41 # Create a .dmg
42 macdeployqt Bitcoin-Qt.app -dmg
43
44 # Compile bitcoind
45 cd "$TOP/src"
46 STATIC=1 make -f makefile.osx
47