Skip to content

Commit 6cd005c

Browse files
authored
Merge pull request #37653 from ahoppen/pr-5.5/internal-syntax-parser-fat
[5.5][build-script] Make `lib_InternalSwiftSyntaxParser.dylib` and `libSwiftScan.dylib` fat
2 parents 27e5c33 + 66158f8 commit 6cd005c

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

utils/build-script-impl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3332,7 +3332,7 @@ if [[ ${#LIPO_SRC_DIRS[@]} -gt 0 ]]; then
33323332
else
33333333
LIPO_PATH="${HOST_LIPO}"
33343334
fi
3335-
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[@]}
3335+
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" --explicit-src-files="$(get_host_install_prefix ${host})lib/swift/${host%%-*}/lib_InternalSwiftScan.dylib $(get_host_install_prefix ${host})lib/swift/${host%%-*}/lib_InternalSwiftSyntaxParser.dylib" --destination="$(get_host_install_destdir ${mergedHost})" ${LIPO_SRC_DIRS[@]}
33363336

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

utils/recursive-lipo

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import shutil
1111
from swift_build_support.swift_build_support import shell
1212

1313

14-
def merge_file_lists(src_root_dirs, skip_files, skip_subpaths):
14+
def merge_file_lists(src_root_dirs, explicit_src_files, skip_files,
15+
skip_subpaths):
1516
"""Merges the file lists recursively from all src_root_dirs supplied,
1617
returning the union of all file paths found.
1718
Files matching skip_files are ignored and skipped.
@@ -29,6 +30,12 @@ def merge_file_lists(src_root_dirs, skip_files, skip_subpaths):
2930
dirs[:] = filter(
3031
lambda dir: os.path.join(rel_dir, dir)
3132
not in skip_subpaths, dirs)
33+
34+
for file in explicit_src_files:
35+
# If this is an absolute installation path, e.g. /Applications/Xcode/...,
36+
# treat it as being relative to a built toolchain
37+
relative_path = file[1:] if file.startswith("/") else file
38+
file_list.append(relative_path) if relative_path not in file_list else file_list
3239
return file_list
3340

3441

@@ -129,6 +136,15 @@ binaries.
129136
default=".DS_Store",
130137
help="Files to ignore and skip merge/copy, default " +
131138
"is \".DS_Store\"")
139+
# A list of files which this script will ensure are merged using lipo.
140+
# The intent is to allow for exceptions to binaries located under
141+
# `copy-subdirs` that are not built fat. However, if more such exceptions
142+
# are added, it would be better to re-think our approach to a more-general
143+
# solution.
144+
parser.add_argument("--explicit-src-files", metavar="<explicit-source-files>",
145+
default="",
146+
help="Optional list of files which should be merged to " +
147+
"be installed")
132148
parser.add_argument("--copy-subdirs", metavar="<subdirs-to-copy-verbatim>",
133149
default="",
134150
help="Optional list of subdirectory paths that " +
@@ -145,11 +161,12 @@ binaries.
145161
args = parser.parse_args()
146162

147163
skip_files = args.skip_files.split()
164+
explicit_sources = args.explicit_src_files.split()
148165
copy_verbatim_subpaths = [
149166
subdir.strip('/') for subdir in args.copy_subdirs.split()]
150167

151-
file_list = merge_file_lists(args.src_root_dirs, skip_files,
152-
copy_verbatim_subpaths)
168+
file_list = merge_file_lists(args.src_root_dirs, explicit_sources,
169+
skip_files, copy_verbatim_subpaths)
153170

154171
if args.verbose:
155172
print("Discovered files and dirs: %s" % file_list)

0 commit comments

Comments
 (0)