| 
									
										
										
										
											2012-01-24 13:59:07 +01:00
										 |  |  | #!/bin/bash
 | 
					
						
							| 
									
										
										
										
											2016-01-15 14:52:30 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | ############################################################################ | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Copyright (C) 2016 The Qt Company Ltd. | 
					
						
							|  |  |  | # Contact: https://www.qt.io/licensing/ | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # This file is part of Qt Creator. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # Commercial License Usage | 
					
						
							|  |  |  | # Licensees holding valid commercial Qt licenses may use this file in | 
					
						
							|  |  |  | # accordance with the commercial license agreement provided with the | 
					
						
							|  |  |  | # Software or, alternatively, in accordance with the terms contained in | 
					
						
							|  |  |  | # a written agreement between you and The Qt Company. For licensing terms | 
					
						
							|  |  |  | # and conditions see https://www.qt.io/terms-conditions. For further | 
					
						
							|  |  |  | # information use the contact form at https://www.qt.io/contact-us. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | # GNU General Public License Usage | 
					
						
							|  |  |  | # Alternatively, this file may be used under the terms of the GNU | 
					
						
							|  |  |  | # General Public License version 3 as published by the Free Software | 
					
						
							|  |  |  | # Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT | 
					
						
							|  |  |  | # included in the packaging of this file. Please review the following | 
					
						
							|  |  |  | # information to ensure the GNU General Public License requirements will | 
					
						
							|  |  |  | # be met: https://www.gnu.org/licenses/gpl-3.0.html. | 
					
						
							|  |  |  | # | 
					
						
							|  |  |  | ############################################################################ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-22 16:39:26 +02:00
										 |  |  | [ $# -lt 5 ] && echo "Usage: $(basename $0) <app folder> <qt translations folder> <qt plugin folder> <qt quick imports folder> <qt quick 2 imports folder>" && exit 2 | 
					
						
							| 
									
										
										
										
											2012-11-27 15:04:48 +01:00
										 |  |  | [ $(uname -s) != "Darwin" ] && echo "Run this script on Mac OS X" && exit 2; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  | echo "Deploying Qt" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-10 11:40:12 +01:00
										 |  |  | # collect designer plugins | 
					
						
							|  |  |  | designerDestDir="$1/Contents/PlugIns/designer" | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  | if [ ! -d "$designerDestDir" ]; then | 
					
						
							|  |  |  |     echo "- Copying designer plugins" | 
					
						
							|  |  |  |     mkdir -p "$designerDestDir" | 
					
						
							|  |  |  |     for plugin in "$3"/designer/*.dylib; do | 
					
						
							|  |  |  |         cp "$plugin" "$designerDestDir"/ || exit 1 | 
					
						
							|  |  |  |     done | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2012-12-10 11:40:12 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-22 16:39:26 +02:00
										 |  |  | # copy Qt Quick 1 imports | 
					
						
							|  |  |  | importsDir="$1/Contents/Imports/qtquick1" | 
					
						
							|  |  |  | if [ -d "$4" ]; then | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  |     if [ ! -d "$importsDir" ]; then | 
					
						
							|  |  |  |         echo "- Copying Qt Quick 1 imports" | 
					
						
							|  |  |  |         mkdir -p "$importsDir" | 
					
						
							|  |  |  |         cp -R "$4"/ "$importsDir"/ | 
					
						
							|  |  |  |     fi | 
					
						
							| 
									
										
										
										
											2013-04-22 16:39:26 +02:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # copy Qt Quick 2 imports | 
					
						
							|  |  |  | imports2Dir="$1/Contents/Imports/qtquick2" | 
					
						
							|  |  |  | if [ -d "$5" ]; then | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  |     if [ ! -d "$imports2Dir" ]; then | 
					
						
							|  |  |  |         echo "- Copying Qt Quick 2 imports" | 
					
						
							|  |  |  |         mkdir -p "$imports2Dir" | 
					
						
							|  |  |  |         cp -R "$5"/ "$imports2Dir"/ | 
					
						
							|  |  |  |     fi | 
					
						
							| 
									
										
										
										
											2013-04-22 16:39:26 +02:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-26 15:08:37 +02:00
										 |  |  | # copy qt creator qt.conf | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  | if [ ! -f "$1/Contents/Resources/qt.conf" ]; then | 
					
						
							|  |  |  |     echo "- Copying qt.conf" | 
					
						
							|  |  |  |     cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qt.conf" "$1/Contents/Resources/qt.conf" || exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2012-11-27 15:04:48 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-10-02 16:09:23 +02:00
										 |  |  | # copy ios tools' qt.conf | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  | if [ ! -f "$1/Contents/Resources/ios/qt.conf" ]; then | 
					
						
							|  |  |  |     echo "- Copying ios/qt.conf" | 
					
						
							|  |  |  |     cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/ios_qt.conf" "$1/Contents/Resources/ios/qt.conf" || exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2013-10-02 16:09:23 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-19 12:34:24 +02:00
										 |  |  | # copy qml2puppet's qt.conf | 
					
						
							|  |  |  | if [ ! -f "$1/Contents/Resources/qmldesigner/qt.conf" ]; then | 
					
						
							|  |  |  |     echo "- Copying qmldesigner/qt.conf" | 
					
						
							|  |  |  |     cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qmldesigner_qt.conf" "$1/Contents/Resources/qmldesigner/qt.conf" || exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-27 15:04:48 +01:00
										 |  |  | # copy Qt translations | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  | # check for known existing translation to avoid copying multiple times | 
					
						
							|  |  |  | if [ ! -f "$1/Contents/Resources/translations/qt_de.qm" ]; then | 
					
						
							|  |  |  |     echo "- Copying Qt translations" | 
					
						
							|  |  |  |     cp "$2"/*.qm "$1/Contents/Resources/translations/" || exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2014-01-30 18:20:45 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | # copy libclang if needed | 
					
						
							|  |  |  | if [ $LLVM_INSTALL_DIR ]; then | 
					
						
							| 
									
										
										
										
											2014-02-04 16:14:51 +01:00
										 |  |  |     if [ "$LLVM_INSTALL_DIR"/lib/libclang.dylib -nt "$1/Contents/PlugIns"/libclang.dylib ]; then | 
					
						
							| 
									
										
										
										
											2014-10-28 17:34:36 +01:00
										 |  |  |         echo "- Copying libclang" | 
					
						
							| 
									
										
										
										
											2015-06-18 18:17:27 +02:00
										 |  |  |         mkdir -p "$1/Contents/Frameworks" || exit 1 | 
					
						
							|  |  |  |         # use recursive copy to make it copy symlinks as symlinks | 
					
						
							|  |  |  |         cp -Rf "$LLVM_INSTALL_DIR"/lib/libclang.*dylib "$1/Contents/Frameworks/" || exit 1 | 
					
						
							| 
									
										
										
										
											2014-02-10 14:50:05 +01:00
										 |  |  |         cp -Rf "$LLVM_INSTALL_DIR"/lib/clang "$1/Contents/Resources/cplusplus/" || exit 1 | 
					
						
							| 
									
										
										
										
											2015-07-10 10:18:20 +02:00
										 |  |  |         clangsource="$LLVM_INSTALL_DIR"/bin/clang | 
					
						
							|  |  |  |         clanglinktarget="$(readlink "$clangsource")" | 
					
						
							|  |  |  |         cp -Rf "$clangsource" "$1/Contents/Resources/" || exit 1 | 
					
						
							|  |  |  |         if [ $clanglinktarget ]; then | 
					
						
							|  |  |  |             cp -Rf "$(dirname "$clangsource")/$clanglinktarget" "$1/Contents/Resources/$clanglinktarget" || exit 1 | 
					
						
							|  |  |  |         fi | 
					
						
							| 
									
										
										
										
											2014-02-04 16:14:51 +01:00
										 |  |  |     fi | 
					
						
							| 
									
										
										
										
											2014-07-14 11:56:59 +02:00
										 |  |  |     _CLANG_CODEMODEL_LIB="$1/Contents/PlugIns/libClangCodeModel_debug.dylib" | 
					
						
							| 
									
										
										
										
											2014-01-30 18:20:45 +01:00
										 |  |  |     if [ ! -f "$_CLANG_CODEMODEL_LIB" ]; then | 
					
						
							| 
									
										
										
										
											2014-07-14 11:56:59 +02:00
										 |  |  |         _CLANG_CODEMODEL_LIB="$1/Contents/PlugIns/libClangCodeModel.dylib" | 
					
						
							| 
									
										
										
										
											2014-01-30 18:20:45 +01:00
										 |  |  |     fi | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  |     # this will just fail when run a second time on libClangCodeModel | 
					
						
							| 
									
										
										
										
											2015-02-25 11:19:22 +01:00
										 |  |  |     xcrun install_name_tool -delete_rpath "$LLVM_INSTALL_DIR/lib" "$_CLANG_CODEMODEL_LIB" || true | 
					
						
							| 
									
										
										
										
											2015-06-18 18:17:27 +02:00
										 |  |  |     xcrun install_name_tool -add_rpath "@loader_path/../Frameworks" "$_CLANG_CODEMODEL_LIB" || true | 
					
						
							|  |  |  |     clangbackendArgument="-executable=$1/Contents/Resources/clangbackend" | 
					
						
							| 
									
										
										
										
											2014-01-30 18:20:45 +01:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  | #### macdeployqt | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-28 17:34:36 +01:00
										 |  |  | if [ ! -d "$1/Contents/Frameworks/QtCore.framework" ]; then | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-19 12:34:24 +02:00
										 |  |  |     qml2puppetapp="$1/Contents/Resources/qmldesigner/qml2puppet" | 
					
						
							| 
									
										
										
										
											2014-10-28 17:34:36 +01:00
										 |  |  |     if [ -f "$qml2puppetapp" ]; then | 
					
						
							|  |  |  |         qml2puppetArgument="-executable=$qml2puppetapp" | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-05-17 17:07:47 -07:00
										 |  |  |     qbsapp="$1/Contents/MacOS/qbs" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-28 17:34:36 +01:00
										 |  |  |     echo "- Running macdeployqt ($(which macdeployqt))" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     macdeployqt "$1" \
 | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  |         "-executable=$1/Contents/Resources/qtpromaker" \
 | 
					
						
							|  |  |  |         "-executable=$1/Contents/Resources/sdktool" \
 | 
					
						
							|  |  |  |         "-executable=$1/Contents/Resources/ios/iostool" \
 | 
					
						
							|  |  |  |         "-executable=$1/Contents/Resources/ios/iossim" \
 | 
					
						
							|  |  |  |         "-executable=$1/Contents/Resources/ios/iossim_1_8_2" \
 | 
					
						
							| 
									
										
										
										
											2015-06-18 18:17:27 +02:00
										 |  |  |         "-executable=$1/Contents/Resources/buildoutputparser" \
 | 
					
						
							|  |  |  |         "-executable=$1/Contents/Resources/cpaster" \
 | 
					
						
							| 
									
										
										
										
											2015-05-17 17:07:47 -07:00
										 |  |  |         "-executable=$qbsapp" \
 | 
					
						
							|  |  |  |         "-executable=$qbsapp-config" \
 | 
					
						
							|  |  |  |         "-executable=$qbsapp-config-ui" \
 | 
					
						
							|  |  |  |         "-executable=$qbsapp-qmltypes" \
 | 
					
						
							|  |  |  |         "-executable=$qbsapp-setup-android" \
 | 
					
						
							|  |  |  |         "-executable=$qbsapp-setup-qt" \
 | 
					
						
							|  |  |  |         "-executable=$qbsapp-setup-toolchains" \
 | 
					
						
							| 
									
										
										
										
											2015-07-10 14:53:56 +02:00
										 |  |  |         "$qml2puppetArgument" "$clangbackendArgument" || exit 1 | 
					
						
							| 
									
										
										
										
											2014-10-27 08:53:10 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-10-28 17:34:36 +01:00
										 |  |  | fi |