@@ -1665,8 +1665,8 @@ if run_vendor == 'apple':
16651665
16661666 config .target_build_swift_dylib = SubstituteCaptures (
16671667 f"{ escape_for_substitute_captures (config .target_build_swift )} "
1668- r" -parse-as-library -emit-library -o '\1'"
1669- r" -Xlinker -install_name -Xlinker @executable_path/$(basename '\1') "
1668+ r" -parse-as-library -emit-library -o '\1\2 '"
1669+ r" -Xlinker -install_name -Xlinker @executable_path/\2 "
16701670 )
16711671 config .target_add_rpath = SubstituteCaptures (r'-Xlinker -rpath -Xlinker \1' )
16721672
@@ -1764,7 +1764,7 @@ elif run_os in ['windows-msvc']:
17641764 subst_target_swift_frontend_mock_sdk_after = ''
17651765
17661766 config .target_build_swift_dylib = \
1767- SubstituteCaptures (r"%s -parse-as-library -emit-library -o \1" % (
1767+ SubstituteCaptures (r"%s -parse-as-library -emit-library -o \1\2 " % (
17681768 escape_for_substitute_captures (config .target_build_swift )))
17691769 config .target_add_rpath = r''
17701770
@@ -1902,7 +1902,7 @@ elif (run_os in ['linux-gnu', 'linux-gnueabihf', 'freebsd', 'openbsd', 'windows-
19021902 config .target_codesign = "echo"
19031903 config .target_build_swift_dylib = SubstituteCaptures (
19041904 f"{ escape_for_substitute_captures (config .target_build_swift )} "
1905- r" -parse-as-library -emit-library -o '\1'"
1905+ r" -parse-as-library -emit-library -o '\1\2 '"
19061906 )
19071907 config .target_add_rpath = SubstituteCaptures (r'-Xlinker -rpath -Xlinker \1' )
19081908 config .target_swift_frontend = (
@@ -1996,7 +1996,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
19961996 config .target_codesign = "echo"
19971997 config .target_build_swift_dylib = SubstituteCaptures (
19981998 f"{ escape_for_substitute_captures (config .target_build_swift )} "
1999- r" -parse-as-library -emit-library -o '\1'"
1999+ r" -parse-as-library -emit-library -o '\1\2 '"
20002000 )
20012001 config .target_add_rpath = SubstituteCaptures (r'-Xlinker -rpath -Xlinker \1' )
20022002 config .target_swift_frontend = ' ' .join ([
@@ -2083,7 +2083,7 @@ elif kIsWASI:
20832083 config .target_codesign = "echo"
20842084 config .target_build_swift_dylib = SubstituteCaptures (
20852085 f"{ escape_for_substitute_captures (config .target_build_swift )} "
2086- r" -parse-as-library -emit-library -static -o '\1'"
2086+ r" -parse-as-library -emit-library -static -o '\1\2 '"
20872087 )
20882088 config .target_add_rpath = ''
20892089 config .target_swift_frontend = ' ' .join ([
@@ -2167,7 +2167,7 @@ elif config.external_embedded_platform:
21672167 config .target_codesign = "echo"
21682168 config .target_build_swift_dylib = SubstituteCaptures (
21692169 f"{ escape_for_substitute_captures (config .target_build_swift )} "
2170- r" -parse-as-library -emit-library -static -o '\1'"
2170+ r" -parse-as-library -emit-library -static -o '\1\2 '"
21712171 )
21722172 config .target_add_rpath = ''
21732173 config .target_swift_frontend = ' ' .join ([
@@ -2938,7 +2938,10 @@ config.substitutions.append(('%target-run-stdlib-swift', config.target_run_stdli
29382938config .substitutions .append (('%target-repl-run-simple-swift' , subst_target_repl_run_simple_swift ))
29392939config .substitutions .append (('%target-run' , config .target_run ))
29402940config .substitutions .append (('%target-jit-run' , subst_target_jit_run ))
2941- config .substitutions .append (('%target-build-swift-dylib\(([^)]+)\)' , config .target_build_swift_dylib ))
2941+ # Capture groups:
2942+ # \1 = path before the file name (non-greedy)
2943+ # \2 = file name (last component, no slashes or parentheses)
2944+ config .substitutions .append (('%target-build-swift-dylib\(([^)]+?)([^/\\ ()]+)\)' , config .target_build_swift_dylib ))
29422945config .substitutions .append (('%target-codesign' , config .target_codesign ))
29432946config .substitutions .append (('%target-build-swift' , config .target_build_swift ))
29442947config .substitutions .append (('%target-clang' , config .target_clang ))
0 commit comments