summaryrefslogtreecommitdiffstats
path: root/src/scripts/build_mac_package.sh
blob: cbc0bbd50b6da1d070d0881468de1c3d9a23f343 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#!/bin/bash
#############################################################################
##
## Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
## Contact: Nokia Corporation (qt-info@nokia.com)
##
## This file is part of the QtQuick3D module of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL$
## GNU Lesser General Public License Usage
## This file may be used under the terms of the GNU Lesser General Public
## License version 2.1 as published by the Free Software Foundation and
## appearing in the file LICENSE.LGPL included in the packaging of this
## file. Please review the following information to ensure the GNU Lesser
## General Public License version 2.1 requirements will be met:
## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
##
## In addition, as a special exception, Nokia gives you certain additional
## rights. These rights are described in the Nokia Qt LGPL Exception
## version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
##
## GNU General Public License Usage
## Alternatively, this file may be used under the terms of the GNU General
## Public License version 3.0 as published by the Free Software Foundation
## and appearing in the file LICENSE.GPL included in the packaging of this
## file. Please review the following information to ensure the GNU General
## Public License version 3.0 requirements will be met:
## http://www.gnu.org/copyleft/gpl.html.
##
## Other Usage
## Alternatively, this file may be used in accordance with the terms and
## conditions contained in a signed written agreement between you and Nokia.
##
##
##
##
##
## $QT_END_LICENSE$
##
#############################################################################

set -e

APP=QtQuick3D

PRO=qt3d.pro

if [[ -z "$1" ]]; then
    echo "Usage: build_bundle.sh 1.2.3"
    echo "(where 1.2.3 is the version number)"
    exit 1;
fi

if [[ ! -f ./qt3d.pro ]]; then
    echo "Could not find qt3d.pro in current directory."
    echo "This script should be run from the root of a Qt3D source tree."
    exit 1;
fi

VER=$1

echo "Building ${APP}..."
qmake -makefile -spec macx-g++ -r CONFIG+=release CONFIG+=package qt3d.pro
make $(JOBS)

DIST=dist
DEV=dev
DEV_PKG_ROOT="$DIST/$DEV/Pkg_Root"
mkdir -p $DEV_PKG_ROOT
INSTALL_ROOT=$PWD/dist/dev/Pkg_Root make $(JOBS) install

make docs
DOC_LOC="Developer/Documentation/QtQuick3D"
mkdir -p "$DEV_PKG_ROOT/$DOC_LOC"
mv doc/html "$DEV_PKG_ROOT/$DOC_LOC"

DEV_PKG_RES="$DIST/$DEV/Resources"
mkdir -p $DEV_PKG_RES
cp src/scripts/mac_installer_background.png $DEV_PKG_RES/background.png

XMPL=examples
XMPL_PKG_ROOT="$DIST/$XMPL/Pkg_Root"
mkdir -p "$XMPL_PKG_ROOT"

XMPL_PKG_RES="$DIST/$XMPL/Resources"
mkdir -p $XMPL_PKG_RES
cp src/scripts/mac_installer_background.png $XMPL_PKG_RES/background.png

XMPL_LOC="Applications/QtQuick3D Examples"
mkdir -p "${XMPL_PKG_ROOT}/$XMPL_LOC"
mv "${DEV_PKG_ROOT}/Developer/Tools/Qt" "${XMPL_PKG_ROOT}/$XMPL_LOC"

RELEASE_DIR="../${APP}-${VER}"
mkdir -p "${RELEASE_DIR}"

# http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/packagemaker.1.html
# ...or see $PKGMKR -help for options
# some useful tips at http://homepage.mac.com/simx/technonova/tips/packagemaker_and_installer.html
# but a bit out of date - eg options now have --switch syntax and plist files are not used

PKGMGR="/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker"

## TODO: create VolumeCheck script to ensure 4.7.2 is installed
PKG="${RELEASE_DIR}/${APP}-${VER}-${DEV}.pkg"
$PKGMGR --root "$DEV_PKG_ROOT" \
    --id "com.nokia.qtquick3d.${DEV}" \
    --resources "$DEV_PKG_RES" \
    --title "Core Developer Tools" \
    --target 10.5 --version "$VER" --verbose --out "$PKG"

PKG="${RELEASE_DIR}/${APP}-${VER}-${XMPL}.pkg"
$PKGMGR --root "$XMPL_PKG_ROOT" \
    --id "com.nokia.qtquick3d.${XMPL}" \
    --resources "$XMPL_PKG_RES" \
    --title "Example Applications" \
    --target 10.5 --version "$VER" --verbose --out "$PKG"

DMG="../${APP}-${VER}.dmg"

echo "Placing packages into disk image"
hdiutil create -srcfolder ${RELEASE_DIR} ${DMG}
hdiutil internet-enable -yes ${DMG}

echo "New distributable ready in ${DMG}"