@@ -22,6 +22,7 @@ extension SwiftSDKGenerator {
22
22
logger. info ( " Launching a container to extract the Swift SDK for the target triple... " )
23
23
try await withDockerContainer ( fromImage: baseDockerImage) { containerID in
24
24
try await inTemporaryDirectory { generator, _ in
25
+ let sdkLibPath = sdkDirPath. appending ( " lib " )
25
26
let sdkUsrPath = sdkDirPath. appending ( " usr " )
26
27
try await generator. createDirectoryIfNeeded ( at: sdkUsrPath)
27
28
try await generator. copyFromDockerContainer (
@@ -60,6 +61,15 @@ extension SwiftSDKGenerator {
60
61
to: sdkUsrLib64Path
61
62
)
62
63
try await createSymlink ( at: sdkDirPath. appending ( " lib64 " ) , pointingTo: " ./usr/lib64 " )
64
+ } else if case let containerLib64 = FilePath ( " /lib64 " ) ,
65
+ try await generator. doesPathExist ( containerLib64, inContainer: containerID)
66
+ {
67
+ let sdkLib64Path = sdkDirPath. appending ( " lib64 " )
68
+ try await generator. copyFromDockerContainer (
69
+ id: containerID,
70
+ from: containerLib64,
71
+ to: sdkLib64Path
72
+ )
63
73
}
64
74
65
75
let sdkUsrLibPath = sdkUsrPath. appending ( " lib " )
@@ -73,12 +83,24 @@ extension SwiftSDKGenerator {
73
83
// https://wiki.ubuntu.com/MultiarchSpec
74
84
// But not in all containers, so don't fail if it does not exist.
75
85
if targetDistribution. name == . ubuntu || targetDistribution. name == . debian {
76
- subpaths += [ ( " \( targetTriple. archName) -linux-gnu " , false ) ]
86
+ let archSubpath =
87
+ switch targetTriple. archName {
88
+ case " armv7 " : " arm-linux-gnueabihf "
89
+ default : " \( targetTriple. archName) -linux-gnu "
90
+ }
77
91
78
- // Custom subpath for armv7
79
- if targetTriple. archName == " armv7 " {
80
- subpaths += [ ( " arm-linux-gnueabihf " , false ) ]
92
+ // Copy /lib/<archSubpath> for Debian 11
93
+ if case let . debian( debian) = targetDistribution, debian == . bullseye {
94
+ try await generator. createDirectoryIfNeeded ( at: sdkLibPath)
95
+ try await generator. copyFromDockerContainer (
96
+ id: containerID,
97
+ from: FilePath ( " /lib " ) . appending ( archSubpath) ,
98
+ to: sdkLibPath. appending ( archSubpath) ,
99
+ failIfNotExists: false
100
+ )
81
101
}
102
+
103
+ subpaths += [ ( archSubpath, false ) ]
82
104
}
83
105
84
106
for ( subpath, failIfNotExists) in subpaths {
@@ -89,7 +111,11 @@ extension SwiftSDKGenerator {
89
111
failIfNotExists: failIfNotExists
90
112
)
91
113
}
92
- try await generator. createSymlink ( at: sdkDirPath. appending ( " lib " ) , pointingTo: " usr/lib " )
114
+
115
+ // Symlink if we do not have a /lib directory in the SDK
116
+ if await ! generator. doesFileExist ( at: sdkLibPath) {
117
+ try await generator. createSymlink ( at: sdkLibPath, pointingTo: " usr/lib " )
118
+ }
93
119
94
120
// Look for 32-bit libraries to remove from RHEL-based distros
95
121
// These are not needed, and the amazonlinux2 x86_64 symlinks are messed up
0 commit comments