1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
6 | **
|
---|
7 | ** This file is part of the tools applications of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at qt-info@nokia.com.
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 | #include "../shared/shared.h"
|
---|
42 | #include <qdir.h>
|
---|
43 |
|
---|
44 | int main(int argc, char **argv)
|
---|
45 | {
|
---|
46 | QString appBundlePath;
|
---|
47 | if (argc > 1)
|
---|
48 | appBundlePath = QString::fromLocal8Bit(argv[1]);
|
---|
49 |
|
---|
50 | if (argc < 2 || appBundlePath.startsWith("-")) {
|
---|
51 | qDebug() << "Usage: macdeployqt app-bundle [options]";
|
---|
52 | qDebug() << "";
|
---|
53 | qDebug() << "Options:";
|
---|
54 | qDebug() << " -verbose=<0-3> : 0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug";
|
---|
55 | qDebug() << " -no-plugins : Skip plugin deployment";
|
---|
56 | qDebug() << " -dmg : Create a .dmg disk image";
|
---|
57 | qDebug() << " -no-strip : Don't run 'strip' on the binaries";
|
---|
58 | qDebug() << " -use-debug-libs : Deploy with debug versions of frameworks and plugins (implies -no-strip)";
|
---|
59 | qDebug() << "";
|
---|
60 | qDebug() << "macdeployqt takes an application bundle as input and makes it";
|
---|
61 | qDebug() << "self-contained by copying in the Qt frameworks and plugins that";
|
---|
62 | qDebug() << "the application uses.";
|
---|
63 | qDebug() << "";
|
---|
64 | qDebug() << "Plugins related to a framework are copied in with the";
|
---|
65 | qDebug() << "framework. The accessibilty, image formats, and text codec";
|
---|
66 | qDebug() << "plugins are always copied, unless \"-no-plugins\" is specified.";
|
---|
67 | qDebug() << "";
|
---|
68 | qDebug() << "See the \"Deploying an Application on Qt/Mac\" topic in the";
|
---|
69 | qDebug() << "documentation for more information about deployment on Mac OS X.";
|
---|
70 |
|
---|
71 | return 0;
|
---|
72 | }
|
---|
73 |
|
---|
74 | if (appBundlePath.endsWith("/"))
|
---|
75 | appBundlePath.chop(1);
|
---|
76 |
|
---|
77 | if (QDir().exists(appBundlePath) == false) {
|
---|
78 | qDebug() << "Error: Could not find app bundle" << appBundlePath;
|
---|
79 | return 0;
|
---|
80 | }
|
---|
81 |
|
---|
82 | bool plugins = true;
|
---|
83 | bool dmg = false;
|
---|
84 | bool useDebugLibs = false;
|
---|
85 | extern bool runStripEnabled;
|
---|
86 |
|
---|
87 | for (int i = 2; i < argc; ++i) {
|
---|
88 | QByteArray argument = QByteArray(argv[i]);
|
---|
89 | if (argument == QByteArray("-no-plugins")) {
|
---|
90 | LogDebug() << "Argument found:" << argument;
|
---|
91 | plugins = false;
|
---|
92 | } else if (argument == QByteArray("-dmg")) {
|
---|
93 | LogDebug() << "Argument found:" << argument;
|
---|
94 | dmg = true;
|
---|
95 | } else if (argument == QByteArray("-no-strip")) {
|
---|
96 | LogDebug() << "Argument found:" << argument;
|
---|
97 | runStripEnabled = false;
|
---|
98 | } else if (argument == QByteArray("-use-debug-libs")) {
|
---|
99 | LogDebug() << "Argument found:" << argument;
|
---|
100 | useDebugLibs = true;
|
---|
101 | runStripEnabled = false;
|
---|
102 | } else if (argument.startsWith(QByteArray("-verbose"))) {
|
---|
103 | LogDebug() << "Argument found:" << argument;
|
---|
104 | int index = argument.indexOf("=");
|
---|
105 | bool ok = false;
|
---|
106 | int number = argument.mid(index+1).toInt(&ok);
|
---|
107 | if (!ok)
|
---|
108 | LogError() << "Could not parse verbose level";
|
---|
109 | else
|
---|
110 | logLevel = number;
|
---|
111 | } else if (argument.startsWith("-")) {
|
---|
112 | LogError() << "Unknown argument" << argument << "\n";
|
---|
113 | return 0;
|
---|
114 | }
|
---|
115 | }
|
---|
116 |
|
---|
117 | DeploymentInfo deploymentInfo = deployQtFrameworks(appBundlePath, useDebugLibs);
|
---|
118 |
|
---|
119 | if (plugins) {
|
---|
120 | if (deploymentInfo.qtPath.isEmpty())
|
---|
121 | deploymentInfo.pluginPath = "/Developer/Applications/Qt/plugins"; // Assume binary package.
|
---|
122 | else
|
---|
123 | deploymentInfo.pluginPath = deploymentInfo.qtPath + "/plugins";
|
---|
124 |
|
---|
125 | LogNormal();
|
---|
126 | deployPlugins(appBundlePath, deploymentInfo, useDebugLibs);
|
---|
127 | createQtConf(appBundlePath);
|
---|
128 | }
|
---|
129 |
|
---|
130 | if (dmg) {
|
---|
131 | LogNormal();
|
---|
132 | createDiskImage(appBundlePath);
|
---|
133 | }
|
---|
134 | }
|
---|
135 |
|
---|