@@ -1667,8 +1667,8 @@ if run_vendor == 'apple':
16671667
16681668 config .target_build_swift_dylib = SubstituteCaptures (
16691669 f"{ escape_for_substitute_captures (config .target_build_swift )} "
1670- r" -parse-as-library -emit-library -o '\1'"
1671- r" -Xlinker -install_name -Xlinker @executable_path/$(basename '\1') "
1670+ r" -parse-as-library -emit-library -o '\1\2 '"
1671+ r" -Xlinker -install_name -Xlinker @executable_path/\2 "
16721672 )
16731673 config .target_add_rpath = SubstituteCaptures (r'-Xlinker -rpath -Xlinker \1' )
16741674
@@ -1766,7 +1766,7 @@ elif run_os in ['windows-msvc']:
17661766 subst_target_swift_frontend_mock_sdk_after = ''
17671767
17681768 config .target_build_swift_dylib = \
1769- SubstituteCaptures (r"%s -parse-as-library -emit-library -o \1" % (
1769+ SubstituteCaptures (r"%s -parse-as-library -emit-library -o \1\2 " % (
17701770 escape_for_substitute_captures (config .target_build_swift )))
17711771 config .target_add_rpath = r''
17721772
@@ -1904,7 +1904,7 @@ elif (run_os in ['linux-gnu', 'linux-gnueabihf', 'freebsd', 'openbsd', 'windows-
19041904 config .target_codesign = "echo"
19051905 config .target_build_swift_dylib = SubstituteCaptures (
19061906 f"{ escape_for_substitute_captures (config .target_build_swift )} "
1907- r" -parse-as-library -emit-library -o '\1'"
1907+ r" -parse-as-library -emit-library -o '\1\2 '"
19081908 )
19091909 config .target_add_rpath = SubstituteCaptures (r'-Xlinker -rpath -Xlinker \1' )
19101910 config .target_swift_frontend = (
@@ -1998,7 +1998,7 @@ elif run_os == 'linux-androideabi' or run_os == 'linux-android':
19981998 config .target_codesign = "echo"
19991999 config .target_build_swift_dylib = SubstituteCaptures (
20002000 f"{ escape_for_substitute_captures (config .target_build_swift )} "
2001- r" -parse-as-library -emit-library -o '\1'"
2001+ r" -parse-as-library -emit-library -o '\1\2 '"
20022002 )
20032003 config .target_add_rpath = SubstituteCaptures (r'-Xlinker -rpath -Xlinker \1' )
20042004 config .target_swift_frontend = ' ' .join ([
@@ -2085,7 +2085,7 @@ elif kIsWASI:
20852085 config .target_codesign = "echo"
20862086 config .target_build_swift_dylib = SubstituteCaptures (
20872087 f"{ escape_for_substitute_captures (config .target_build_swift )} "
2088- r" -parse-as-library -emit-library -static -o '\1'"
2088+ r" -parse-as-library -emit-library -static -o '\1\2 '"
20892089 )
20902090 config .target_add_rpath = ''
20912091 config .target_swift_frontend = ' ' .join ([
@@ -2169,7 +2169,7 @@ elif config.external_embedded_platform:
21692169 config .target_codesign = "echo"
21702170 config .target_build_swift_dylib = SubstituteCaptures (
21712171 f"{ escape_for_substitute_captures (config .target_build_swift )} "
2172- r" -parse-as-library -emit-library -static -o '\1'"
2172+ r" -parse-as-library -emit-library -static -o '\1\2 '"
21732173 )
21742174 config .target_add_rpath = ''
21752175 config .target_swift_frontend = ' ' .join ([
@@ -2940,7 +2940,10 @@ config.substitutions.append(('%target-run-stdlib-swift', config.target_run_stdli
29402940config .substitutions .append (('%target-repl-run-simple-swift' , subst_target_repl_run_simple_swift ))
29412941config .substitutions .append (('%target-run' , config .target_run ))
29422942config .substitutions .append (('%target-jit-run' , subst_target_jit_run ))
2943- config .substitutions .append (('%target-build-swift-dylib\(([^)]+)\)' , config .target_build_swift_dylib ))
2943+ # Capture groups:
2944+ # \1 = path before the file name (non-greedy)
2945+ # \2 = file name (last component, no slashes or parentheses)
2946+ config .substitutions .append (('%target-build-swift-dylib\(([^)]+?)([^/\\ ()]+)\)' , config .target_build_swift_dylib ))
29442947config .substitutions .append (('%target-codesign' , config .target_codesign ))
29452948config .substitutions .append (('%target-build-swift' , config .target_build_swift ))
29462949config .substitutions .append (('%target-clang' , config .target_clang ))
0 commit comments