Skip to content

Commit d024c1e

Browse files
committed
Remove --copy-subdirs from recursive-lipo.
We want the `--copy-subdirs` behavior all the time, so remove it as an option and use the new semantics everywhere.
1 parent da87341 commit d024c1e

File tree

2 files changed

+7
-33
lines changed

2 files changed

+7
-33
lines changed

utils/build-script-impl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3579,7 +3579,7 @@ if [[ ${#LIPO_SRC_DIRS[@]} -gt 0 ]]; then
35793579
else
35803580
LIPO_PATH="${HOST_LIPO}"
35813581
fi
3582-
call "${SWIFT_SOURCE_DIR}"/utils/recursive-lipo --lipo=${LIPO_PATH} --copy-subdirs="$(get_host_install_prefix ${host})lib/swift $(get_host_install_prefix ${host})lib/swift_static" --destination="$(get_host_install_destdir ${mergedHost})" ${LIPO_SRC_DIRS[@]}
3582+
call "${SWIFT_SOURCE_DIR}"/utils/recursive-lipo --lipo=${LIPO_PATH} --destination="$(get_host_install_destdir ${mergedHost})" ${LIPO_SRC_DIRS[@]}
35833583

35843584
if [[ $(should_execute_action "${mergedHost}-lipo") ]]; then
35853585
# Build and test the lipo-ed package.

utils/recursive-lipo

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,6 @@ def merge_file_lists(src_root_dirs, skip_files):
2727
return file_list
2828

2929

30-
# Check whether the given file occurs in any of the subpaths provided.
31-
def in_any_subpath(file, subpaths):
32-
current_path = file
33-
while current_path != '':
34-
current_dir = os.path.dirname(current_path)
35-
if current_dir in subpaths:
36-
return True
37-
current_path = current_dir
38-
39-
return False
40-
4130
# Determine if the file paths contain any overlapping architectures.
4231
def overlapping_lipo_architectures(file_paths, lipo_executable):
4332
lipo_cmd = [lipo_executable, "-archs"]
@@ -65,8 +54,8 @@ def copy_file(file, src_root_dirs, dest_root_dir):
6554

6655
print("-- Warning: unable to copy file %s" % file)
6756

68-
def merge_lipo_files(src_root_dirs, file_list, copy_verbatim_subpaths,
69-
dest_root_dir, verbose=False, lipo_executable="lipo"):
57+
def merge_lipo_files(src_root_dirs, file_list, dest_root_dir, verbose=False,
58+
lipo_executable="lipo"):
7059
"""Recursively merges and runs lipo on all files from file_list in
7160
src_root_dirs to destRoorDir.
7261
@@ -76,9 +65,7 @@ def merge_lipo_files(src_root_dirs, file_list, copy_verbatim_subpaths,
7665
it's lipo'ed together from all src_root_dirs into a fat binary.
7766
7867
Any path in file_list that's a directory in src_root_dirs results in a
79-
corresponding subdirectory in dest_root_dir. If the subdirectory path
80-
matches copy_verbatim_subpaths, the whole subdirectory is recursively
81-
copied verbatim.
68+
corresponding subdirectory in dest_root_dir.
8269
"""
8370
lipo_cmd = [lipo_executable, "-create"]
8471

@@ -113,10 +100,7 @@ def merge_lipo_files(src_root_dirs, file_list, copy_verbatim_subpaths,
113100
# All instances are identical, just copy the unique file.
114101
copy_file(file, src_root_dirs, dest_root_dir)
115102
elif all([os.access(item, os.X_OK) for item in file_paths]):
116-
if (overlapping_lipo_architectures(file_paths,
117-
lipo_executable) and
118-
in_any_subpath(file, copy_verbatim_subpaths)):
119-
# We're allowed to copy verbatim from this subpath, and
103+
if overlapping_lipo_architectures(file_paths, lipo_executable):
120104
# lipo will fail due to overlapping architectures, so
121105
# copy the file directly.
122106
copy_file(file, src_root_dirs, dest_root_dir)
@@ -148,10 +132,6 @@ If all the copies of the file in the source directories are the same,
148132
the file is copied directly to the destination. If there are different
149133
files in different directories, but the files are executable,
150134
lipo is run to merge the files together. Otherwise, a warning is produced.
151-
152-
Use --copy-subdirs to override normal logic and copy certain sub directory
153-
paths verbatim. This is useful if some subdirectories already contain fat
154-
binaries.
155135
""")
156136

157137
parser.add_argument("-v", "--verbose", action='store_true',
@@ -163,10 +143,6 @@ binaries.
163143
default=".DS_Store",
164144
help="Files to ignore and skip merge/copy, default " +
165145
"is \".DS_Store\"")
166-
parser.add_argument("--copy-subdirs", metavar="<subdirs-to-copy-verbatim>",
167-
default="",
168-
help="Optional list of subdirectory paths that " +
169-
"should be copied verbatim")
170146

171147
required_group = parser.add_argument_group("required arguments")
172148
required_group.add_argument("--destination", metavar="<dest-path>",
@@ -179,17 +155,15 @@ binaries.
179155
args = parser.parse_args()
180156

181157
skip_files = args.skip_files.split()
182-
copy_verbatim_subpaths = [
183-
subdir.strip('/') for subdir in args.copy_subdirs.split()]
184158

185159
file_list = merge_file_lists(args.src_root_dirs, skip_files)
186160

187161
if args.verbose:
188162
print("Discovered files and dirs: %s" % file_list)
189163

190164
merge_lipo_files(
191-
args.src_root_dirs, file_list, copy_verbatim_subpaths,
192-
args.destination, args.verbose, args.lipo)
165+
args.src_root_dirs, file_list, args.destination, args.verbose,
166+
args.lipo)
193167

194168
return 0
195169

0 commit comments

Comments
 (0)