diff options
author | Artem Dyomin <artem.dyomin@qt.io> | 2024-01-23 13:29:27 +0100 |
---|---|---|
committer | Artem Dyomin <artem.dyomin@qt.io> | 2024-03-13 11:54:46 +0000 |
commit | a53b63019fc76d36f340ff2dfc607999f08d7053 (patch) | |
tree | 6d289009462c0b056c27cf6b4c10e34f574d330b /coin/provisioning/common/macos | |
parent | a84104df1ca3935e62f80f106d7623d399819f90 (diff) |
Implement dynamical ffmpeg linking on macOS
* fix dependencies and install names (absolute => relative)
* fix compilation build of dylib on xcode 15.
* add matching build instructions to yaml.
* old macos versions don't have 'realpath', workaround is used.
Task-number: QTBUG-120989
Pick-to: 6.7 6.6 6.5
Change-Id: I22e413d8f6d05c8c7d6d09a5926691216e781fd3
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
Diffstat (limited to 'coin/provisioning/common/macos')
-rwxr-xr-x | coin/provisioning/common/macos/fix_relative_dependencies.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/coin/provisioning/common/macos/fix_relative_dependencies.sh b/coin/provisioning/common/macos/fix_relative_dependencies.sh new file mode 100755 index 00000000..930fc110 --- /dev/null +++ b/coin/provisioning/common/macos/fix_relative_dependencies.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +set -e + +# realpath is not included to macOS <= 12. +# dir=$(realpath "$1") +dir=$(cd "$1" && pwd) + +dir_length=${#dir} +dylib_regex="^$dir/.*\.dylib$" + +find "$dir" -type f -name '*.dylib' | while read -r library_path; do + install_name=$(otool -D "$library_path" | sed -n '2p' | egrep "$dylib_regex" ) + if [ -n "$install_name" ]; then + fixed_install_name="@rpath${install_name:dir_length}" + install_name_tool -id "$fixed_install_name" "$library_path" + fi + + otool -L "$library_path" | awk '/\t/ {print $1}' | egrep "$dylib_regex" | while read -r dependency_path; do + fixed_dependency_path="@loader_path${dependency_path:dir_length}" + install_name_tool -change "$dependency_path" "$fixed_dependency_path" "$library_path" + done +done |