summaryrefslogtreecommitdiffstats
path: root/src/tools/macdeployqt/shared/shared.cpp
Commit message (Collapse)AuthorAgeFilesLines
* macdeployqt: Make sure the app binary is signed after any other binarieKai Köhne2025-11-141-0/+11
| | | | | | | | | | | | | | | This avoids a codesign verification error that may appear as "nested code is modified or invalid". This commit was originally created by https://github.com/tsteven4 https://github.com/qt/qtbase/pull/125 Pick-to: 6.5 6.8 6.10 Change-Id: Ifa0b4ed9da1d7b36cb54f9d2fa6aee48c1fe519c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macdeployqt: fix variable typo & scopeMoss Heim2025-10-221-1/+0
| | | | | | | | | | | Identiy->Identity Variable is not used in shared.cpp so can be made local in macdeployqt main. Pick-to: 6.10 Change-Id: I8893ea0570f41691972116ab0733580176a7b2ba Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macdeployqt: Make code signing with identity "-" the defaultKai Köhne2025-10-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Code signing is now enabled by default using ad-hoc signing (identity "-"), making it an opt-out feature instead of opt-in. Users can now: - Use default ad-hoc signing (no flags needed) - Sign with a specific identity using -codesign=<identity> - Opt out of code signing with the new -no-codesign flag This fix was needed mainly because Qt .framework modules from the Qt Online Installer are now signed by default. As macdeployqt fiddles with rpaths, these signatures broke, making macdeployqt useless without any further signing steps. [ChangeLog][macdeployqt] macdeployqt does now do ad-hoc signing of its content by default. Use the new option -no-codesign to disable that. Fixes: QTBUG-138019 Change-Id: I88b3e54d177fb803867eda8320970a7369c6901d Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* macdeployqt: port to QSaveFileIvan Solovev2025-01-021-10/+14
| | | | | | | | ... to avoid loosing file content in case of write errors. Change-Id: If3f7af1e7260e3b9c3df201ed869988b0bd6df2a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* macdeployqt: adjust to [[nodiscard]] QFile::open()Ivan Solovev2024-12-111-8/+13
| | | | | | | | | | | | The QFile::open() method becomes [[nodiscard]] in Qt 6.10. However, macdeployqt was not adapted to this change. As a result, an attempt to bump the Qt version fails in the CI. This patch fixes the tool. Amends 7466831509fe163f3fd1e3a6bbf38f6f5a32ef00. Change-Id: I0dc0bc4c892f42e58d80da2407ddd83781ad8246 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macdeployqt: Skip qrc files when deploying QML modulesTor Arne Vestbø2024-06-261-0/+3
| | | | | | | | | The logic for deploying QML modules copies the entire QML module directory, which includes build artifacts such as qrc files. Pick-to: 6.8 6.7 6.5 6.2 Change-Id: I7fa5c4c5247d1e2a04b83bb8f897cb58e417dded Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
* macdeployqt: Skip dSYM bundles when deploying QML modulesTor Arne Vestbø2024-06-261-4/+7
| | | | | | | | | | | | | | | | The logic for deploying QML modules copies the entire QML module directory, which includes build artifacts such as dSYM bundles. It's unclear why we special case QML resources, as the needs of a Qt module to deploy its resources goes beyond QML, but that's for later investigations. For now let's skip the dSYM bundles explicitly. Fixes: QTBUG-56590 Pick-to: 6.8 6.7 6.5 6.2 Change-Id: I0f87c452ca3f8f58b0b2a407159881cff071eac0 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
* macdeployqt: Deploy canbus plugins from QtSerialBusTor Arne Vestbø2024-06-251-1/+3
| | | | | | | Fixes: QTBUG-89484 Pick-to: 6.8 6.7 Change-Id: Id72184b0bdb45bd099a2c1a85049c0e84ef30d9f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* macdeployqt: wait forever for otoolMorten Sørvig2024-03-251-1/+1
| | | | | | | | | | | The QProcess default wait time of 30s may be too short in e.g. CI environments where processes may be blocked for a longer time waiting for CPU or IO. Task-number: QTBUG-117598 Change-Id: I27dbe83ddbe811ae4ff28767de67cb0ceaab267e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macdeployqt: Fix codesigning with @loader_pathJonas Kvinge2023-10-171-0/+4
| | | | | | | | | | | When the -executable parameter is specified, macdeployqt uses @loader_path instead of @rpath. This case was not handled in getBinaryDependencies() used for the code signing. Fixes: QTBUG-118075 Pick-to: 6.6 Change-Id: Ie1e0d0781305e1849df9ec0d5fb1c3ce6713a62b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macdeployqt: Also look for app libraries with .so extensionJonas Kvinge2023-09-271-1/+1
| | | | | | | | Fixes deploying glib-networking gio modules which uses .so file extension. Change-Id: I6b4c4e9c3bb5745ffa33d7e83c5853a9372f1ca6 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* tools: use const methods moreAnton Kudryavtsev2023-09-081-2/+2
| | | | | | | to avoid implicit detach Change-Id: I6268d4397631a2a2ff54263dfd0b28a7990c5993 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* macdeployqt: port away from Q_FOREACH and mark the tool free of itMarc Mutz2023-08-051-7/+10
| | | | | | | | | As a drive-by, fix a detach attempt in an existing ranged for-loop by making the container const, and don't re-construct the same QDir three times, just once, at beginning of the function. Change-Id: I5031c4b63dd939ae93dd119b01d1cad5e655f733 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* macdeployqt: Consider debug libs when looking for module dependenciesTor Arne Vestbø2023-05-051-1/+4
| | | | | | | | | | Otherwise we will fail to add plugins such as the SQL plugins, because we think that the Sql module is not in the list of module dependencies. Pick-to: 6.5 Change-Id: Ie03d2506e8d86904f51b4198641ad61a6977e592 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Doc: Remove duplicate wordsAndreas Eliasson2023-02-281-1/+1
| | | | | | Change-Id: Ia7a38a1035bd34d00f20351a0adc3927e473b2e7 Pick-to: 6.5 6.4 6.2 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* macdeployqt: Don't remove rpaths more than onceTor Arne Vestbø2023-01-101-1/+2
| | | | | | | | | | | In a universal build the tool will find multiple duplicated rpaths, but the install_name tool doesn't like it if we try to remove it more than once. Fixes: QTBUG-109738 Pick-to: 6.5 6.4 6.2 Change-Id: I4a8bea0ad3e47b28e6384ceead551edc83e30d26 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macdeployqt: Add networkinformation as plugins to be deployedMårten Nordheim2022-12-071-1/+3
| | | | | | | | | This was missed during original patch Pick-to: 6.4 Fixes: QTBUG-108677 Change-Id: Icd8960f2f41468dc12c3269b12df777acd962753 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* macdeployqt: Fix QtMultimedia plugins deploymentVladimir Belyavsky2022-11-251-1/+1
| | | | | | | | | | | | | It was not updated accordingly after QtMultimedia redesign in Qt 6. This wasn't a real problem because multimedia plugins were eliminated in principle. But it was true only until Qt 6.4, where plugins system for multimedia backends has been reintroduced. Fixes: QTBUG-108742 Fixes: QTBUG-107057 Pick-to: 6.4 Change-Id: I31be5fc20e5bdf8050c04a30492e80d96eb437fb Reviewed-by: Lars Knoll <lars@knoll.priv.no>
* Reland macdeployqt: Don't copy .prl files into the Resources folderMichael Brüning2022-09-021-3/+9
| | | | | | | | | | | | | | QRegularExpression::isValid returns true on default constructed objects, so the filter was always matching even though it was not meant to be applied at all. Fix this by checking that there is a non-empty pattern string set and applying the filter only then. Fixes: QTBUG-87764 Pick-to: 6.4 Change-Id: If37f8abaecacba3dc6f0b14da681a6e025367c10 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Correct typo in destination path variable namesMichael Brüning2022-09-021-6/+6
| | | | | | | A couple of variables contained "Destianation" instead of "Destination" Change-Id: I98a15652347d1b0dad640bc49925ec296830147b Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macdeployqt: Fix deploying libraries with `reexport`Jonas Kvinge2022-09-011-1/+1
| | | | | | | | | | | | | Fixes deploying libgcc, currently it fails to change the rpaths with the following error: ERROR: Could not parse otool output line: "\t/usr/local/opt/gcc/lib/gcc/11/libgcc_s.1.1.dylib (compatibility version 1.0.0, current version 1.1.0, reexport)" Pick-to: 6.3 6.4 Change-Id: I5c866a375f88e3b222cbdbebc167b04174f753b2 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* macdeployqt: macdeployqt process some libraries(e.g. ffmpeg) incorrectGuineng Ni2022-06-151-1/+7
| | | | | | | | | | | ffmpeg and nettle are different from other libraries, they use symbol link as their inner module dependencies. Calling one more install_name_tool can handle this case. Fixes: QTBUG-100093 Pick-to: 6.2 6.3 6.4 Change-Id: I12cdd53bd5aa3120910070ba283178686deb3eb0 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-27/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Tools: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-031-8/+6
| | | | | | | | | As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Task-number: QTBUG-98434 Change-Id: I6d4712a71b5ebf3f379f1f98ea476557bce963ef Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Tools: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-05-021-18/+18
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: Ib9e01ede4e0d7869fc95414d36f37df4a30b16b4 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* macdeployqt: Ignore repeated references to binary when parsing otool -LTor Arne Vestbø2022-04-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | macdeployqt doesn't know or care about universal build (yet), and will just scan all the lines produced by otool -L as if they were for a single architecture, ignoring any lines it doesn't recognize. This fails when the second arch starts off with a reference to the binary we're processing, which then gets interpreted as a dependency of itself. If that binary doesn't have a path, we end up looking for a match in /usr/lib, which we can't find in the best case, or actually end up deploying from an incompatible Qt version in the worst case. Ideally we'd teach macdeployqt about the multiple slices, bur for now we work around it by skipping any references to dependent libraries that match the binary itself. Fixes: QTBUG-102607 Pick-to: 6.2 6.3 5.15 Change-Id: Ia039fafdce90896e61aab90b9c8ac52543cc2c8c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* Misc: Do not depend on transitive includesFabian Kosmale2022-03-171-0/+2
| | | | | | | | As a drive-by, remove superfluous includes from qnetworkmanagerservice.h and obey the coding conventions for includes in a few more places. Change-Id: I65b68c0cef7598d06a125e97637040392d4be9ff Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* macdeployqt: don’t err on unexpected otool outputMorten Johan Sørvig2021-12-151-2/+2
| | | | | | | | | | | | | | | | | Binaries with multiple slices (e.g. arm64, x86_64) will have an extra line for the slice, like: “/path/to/QtGui.framework/QtGui (architecture arm64)” The parsing code will skip this line since it does not match the regexp. In other words the parsing works by looking for lines which matches, and finding lines which don’t match is not an error condition. Pick-to: 6.3 Task-number: QTBUG-98466 Change-Id: I0afebdc0dd19e76de00157518f3409d690f18fc0 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* Move macdeployqt and windeployqt from qttools to qtbaseJoerg Bornemann2021-11-231-0/+1604
Having all *deployqt tools in qtbase will allow us to couple deployment support more tightly with the build system. Change-Id: I299efdacfa6b66a303bb3996ff3ff84e723210a5 Reviewed-by: Kai Koehne <kai.koehne@qt.io>