e955c94ed3
Listing the "Blender Foundation" as copyright holder implied the Blender Foundation holds copyright to files which may include work from many developers. While keeping copyright on headers makes sense for isolated libraries, Blender's own code may be refactored or moved between files in a way that makes the per file copyright holders less meaningful. Copyright references to the "Blender Foundation" have been replaced with "Blender Authors", with the exception of `./extern/` since these this contains libraries which are more isolated, any changed to license headers there can be handled on a case-by-case basis. Some directories in `./intern/` have also been excluded: - `./intern/cycles/` it's own `AUTHORS` file is planned. - `./intern/opensubdiv/`. An "AUTHORS" file has been added, using the chromium projects authors file as a template. Design task: #110784 Ref !110783.
51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
# SPDX-FileCopyrightText: 2022 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
# macOS utility to remove all `rpaths` and add a new one.
|
|
|
|
import os
|
|
import re
|
|
import subprocess
|
|
import sys
|
|
|
|
|
|
# Strip version numbers from dependenciesm macOS notarizatiom fails
|
|
# with version symlinks.
|
|
def strip_lib_version(name):
|
|
name = re.sub(r'(\.[0-9]+)+.dylib', '.dylib', name)
|
|
name = re.sub(r'(\.[0-9]+)+.so', '.so', name)
|
|
name = re.sub(r'(\.[0-9]+)+.cpython', '.cpython', name)
|
|
return name
|
|
|
|
|
|
rpath = sys.argv[1]
|
|
file = sys.argv[2]
|
|
|
|
# Find existing rpaths and delete them one by one.
|
|
p = subprocess.run(['otool', '-l', file], capture_output=True)
|
|
tokens = p.stdout.split()
|
|
|
|
for i, token in enumerate(tokens):
|
|
if token == b'LC_RPATH':
|
|
old_rpath = tokens[i + 4]
|
|
subprocess.run(['install_name_tool', '-delete_rpath', old_rpath, file])
|
|
|
|
subprocess.run(['install_name_tool', '-add_rpath', rpath, file])
|
|
|
|
# Strip version from dependencies.
|
|
p = subprocess.run(['otool', '-L', file], capture_output=True)
|
|
tokens = p.stdout.split()
|
|
for i, token in enumerate(tokens):
|
|
token = token.decode("utf-8")
|
|
if token.startswith("@rpath"):
|
|
new_token = strip_lib_version(token)
|
|
subprocess.run(['install_name_tool', '-change', token, new_token, file])
|
|
|
|
# Strip version from library itself.
|
|
new_file = strip_lib_version(file)
|
|
new_id = '@rpath/' + os.path.basename(new_file)
|
|
os.rename(file, new_file)
|
|
subprocess.run(['install_name_tool', '-id', new_id, new_file])
|