Skip to content

Commit 1db534b

Browse files
committed
Non-Darwin SDKs product results in per-arch directories (Python script)
Depends on swiftlang/swift#19432 Unix (other than Darwin) and Windows do not support fat binaries. However, the build system was placing the build results in the platform/OS folder, instead of the per-architecture folder. Having two architectures side by side was impossible. After applying the above patch in the Swift compiler, non-Darwin platforms will look into the per-architecture folders, so the sibling projects need to leave the products in the right place.
1 parent 771f525 commit 1db534b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

build.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,18 @@
551551

552552
Configuration.current.variables["LIBS_DIRS"] = LIBS_DIRS
553553

554-
extra_script = """
554+
if "darwin" in triple.lower():
555+
extra_script = "INSTALL_TARGET_DIR=${OS}"
556+
else:
557+
extra_script = "INSTALL_TARGET_DIR=${OS}/${ARCH}"
558+
559+
extra_script += """
560+
555561
rule InstallFoundation
556-
command = mkdir -p "${DSTROOT}/${PREFIX}/lib/swift/${OS}"; $
557-
cp "${BUILD_DIR}/Foundation/${DYLIB_PREFIX}Foundation${DYLIB_SUFFIX}" "${DSTROOT}/${PREFIX}/lib/swift/${OS}"; $
558-
mkdir -p "${DSTROOT}/${PREFIX}/lib/swift_static/${OS}"; $
559-
cp "${BUILD_DIR}/Foundation/${STATICLIB_PREFIX}Foundation${STATICLIB_SUFFIX}" "${DSTROOT}/${PREFIX}/lib/swift_static/${OS}"; $
562+
command = mkdir -p "${DSTROOT}/${PREFIX}/lib/swift/${INSTALL_TARGET_DIR}"; $
563+
cp "${BUILD_DIR}/Foundation/${DYLIB_PREFIX}Foundation${DYLIB_SUFFIX}" "${DSTROOT}/${PREFIX}/lib/swift/${INSTALL_TARGET_DIR}"; $
564+
mkdir -p "${DSTROOT}/${PREFIX}/lib/swift_static/${INSTALL_TARGET_DIR}"; $
565+
cp "${BUILD_DIR}/Foundation/${STATICLIB_PREFIX}Foundation${STATICLIB_SUFFIX}" "${DSTROOT}/${PREFIX}/lib/swift_static/${INSTALL_TARGET_DIR}"; $
560566
mkdir -p "${DSTROOT}/${PREFIX}/lib/swift/${OS}/${ARCH}"; $
561567
cp "${BUILD_DIR}/Foundation/Foundation.swiftmodule" "${DSTROOT}/${PREFIX}/lib/swift/${OS}/${ARCH}/"; $
562568
cp "${BUILD_DIR}/Foundation/Foundation.swiftdoc" "${DSTROOT}/${PREFIX}/lib/swift/${OS}/${ARCH}/"; $

0 commit comments

Comments
 (0)