From 1555ab3094a4a4f778e6fcd95511f5bf325fa6f3 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 26 Jul 2023 16:06:41 +0200 Subject: [PATCH] Build/deploy: Move qt.conf creation to deploy.py Moving things away from deployqtHelper_mac.sh Change-Id: I41810ac060bde63f3b11af852bb2e2f37d822bf4 Reviewed-by: Tim Jenssen --- dist/installer/mac/ios_qt.conf | 2 -- dist/installer/mac/libexec_qt.conf | 5 --- dist/installer/mac/qt.conf | 4 --- scripts/deploy.py | 56 +++++++++++++++++++++++++----- scripts/deployqtHelper_mac.sh | 18 ---------- 5 files changed, 47 insertions(+), 38 deletions(-) delete mode 100644 dist/installer/mac/ios_qt.conf delete mode 100644 dist/installer/mac/libexec_qt.conf delete mode 100644 dist/installer/mac/qt.conf diff --git a/dist/installer/mac/ios_qt.conf b/dist/installer/mac/ios_qt.conf deleted file mode 100644 index 249df1d74cc..00000000000 --- a/dist/installer/mac/ios_qt.conf +++ /dev/null @@ -1,2 +0,0 @@ -[Paths] -Plugins = ../../../PlugIns diff --git a/dist/installer/mac/libexec_qt.conf b/dist/installer/mac/libexec_qt.conf deleted file mode 100644 index 7004d4bec38..00000000000 --- a/dist/installer/mac/libexec_qt.conf +++ /dev/null @@ -1,5 +0,0 @@ -[Paths] -Prefix = ../.. -Imports = Imports/qtquick1 -Qml2Imports = Imports/qtquick2 -Plugins = PlugIns diff --git a/dist/installer/mac/qt.conf b/dist/installer/mac/qt.conf deleted file mode 100644 index 6111f0628ef..00000000000 --- a/dist/installer/mac/qt.conf +++ /dev/null @@ -1,4 +0,0 @@ -[Paths] -Binaries = MacOS -Qml2Imports = Imports/qtquick2 -Plugins = PlugIns diff --git a/scripts/deploy.py b/scripts/deploy.py index 17460930bf8..92f068ddfb0 100755 --- a/scripts/deploy.py +++ b/scripts/deploy.py @@ -197,19 +197,59 @@ def deploy_imports(qtc_binary_path, qt_install): common.copytree(qt_install.qml, destdir, ignore=ignored_qt_lib_files, symlinks=True) +def qt_conf_contents(): + if common.is_linux_platform(): + return '''[Paths] +Prefix={0} +Binaries=bin +Libraries=lib +Plugins=plugins +Qml2Imports=qml +''' + if common.is_windows_platform(): + return '''[Paths] +Prefix={0} +Binaries=. +Libraries=. +Plugins=plugins +Qml2Imports=qml +''' + return '''[Paths] +Prefix={0} +Binaries=MacOS +Libraries=Frameworks +Plugins=PlugIns +Qml2Imports=Imports/qtquick2 +''' + + def add_qt_conf(target_path, qt_prefix_path): qtconf_filepath = os.path.join(target_path, 'qt.conf') prefix_path = os.path.relpath(qt_prefix_path, target_path).replace('\\', '/') print('Creating qt.conf in "{0}":'.format(qtconf_filepath)) f = open(qtconf_filepath, 'w') - f.write('[Paths]\n') - f.write('Prefix={0}\n'.format(prefix_path)) - f.write('Binaries={0}\n'.format('bin' if common.is_linux_platform() else '.')) - f.write('Libraries={0}\n'.format('lib' if common.is_linux_platform() else '.')) - f.write('Plugins=plugins\n') - f.write('Qml2Imports=qml\n') + f.write(qt_conf_contents().format(prefix_path)) f.close() + +def deploy_qt_conf_files(qtc_binary_path): + if common.is_linux_platform(): + qt_prefix_path = os.path.join(qtc_binary_path, '..', 'lib', 'Qt') + add_qt_conf(os.path.join(qtc_binary_path, '..', 'libexec', 'qtcreator'), qt_prefix_path) + add_qt_conf(os.path.join(qtc_binary_path, '..', 'lib', 'Qt', 'bin'), qt_prefix_path) # qtdiag + add_qt_conf(qtc_binary_path, qt_prefix_path) # QtC itself + if common.is_windows_platform(): + add_qt_conf(qtc_binary_path, qtc_binary_path) # QtC itself, libexec, and qtdiag etc + if common.is_mac_platform(): + qt_prefix_path = os.path.join(qtc_binary_path, 'Contents') + qtc_resources_path = os.path.join(qtc_binary_path, 'Contents', 'Resources') + add_qt_conf(os.path.join(qtc_resources_path, 'libexec'), qt_prefix_path) + add_qt_conf(os.path.join(qtc_resources_path, 'libexec', 'ios'), qt_prefix_path) + # The Prefix path for a qt.conf in Contents/Resources/ is handled specially/funny by Qt, + # relative paths are resolved relative to Contents/, so we must enforces Prefix=. + add_qt_conf(qtc_resources_path, qtc_resources_path) # QtC itself + + def deploy_translations(qtc_binary_path, qt_install): print("Copying translations...") translations = glob(os.path.join(qt_install.translations, '*.qm')) @@ -387,6 +427,7 @@ def main(): deploy_plugins(qtcreator_binary_path, qt_install) deploy_imports(qtcreator_binary_path, qt_install) deploy_translations(qtcreator_binary_path, qt_install) + deploy_qt_conf_files(qtcreator_binary_path) if common.is_mac_platform(): deploy_mac(args) @@ -411,9 +452,6 @@ def main(): 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) - add_qt_conf(os.path.join(install_dir, 'libexec', 'qtcreator'), qt_deploy_prefix) # e.g. for qml2puppet - add_qt_conf(os.path.join(qt_deploy_prefix, 'bin'), qt_deploy_prefix) # e.g. qtdiag - add_qt_conf(os.path.join(install_dir, 'bin'), qt_deploy_prefix) if __name__ == "__main__": main() diff --git a/scripts/deployqtHelper_mac.sh b/scripts/deployqtHelper_mac.sh index b58d213138e..c712b920509 100755 --- a/scripts/deployqtHelper_mac.sh +++ b/scripts/deployqtHelper_mac.sh @@ -13,24 +13,6 @@ bin_src="$2" echo "Deploying Qt" -# copy qt creator qt.conf -if [ ! -f "$resource_path/qt.conf" ]; then - echo "- Copying qt.conf" - cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/qt.conf" "$resource_path/qt.conf" || exit 1 -fi - -# copy libexec tools' qt.conf -if [ ! -f "$libexec_path/qt.conf" ]; then - echo "- Copying libexec/qt.conf" - cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/libexec_qt.conf" "$libexec_path/qt.conf" || exit 1 -fi - -# copy ios tools' qt.conf -if [ ! -f "$libexec_path/ios/qt.conf" ]; then - echo "- Copying libexec/ios/qt.conf" - cp -f "$(dirname "${BASH_SOURCE[0]}")/../dist/installer/mac/ios_qt.conf" "$libexec_path/ios/qt.conf" || exit 1 -fi - # copy clang if needed if [ $LLVM_INSTALL_DIR ]; then if [ "$LLVM_INSTALL_DIR"/bin/clangd -nt "$libexec_path"/clang/bin/clangd ]; then