aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2023-07-27 11:17:05 +0200
committerEike Ziller <eike.ziller@qt.io>2023-08-28 10:13:50 +0000
commit1766002a976d764a5b9ee1f59d83d840afbba700 (patch)
tree2860f0901021971788d933aa225f2ddfedd7dd7a /scripts
parent1db2fea90bc2f22b204263020ca0b570d27619f4 (diff)
Build/deploy: Move call to macdeployqt to deploy.py
And get rid of deployqtHelper_mac.sh Change-Id: Iab8ba3e36f43c94b21f86a842eb1781a5ca462f2 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/deploy.py92
-rwxr-xr-xscripts/deployqtHelper_mac.sh71
2 files changed, 64 insertions, 99 deletions
diff --git a/scripts/deploy.py b/scripts/deploy.py
index a0b40990a2..5dd6198eca 100755
--- a/scripts/deploy.py
+++ b/scripts/deploy.py
@@ -112,7 +112,7 @@ def ignored_qt_lib_files(path, filenames):
if common.is_linux_platform():
return [fn for fn in filenames if fn.endswith('.cpp.o')]
if common.is_mac_platform():
- return [fn for fn in filenames if fn.endswith('.dylib.dSYM')]
+ return [fn for fn in filenames if fn.endswith('.dylib.dSYM') or fn.startswith('objects-')]
return [fn for fn in filenames
if fn.endswith('.cpp.obj') or is_ignored_windows_file(debug_build, path, fn)]
@@ -391,18 +391,54 @@ def deploy_elfutils(qtc_install_dir, chrpath_bin, args):
print(file, '->', backends_install_path)
shutil.copy(file, backends_install_path)
-def deploy_mac(args):
- (_, qt_install) = get_qt_install_info(args.qmake_binary)
+def deploy_qt_mac(qtc_binary_path, qt_install):
+ # This runs macdeployqt
+ # Collect things to pass via -executable
+ libexec_path = os.path.join(qtc_binary_path, 'Contents', 'Resources', 'libexec')
+ bin_path = os.path.join(qtc_binary_path, 'Contents', 'MacOS')
+ plugins_path = os.path.join(qtc_binary_path, 'Contents', 'PlugIns')
+ frameworks_path = os.path.join(qtc_binary_path, 'Contents', 'Frameworks')
+ additional_paths = []
+ # Qbs
+ apps = ['qbs', 'qbs-config', 'qbs-config-ui', 'qbs-setup-android', 'qbs-setup-qt',
+ 'qbs-setup-toolchains', 'qbs-create-project']
+ for app in apps:
+ additional_paths.append(os.path.join(bin_path, app))
+ additional_paths.append(os.path.join(libexec_path, 'qbs_processlauncher'))
+ # qml2puppet
+ puppets = glob(os.path.join(libexec_path, 'qml2puppet*'))
+ for puppet in puppets:
+ additional_paths.append(puppet)
+ # qtdiag
+ additional_paths.append(os.path.join(bin_path, 'qtdiag'))
+ # other libexec
+ additional_paths.append(os.path.join(libexec_path, 'sdktool'))
+ additional_paths.append(os.path.join(libexec_path, 'qtpromaker'))
+ additional_paths.append(os.path.join(libexec_path, 'buildoutputparser'))
+ additional_paths.append(os.path.join(libexec_path, 'cpaster'))
+ additional_paths.append(os.path.join(libexec_path, 'ios', 'iostool'))
+
+ existing_additional_paths = [p for p in additional_paths if os.path.exists(p)]
+ macdeployqt = os.path.join(qt_install.bin, 'macdeployqt')
+ print('Running macdeployqt (' + macdeployqt + ')')
+ print('- with additional paths:', existing_additional_paths)
+ executable_args = ['-executable='+path for path in existing_additional_paths]
+ subprocess.check_call([macdeployqt, qtc_binary_path] + executable_args)
+
+ # clean up some things that might have been deployed, but we don't want
+ to_remove = [
+ os.path.join(plugins_path, 'tls', 'libqopensslbackend.dylib'),
+ os.path.join(plugins_path, 'sqldrivers', 'libqsqlpsql.dylib'),
+ os.path.join(plugins_path, 'sqldrivers', 'libqsqlodbc.dylib'),
+ ]
+ to_remove.extend(glob(os.path.join(frameworks_path, 'libpq.*dylib')))
+ to_remove.extend(glob(os.path.join(frameworks_path, 'libssl.*dylib')))
+ to_remove.extend(glob(os.path.join(frameworks_path, 'libcrypto.*dylib')))
+ for path in to_remove:
+ if os.path.isfile(path):
+ print('- Removing ' + path)
+ os.remove(path)
- env = dict(os.environ)
- if args.llvm_path:
- env['LLVM_INSTALL_DIR'] = args.llvm_path
-
- script_path = os.path.dirname(os.path.realpath(__file__))
- deployqtHelper_mac = os.path.join(script_path, 'deployqtHelper_mac.sh')
- common.check_print_call([deployqtHelper_mac, args.qtcreator_binary, qt_install.bin,
- qt_install.translations, qt_install.plugins, qt_install.qml],
- env=env)
def get_qt_install_info(qmake_binary):
qt_install_info = common.get_qt_install_info(qmake_binary)
@@ -442,25 +478,25 @@ def main():
deploy_clang(qtcreator_binary_path, args.llvm_path, chrpath_bin)
if common.is_mac_platform():
- deploy_mac(args)
- return
-
- install_dir = os.path.abspath(os.path.join(qtcreator_binary_path, '..'))
- if common.is_linux_platform():
- qt_deploy_prefix = os.path.join(install_dir, 'lib', 'Qt')
+ deploy_qt_mac(qtcreator_binary_path, qt_install)
else:
- qt_deploy_prefix = os.path.join(install_dir, 'bin')
+ install_dir = os.path.abspath(os.path.join(qtcreator_binary_path, '..'))
+ if common.is_linux_platform():
+ qt_deploy_prefix = os.path.join(install_dir, 'lib', 'Qt')
+ else:
+ qt_deploy_prefix = os.path.join(install_dir, 'bin')
- if common.is_windows_platform():
- copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.bin)
- else:
- copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.lib)
+ if common.is_windows_platform():
+ copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.bin)
+ else:
+ copy_qt_libs(qt_deploy_prefix, qt_install.bin, qt_install.lib)
+
+ if args.elfutils_path:
+ deploy_elfutils(install_dir, chrpath_bin, args)
+ if not common.is_windows_platform():
+ print("fixing rpaths...")
+ common.fix_rpaths(install_dir, os.path.join(qt_deploy_prefix, 'lib'), qt_install_info, chrpath_bin)
- if args.elfutils_path:
- deploy_elfutils(install_dir, chrpath_bin, args)
- if not common.is_windows_platform():
- print("fixing rpaths...")
- common.fix_rpaths(install_dir, os.path.join(qt_deploy_prefix, 'lib'), qt_install_info, chrpath_bin)
if __name__ == "__main__":
main()
diff --git a/scripts/deployqtHelper_mac.sh b/scripts/deployqtHelper_mac.sh
deleted file mode 100755
index e0af5cac19..0000000000
--- a/scripts/deployqtHelper_mac.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/bash
-
-# Copyright (C) 2016 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
-
-[ $# -lt 5 ] && echo "Usage: $(basename $0) <app folder> <qt bin folder> <qt translations folder> <qt plugin folder> <qt quick 2 imports folder>" && exit 2
-[ $(uname -s) != "Darwin" ] && echo "Run this script on Mac OS X" && exit 2;
-
-app_path="$1"
-libexec_path="$app_path/Contents/Resources/libexec"
-bin_src="$2"
-
-echo "Deploying Qt"
-
-#### macdeployqt
-
-if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then
-
- echo "- Running macdeployqt ($bin_src/macdeployqt)"
-
- qbsapp="$app_path/Contents/MacOS/qbs"
- if [ -f "$qbsapp" ]; then
- qbsArguments=("-executable=$qbsapp" \
- "-executable=$qbsapp-config" \
- "-executable=$qbsapp-config-ui" \
- "-executable=$qbsapp-setup-android" \
- "-executable=$qbsapp-setup-qt" \
- "-executable=$qbsapp-setup-toolchains" \
- "-executable=$qbsapp-create-project" \
- "-executable=$libexec_path/qbs_processlauncher")
- fi
-
- qml2puppetapp="$libexec_path/qml2puppet"
- if [ -f "$qml2puppetapp" ]; then
- qml2puppetArgument="-executable=$qml2puppetapp"
- fi
- sdktoolapp="$libexec_path/sdktool"
- if [ -f "$sdktoolapp" ]; then
- sdktoolArgument="-executable=$sdktoolapp"
- fi
-
- "$bin_src/macdeployqt" "$app_path" \
- "-executable=$app_path/Contents/MacOS/qtdiag" \
- "-executable=$libexec_path/qtpromaker" \
- "$sdktoolArgument" \
- "-executable=$libexec_path/ios/iostool" \
- "-executable=$libexec_path/buildoutputparser" \
- "-executable=$libexec_path/cpaster" \
- "${qbsArguments[@]}" \
- "$qml2puppetArgument" || exit 1
-
-fi
-
-# clean up unneeded object files that are part of Qt for some static libraries
-find "$app_path" -ipath "*/objects-*" -delete
-
-# clean up after macdeployqt
-# it deploys some plugins (and libs for these) that interfere with what we want
-echo "Cleaning up after macdeployqt..."
-toRemove=(\
- "Contents/PlugIns/tls/libqopensslbackend.dylib" \
- "Contents/PlugIns/sqldrivers/libqsqlpsql.dylib" \
- "Contents/PlugIns/sqldrivers/libqsqlodbc.dylib" \
- "Contents/Frameworks/libpq.*dylib" \
- "Contents/Frameworks/libssl.*dylib" \
- "Contents/Frameworks/libcrypto.*dylib" \
-)
-for f in "${toRemove[@]}"; do
- echo "- removing \"$app_path/$f\""
- rm "$app_path"/$f 2> /dev/null; done
-exit 0