upgpkg(swift): 5.6.3 to 5.7
This commit is contained in:
parent
089490a69c
commit
669b62f293
|
@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://github.com/apple/swift-corelibs-libdispatch
|
|||
TERMUX_PKG_DESCRIPTION="The libdispatch project, for concurrency on multicore hardware"
|
||||
TERMUX_PKG_LICENSE="Apache-2.0"
|
||||
TERMUX_PKG_MAINTAINER="@buttaface"
|
||||
TERMUX_PKG_VERSION="1:5.6.1"
|
||||
TERMUX_PKG_VERSION="1:5.7"
|
||||
TERMUX_PKG_SRCURL=https://github.com/apple/swift-corelibs-libdispatch/archive/swift-${TERMUX_PKG_VERSION:2}-RELEASE.tar.gz
|
||||
TERMUX_PKG_SHA256=856c9ffcf2ab2bbb28a6e0fa344277fc41aa0771419b283c7c4db69dad2b4cf9
|
||||
TERMUX_PKG_SHA256=b8398571561f3e94053309c55029726af541180e3323ea68e3ca544bbdc57a10
|
||||
TERMUX_PKG_DEPENDS="libc++, libblocksruntime"
|
||||
|
|
|
@ -2,8 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://github.com/apple/swift-llbuild
|
|||
TERMUX_PKG_DESCRIPTION="A low-level build system, used by the Swift Package Manager"
|
||||
TERMUX_PKG_LICENSE="Apache-2.0, NCSA"
|
||||
TERMUX_PKG_MAINTAINER="@buttaface"
|
||||
TERMUX_PKG_VERSION=5.6.1
|
||||
TERMUX_PKG_REVISION=1
|
||||
TERMUX_PKG_VERSION=5.7
|
||||
TERMUX_PKG_SRCURL=https://github.com/apple/swift-llbuild/archive/swift-${TERMUX_PKG_VERSION}-RELEASE.tar.gz
|
||||
TERMUX_PKG_SHA256=3fe038b9b76a90803205d41f440eec46f21f23f42fd6f15be756b68907d04502
|
||||
TERMUX_PKG_SHA256=048bfb7f8b3baece8fc3b4f30ed7a96619a7817c5dbe02976c087eafb610bcd3
|
||||
TERMUX_PKG_DEPENDS="libc++, libandroid-spawn, libsqlite"
|
||||
|
|
|
@ -2,14 +2,14 @@ TERMUX_PKG_HOMEPAGE=https://swift.org/
|
|||
TERMUX_PKG_DESCRIPTION="Swift is a high-performance system programming language"
|
||||
TERMUX_PKG_LICENSE="Apache-2.0, NCSA"
|
||||
TERMUX_PKG_MAINTAINER="@buttaface"
|
||||
TERMUX_PKG_VERSION=5.6.3
|
||||
TERMUX_PKG_VERSION=5.7
|
||||
SWIFT_RELEASE="RELEASE"
|
||||
TERMUX_PKG_SRCURL=https://github.com/apple/swift/archive/swift-$TERMUX_PKG_VERSION-$SWIFT_RELEASE.tar.gz
|
||||
TERMUX_PKG_SHA256=ba76a631b634efebfc5aa01942ab9371e7574f6d69eb08942bbefe04116f039c
|
||||
TERMUX_PKG_SHA256=5385aa70a62d57087c4f34e5cde0f0154dc9e3916bf4ac95a21594433e7db5f8
|
||||
TERMUX_PKG_HOSTBUILD=true
|
||||
TERMUX_PKG_DEPENDS="clang, libandroid-glob, libandroid-posix-semaphore, libandroid-spawn, libcurl, libicu, libicu-static, libsqlite, libuuid, libxml2, libdispatch, llbuild"
|
||||
TERMUX_PKG_BUILD_DEPENDS="rsync"
|
||||
TERMUX_PKG_BLACKLISTED_ARCHES="i686"
|
||||
TERMUX_PKG_BLACKLISTED_ARCHES="arm,i686"
|
||||
TERMUX_PKG_NO_STATICSPLIT=true
|
||||
# Building swift uses CMake, but the standard
|
||||
# termux_step_configure_cmake function is not used. Instead, we set
|
||||
|
@ -34,27 +34,32 @@ termux_step_post_get_source() {
|
|||
mv .temp swift
|
||||
|
||||
declare -A library_checksums
|
||||
library_checksums[swift-cmark]=a950b87ee3165d311d440c688132c42066d4915280df6e80a1a505a942b1dc28
|
||||
library_checksums[llvm-project]=4e414881b7f405a537014ad09004e0b4b4ed29480d8b82da6fbfc8a0d16feaa9
|
||||
library_checksums[swift-corelibs-libdispatch]=e71ebdc2bd573de3af2777816e0f034f29cf16b42025ab3b95e15c71159bab5c
|
||||
library_checksums[swift-corelibs-foundation]=33c27428d29092cbd214d8e8e6f281fffc28f4557f10366e4f6f3ac45b34c315
|
||||
library_checksums[swift-corelibs-xctest]=c5ced7851691ce8b30e333fe49aa94c448cb86e502d49f9921a9679a530a7a2d
|
||||
library_checksums[swift-llbuild]=4b2f230cc1f0a5857717715ddfe7f532d434311c76801c65ca1ad8ace4a9ad18
|
||||
library_checksums[swift-cmark]=1c49d849f4bc4664f88f2938bd8410f29e107b6ae51ef038599b23eae11b4325
|
||||
library_checksums[llvm-project]=0361c7d65344b7bcfea26cccf63387f137192e21268f84956de5be66a25ac7c9
|
||||
library_checksums[swift-experimental-string-processing]=d7282d9cbded01dd944022ec1a6ad9e1157bb0aedd45f2baa7a5ea351dc95862
|
||||
library_checksums[swift-corelibs-libdispatch]=b8398571561f3e94053309c55029726af541180e3323ea68e3ca544bbdc57a10
|
||||
library_checksums[swift-corelibs-foundation]=3a50954f6c821448dec94f3da51e6a101f8fba2ee3da8327637a9150f865411e
|
||||
library_checksums[swift-corelibs-xctest]=c801bf4ca0727214036eb9aa2a8c27b6954b0063569147a4cc9d2a212b9ed9cf
|
||||
library_checksums[swift-llbuild]=048bfb7f8b3baece8fc3b4f30ed7a96619a7817c5dbe02976c087eafb610bcd3
|
||||
library_checksums[swift-argument-parser]=a4d4c08cf280615fe6e00752ef60e28e76f07c25eb4706a9269bf38135cd9c3f
|
||||
library_checksums[Yams]=8bbb28ef994f60afe54668093d652e4d40831c79885fa92b1c2cd0e17e26735a
|
||||
library_checksums[Yams]=b31b6df500d6191368c93f605690ca9857fff7c6fd1c8897e9765fb624535c63
|
||||
library_checksums[swift-collections]=575cf0f88d9068411f9acc6e3ca5d542bef1cc9e87dc5d69f7b5a1d5aec8c6b6
|
||||
library_checksums[swift-crypto]=86d6c22c9f89394fd579e967b0d5d0b6ce33cdbf52ba70f82fa313baf70c759f
|
||||
library_checksums[swift-system]=865b8c380455eef27e73109835142920c60ae4c4f4178a3d12ad04acc83f1371
|
||||
library_checksums[swift-driver]=a317d194e0eb1c39fd28644597c8dfe4c89cd611fe8ca9cc8765551994583879
|
||||
library_checksums[swift-tools-support-core]=171235636aaa3a82a2a47dfd1a9e493dc034d3f929e64200544f714750076ea3
|
||||
library_checksums[swift-package-manager]=420491446bf25409169c621955c2901d2edc11844834acc32f5311d6b719ef51
|
||||
library_checksums[indexstore-db]=0eb0e73ecab6d4c7d8e9cc4ade8d83e31a406070e0a655afb3a9b0d4dc50f3d7
|
||||
library_checksums[sourcekit-lsp]=497432deb1ee6fc004196b2240fc6a1bb83d6590fef83d97193b3bc4b41ab62c
|
||||
library_checksums[swift-driver]=12a074d874866f76d3e58266c68cdb75d3c27ea07e529902783662ec4d495393
|
||||
library_checksums[swift-tools-support-core]=8c9d098f4c2420496fc480f8de3b8f4edb19fb29d78f63c1869073343ccdded7
|
||||
library_checksums[swift-package-manager]=9a6839811be8fc9de822244df96b54473cd847c87a6ff21e8016fc6f8da65a13
|
||||
library_checksums[indexstore-db]=cee2355b7bc120b3a3fa7ecf00f54819aab298829547a629643d00c1add53269
|
||||
library_checksums[sourcekit-lsp]=e246a3320bd09845cf06b18beccbcf1b9994ee32616e9033f11a536c62d304d5
|
||||
|
||||
for library in "${!library_checksums[@]}"; do \
|
||||
GH_ORG="apple"
|
||||
if [ "$library" = "swift-argument-parser" ]; then
|
||||
SRC_VERSION="1.0.3"
|
||||
TAR_NAME=$SRC_VERSION
|
||||
elif [ "$library" = "swift-collections" ]; then
|
||||
SRC_VERSION="1.0.1"
|
||||
TAR_NAME=$SRC_VERSION
|
||||
elif [ "$library" = "swift-crypto" ]; then
|
||||
SRC_VERSION="1.1.5"
|
||||
TAR_NAME=$SRC_VERSION
|
||||
|
@ -63,7 +68,7 @@ termux_step_post_get_source() {
|
|||
TAR_NAME=$SRC_VERSION
|
||||
elif [ "$library" = "Yams" ]; then
|
||||
GH_ORG="jpsim"
|
||||
SRC_VERSION="4.0.2"
|
||||
SRC_VERSION="5.0.0"
|
||||
TAR_NAME=$SRC_VERSION
|
||||
else
|
||||
SRC_VERSION=$SWIFT_RELEASE
|
||||
|
@ -111,6 +116,7 @@ termux_step_host_build() {
|
|||
termux_step_pre_configure() {
|
||||
cd llvm-project
|
||||
patch -p1 < $TERMUX_PKG_BUILDER_DIR/../libllvm/clang-lib-Driver-ToolChain.cpp.patch
|
||||
patch -p1 < $TERMUX_PKG_BUILDER_DIR/../libllvm/clang-lib-Driver-ToolChains-Linux.cpp.patch
|
||||
}
|
||||
|
||||
termux_step_make() {
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
diff --git a/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp b/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
--- a/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
+++ b/llvm-project/clang/lib/Driver/ToolChains/Linux.cpp
|
||||
@@ -162,8 +162,8 @@
|
||||
// FIXME: This is a bit of a hack. We should really unify this code for
|
||||
// reasoning about oslibdir spellings with the lib dir spellings in the
|
||||
// GCCInstallationDetector, but that is a more significant refactoring.
|
||||
- if (Triple.getArch() == llvm::Triple::x86 || Triple.isPPC32() ||
|
||||
- Triple.getArch() == llvm::Triple::sparc)
|
||||
+ if (!Triple.isAndroid() && (Triple.getArch() == llvm::Triple::x86 || Triple.isPPC32() ||
|
||||
+ Triple.getArch() == llvm::Triple::sparc))
|
||||
return "lib32";
|
||||
|
||||
if (Triple.getArch() == llvm::Triple::x86_64 && Triple.isX32())
|
||||
@@ -287,7 +287,7 @@
|
||||
if (Triple.getVendor() == llvm::Triple::OpenEmbedded &&
|
||||
Triple.isArch64Bit())
|
||||
addPathIfExists(D, SysRoot + "/usr/" + OSLibDir, Paths);
|
||||
- else
|
||||
+ else if (!IsAndroid)
|
||||
addPathIfExists(D, SysRoot + "/usr/lib/../" + OSLibDir, Paths);
|
||||
if (IsRISCV) {
|
||||
StringRef ABIName = tools::riscv::getRISCVABI(Args, Triple);
|
||||
@@ -302,11 +302,19 @@
|
||||
// searched.
|
||||
// FIXME: It's not clear whether we should use the driver's installed
|
||||
// directory ('Dir' below) or the ResourceDir.
|
||||
- if (StringRef(D.Dir).startswith(SysRoot))
|
||||
+ if (StringRef(D.Dir).startswith(SysRoot) && !IsAndroid)
|
||||
addPathIfExists(D, D.Dir + "/../lib", Paths);
|
||||
|
||||
addPathIfExists(D, SysRoot + "/lib", Paths);
|
||||
- addPathIfExists(D, SysRoot + "/usr/lib", Paths);
|
||||
+ bool nativeBuild = MultiarchTriple == getMultiarchTriple(D, llvm::Triple(llvm::sys::getDefaultTargetTriple()), SysRoot);
|
||||
+ if (nativeBuild || !IsAndroid)
|
||||
+ addPathIfExists(D, SysRoot + "/usr/lib", Paths);
|
||||
+
|
||||
+ if (IsAndroid) {
|
||||
+ addPathIfExists(D, SysRoot + "/usr/" + MultiarchTriple + "/lib", Paths);
|
||||
+ addPathIfExists(D, "/system/" + OSLibDir, Paths);
|
||||
+ ExtraOpts.push_back("-rpath=" + SysRoot + "/usr/lib");
|
||||
+ }
|
||||
}
|
||||
|
||||
ToolChain::CXXStdlibType Linux::GetDefaultCXXStdlibType() const {
|
|
@ -1,13 +0,0 @@
|
|||
diff --git a/llbuild/lib/BuildSystem/BuildSystem.cpp b/llbuild/lib/BuildSystem/BuildSystem.cpp
|
||||
index 297dee34..40df58ca 100644
|
||||
--- a/llbuild/lib/BuildSystem/BuildSystem.cpp
|
||||
+++ b/llbuild/lib/BuildSystem/BuildSystem.cpp
|
||||
@@ -3269,7 +3269,7 @@ class ArchiveShellCommand : public ExternalCommand {
|
||||
if (const char *ar = std::getenv("AR"))
|
||||
args.push_back(std::string(ar));
|
||||
else
|
||||
- args.push_back("ar");
|
||||
+ args.push_back("llvm-ar");
|
||||
args.push_back("cr");
|
||||
args.push_back(archiveName);
|
||||
args.insert(args.end(), archiveInputs.begin(), archiveInputs.end());
|
|
@ -1,257 +0,0 @@
|
|||
From 0cc8bc79283a776a3ce60f2e4e476e2ec5b84b8d
|
||||
From: Pavel Yaskevich <pyaskevich@apple.com>
|
||||
Date: Fri, 11 Feb 2022 12:55:37 -0800
|
||||
Subject: [PATCH] [CSClosure] SE-0326: Type-checker statement conditions
|
||||
individually
|
||||
|
||||
Instead of referencing whole statement condition, break it down to
|
||||
individual elements and solve them separately.
|
||||
|
||||
Resolves: rdar://88720312
|
||||
---
|
||||
include/swift/AST/ASTNode.h | 4 +--
|
||||
include/swift/AST/Stmt.h | 4 +--
|
||||
include/swift/AST/TypeAlignments.h | 4 +++
|
||||
include/swift/Sema/ConstraintLocator.h | 2 +-
|
||||
lib/AST/ASTNode.cpp | 26 ++++++---------
|
||||
lib/Sema/CSClosure.cpp | 45 ++++++++++++++------------
|
||||
lib/Sema/ConstraintSystem.cpp | 4 +--
|
||||
7 files changed, 44 insertions(+), 45 deletions(-)
|
||||
|
||||
diff --git a/swift/include/swift/AST/ASTNode.h b/swift/include/swift/AST/ASTNode.h
|
||||
index ac208f1bf06d7..5724ac649b0a8 100644
|
||||
--- a/swift/include/swift/AST/ASTNode.h
|
||||
+++ b/swift/include/swift/AST/ASTNode.h
|
||||
@@ -43,11 +43,9 @@ namespace swift {
|
||||
enum class PatternKind : uint8_t;
|
||||
enum class StmtKind;
|
||||
|
||||
- using StmtCondition = llvm::MutableArrayRef<StmtConditionElement>;
|
||||
-
|
||||
struct ASTNode
|
||||
: public llvm::PointerUnion<Expr *, Stmt *, Decl *, Pattern *, TypeRepr *,
|
||||
- StmtCondition *, CaseLabelItem *> {
|
||||
+ StmtConditionElement *, CaseLabelItem *> {
|
||||
// Inherit the constructors from PointerUnion.
|
||||
using PointerUnion::PointerUnion;
|
||||
|
||||
diff --git a/swift/include/swift/AST/Stmt.h b/swift/include/swift/AST/Stmt.h
|
||||
index dab00742450f2..d4820894a169e 100644
|
||||
--- a/swift/include/swift/AST/Stmt.h
|
||||
+++ b/swift/include/swift/AST/Stmt.h
|
||||
@@ -395,7 +395,7 @@ class alignas(8) PoundAvailableInfo final :
|
||||
/// the "x" binding, one for the "y" binding, one for the where clause, one for
|
||||
/// "z"'s binding. A simple "if" statement is represented as a single binding.
|
||||
///
|
||||
-class StmtConditionElement {
|
||||
+class alignas(1 << PatternAlignInBits) StmtConditionElement {
|
||||
/// If this is a pattern binding, it may be the first one in a declaration, in
|
||||
/// which case this is the location of the var/let/case keyword. If this is
|
||||
/// the second pattern (e.g. for 'y' in "var x = ..., y = ...") then this
|
||||
@@ -818,7 +818,7 @@ class ForEachStmt : public LabeledStmt {
|
||||
};
|
||||
|
||||
/// A pattern and an optional guard expression used in a 'case' statement.
|
||||
-class CaseLabelItem {
|
||||
+class alignas(1 << PatternAlignInBits) CaseLabelItem {
|
||||
enum class Kind {
|
||||
/// A normal pattern
|
||||
Normal = 0,
|
||||
diff --git a/swift/include/swift/AST/TypeAlignments.h b/swift/include/swift/AST/TypeAlignments.h
|
||||
index 1c0f5e3b86846..911c29494ff19 100644
|
||||
--- a/swift/include/swift/AST/TypeAlignments.h
|
||||
+++ b/swift/include/swift/AST/TypeAlignments.h
|
||||
@@ -61,6 +61,7 @@ namespace swift {
|
||||
class TypeRepr;
|
||||
class ValueDecl;
|
||||
class CaseLabelItem;
|
||||
+ class StmtConditionElement;
|
||||
|
||||
/// We frequently use three tag bits on all of these types.
|
||||
constexpr size_t AttrAlignInBits = 3;
|
||||
@@ -155,6 +156,9 @@ LLVM_DECLARE_TYPE_ALIGNMENT(swift::TypeRepr, swift::TypeReprAlignInBits)
|
||||
|
||||
LLVM_DECLARE_TYPE_ALIGNMENT(swift::CaseLabelItem, swift::PatternAlignInBits)
|
||||
|
||||
+LLVM_DECLARE_TYPE_ALIGNMENT(swift::StmtConditionElement,
|
||||
+ swift::PatternAlignInBits)
|
||||
+
|
||||
static_assert(alignof(void*) >= 2, "pointer alignment is too small");
|
||||
|
||||
#endif
|
||||
diff --git a/swift/include/swift/Sema/ConstraintLocator.h b/swift/include/swift/Sema/ConstraintLocator.h
|
||||
index 74d4d87df9552..c1e19ab12ac4a 100644
|
||||
--- a/swift/include/swift/Sema/ConstraintLocator.h
|
||||
+++ b/swift/include/swift/Sema/ConstraintLocator.h
|
||||
@@ -1036,7 +1036,7 @@ class LocatorPathElt::ClosureBodyElement final
|
||||
if (auto *repr = node.dyn_cast<TypeRepr *>())
|
||||
return repr;
|
||||
|
||||
- if (auto *cond = node.dyn_cast<StmtCondition *>())
|
||||
+ if (auto *cond = node.dyn_cast<StmtConditionElement *>())
|
||||
return cond;
|
||||
|
||||
if (auto *caseItem = node.dyn_cast<CaseLabelItem *>())
|
||||
diff --git a/swift/lib/AST/ASTNode.cpp b/swift/lib/AST/ASTNode.cpp
|
||||
index bce57fb943dee..a9b0d3ae3342d 100644
|
||||
--- a/swift/lib/AST/ASTNode.cpp
|
||||
+++ b/swift/lib/AST/ASTNode.cpp
|
||||
@@ -35,15 +35,8 @@ SourceRange ASTNode::getSourceRange() const {
|
||||
return P->getSourceRange();
|
||||
if (const auto *T = this->dyn_cast<TypeRepr *>())
|
||||
return T->getSourceRange();
|
||||
- if (const auto *C = this->dyn_cast<StmtCondition *>()) {
|
||||
- if (C->empty())
|
||||
- return SourceRange();
|
||||
-
|
||||
- auto first = C->front();
|
||||
- auto last = C->back();
|
||||
-
|
||||
- return {first.getStartLoc(), last.getEndLoc()};
|
||||
- }
|
||||
+ if (const auto *C = this->dyn_cast<StmtConditionElement *>())
|
||||
+ return C->getSourceRange();
|
||||
if (const auto *I = this->dyn_cast<CaseLabelItem *>()) {
|
||||
return I->getSourceRange();
|
||||
}
|
||||
@@ -85,7 +78,7 @@ bool ASTNode::isImplicit() const {
|
||||
return P->isImplicit();
|
||||
if (const auto *T = this->dyn_cast<TypeRepr*>())
|
||||
return false;
|
||||
- if (const auto *C = this->dyn_cast<StmtCondition *>())
|
||||
+ if (const auto *C = this->dyn_cast<StmtConditionElement *>())
|
||||
return false;
|
||||
if (const auto *I = this->dyn_cast<CaseLabelItem *>())
|
||||
return false;
|
||||
@@ -103,10 +96,9 @@ void ASTNode::walk(ASTWalker &Walker) {
|
||||
P->walk(Walker);
|
||||
else if (auto *T = this->dyn_cast<TypeRepr*>())
|
||||
T->walk(Walker);
|
||||
- else if (auto *C = this->dyn_cast<StmtCondition *>()) {
|
||||
- for (auto &elt : *C)
|
||||
- elt.walk(Walker);
|
||||
- } else if (auto *I = this->dyn_cast<CaseLabelItem *>()) {
|
||||
+ else if (auto *C = this->dyn_cast<StmtConditionElement *>())
|
||||
+ C->walk(Walker);
|
||||
+ else if (auto *I = this->dyn_cast<CaseLabelItem *>()) {
|
||||
if (auto *P = I->getPattern())
|
||||
P->walk(Walker);
|
||||
|
||||
@@ -127,9 +119,9 @@ void ASTNode::dump(raw_ostream &OS, unsigned Indent) const {
|
||||
P->dump(OS, Indent);
|
||||
else if (auto T = dyn_cast<TypeRepr*>())
|
||||
T->print(OS);
|
||||
- else if (auto C = dyn_cast<StmtCondition *>()) {
|
||||
- OS.indent(Indent) << "(statement conditions)";
|
||||
- } else if (auto *I = dyn_cast<CaseLabelItem *>()) {
|
||||
+ else if (auto *C = dyn_cast<StmtConditionElement *>())
|
||||
+ OS.indent(Indent) << "(statement condition)";
|
||||
+ else if (auto *I = dyn_cast<CaseLabelItem *>()) {
|
||||
OS.indent(Indent) << "(case label item)";
|
||||
} else
|
||||
llvm_unreachable("unsupported AST node");
|
||||
diff --git a/swift/lib/Sema/CSClosure.cpp b/swift/lib/Sema/CSClosure.cpp
|
||||
index 6bcd97622ebc4..6f9e59a1513e9 100644
|
||||
--- a/swift/lib/Sema/CSClosure.cpp
|
||||
+++ b/swift/lib/Sema/CSClosure.cpp
|
||||
@@ -531,6 +531,15 @@ class ClosureConstraintGenerator
|
||||
"Unsupported statement: Fallthrough");
|
||||
}
|
||||
|
||||
+ void visitStmtCondition(LabeledConditionalStmt *S,
|
||||
+ SmallVectorImpl<ElementInfo> &elements,
|
||||
+ ConstraintLocator *locator) {
|
||||
+ auto *condLocator =
|
||||
+ cs.getConstraintLocator(locator, ConstraintLocator::Condition);
|
||||
+ for (auto &condition : S->getCond())
|
||||
+ elements.push_back(makeElement(&condition, condLocator));
|
||||
+ }
|
||||
+
|
||||
void visitIfStmt(IfStmt *ifStmt) {
|
||||
assert(isSupportedMultiStatementClosure() &&
|
||||
"Unsupported statement: If");
|
||||
@@ -538,11 +547,7 @@ class ClosureConstraintGenerator
|
||||
SmallVector<ElementInfo, 4> elements;
|
||||
|
||||
// Condition
|
||||
- {
|
||||
- auto *condLoc =
|
||||
- cs.getConstraintLocator(locator, ConstraintLocator::Condition);
|
||||
- elements.push_back(makeElement(ifStmt->getCondPointer(), condLoc));
|
||||
- }
|
||||
+ visitStmtCondition(ifStmt, elements, locator);
|
||||
|
||||
// Then Branch
|
||||
{
|
||||
@@ -565,24 +570,24 @@ private:
|
||||
if (!isSupportedMultiStatementClosure())
|
||||
llvm_unreachable("Unsupported statement: Guard");
|
||||
|
||||
- createConjunction(cs,
|
||||
- {makeElement(guardStmt->getCondPointer(),
|
||||
- cs.getConstraintLocator(
|
||||
- locator, ConstraintLocator::Condition)),
|
||||
- makeElement(guardStmt->getBody(), locator)},
|
||||
- locator);
|
||||
+ SmallVector<ElementInfo, 4> elements;
|
||||
+
|
||||
+ visitStmtCondition(guardStmt, elements, locator);
|
||||
+ elements.push_back(makeElement(guardStmt->getBody(), locator));
|
||||
+
|
||||
+ createConjunction(cs, elements, locator);
|
||||
}
|
||||
|
||||
void visitWhileStmt(WhileStmt *whileStmt) {
|
||||
if (!isSupportedMultiStatementClosure())
|
||||
llvm_unreachable("Unsupported statement: Guard");
|
||||
|
||||
- createConjunction(cs,
|
||||
- {makeElement(whileStmt->getCondPointer(),
|
||||
- cs.getConstraintLocator(
|
||||
- locator, ConstraintLocator::Condition)),
|
||||
- makeElement(whileStmt->getBody(), locator)},
|
||||
- locator);
|
||||
+ SmallVector<ElementInfo, 4> elements;
|
||||
+
|
||||
+ visitStmtCondition(whileStmt, elements, locator);
|
||||
+ elements.push_back(makeElement(whileStmt->getBody(), locator));
|
||||
+
|
||||
+ createConjunction(cs, elements, locator);
|
||||
}
|
||||
|
||||
void visitDoStmt(DoStmt *doStmt) {
|
||||
@@ -970,8 +975,8 @@ ConstraintSystem::simplifyClosureBodyElementConstraint(
|
||||
return SolutionKind::Solved;
|
||||
} else if (auto *stmt = element.dyn_cast<Stmt *>()) {
|
||||
generator.visit(stmt);
|
||||
- } else if (auto *cond = element.dyn_cast<StmtCondition *>()) {
|
||||
- if (generateConstraints(*cond, closure))
|
||||
+ } else if (auto *cond = element.dyn_cast<StmtConditionElement *>()) {
|
||||
+ if (generateConstraints({*cond}, closure))
|
||||
return SolutionKind::Error;
|
||||
} else if (auto *pattern = element.dyn_cast<Pattern *>()) {
|
||||
generator.visitPattern(pattern, context);
|
||||
@@ -1571,7 +1576,7 @@ void ConjunctionElement::findReferencedVariables(
|
||||
|
||||
TypeVariableRefFinder refFinder(cs, locator->getAnchor(), typeVars);
|
||||
|
||||
- if (element.is<Decl *>() || element.is<StmtCondition *>() ||
|
||||
+ if (element.is<Decl *>() || element.is<StmtConditionElement *>() ||
|
||||
element.is<Expr *>() || element.isStmt(StmtKind::Return))
|
||||
element.walk(refFinder);
|
||||
}
|
||||
diff --git a/swift/lib/Sema/ConstraintSystem.cpp b/swift/lib/Sema/ConstraintSystem.cpp
|
||||
index 5523828730804..22cbe9a94e280 100644
|
||||
--- a/swift/lib/Sema/ConstraintSystem.cpp
|
||||
+++ b/swift/lib/Sema/ConstraintSystem.cpp
|
||||
@@ -6050,8 +6050,8 @@ SourceLoc constraints::getLoc(ASTNode anchor) {
|
||||
return S->getStartLoc();
|
||||
} else if (auto *P = anchor.dyn_cast<Pattern *>()) {
|
||||
return P->getLoc();
|
||||
- } else if (auto *C = anchor.dyn_cast<StmtCondition *>()) {
|
||||
- return C->front().getStartLoc();
|
||||
+ } else if (auto *C = anchor.dyn_cast<StmtConditionElement *>()) {
|
||||
+ return C->getStartLoc();
|
||||
} else {
|
||||
auto *I = anchor.get<CaseLabelItem *>();
|
||||
return I->getStartLoc();
|
|
@ -76,12 +76,12 @@ index b7503ecdd6..c643c2c9a5 100644
|
|||
include(Libdispatch)
|
||||
endif()
|
||||
|
||||
diff --git a/swift/cmake/modules/AddSwift.cmake b/swift/cmake/modules/AddSwift.cmake
|
||||
index a448bcb23c4..0ddbac17a52 100644
|
||||
--- a/swift/cmake/modules/AddSwift.cmake
|
||||
+++ b/swift/cmake/modules/AddSwift.cmake
|
||||
@@ -706,7 +706,7 @@
|
||||
elseif(${LIBSWIFT_BUILD_MODE} STREQUAL "CROSSCOMPILE")
|
||||
diff --git a/swift/SwiftCompilerSources/CMakeLists.txt b/swift/SwiftCompilerSources/CMakeLists.txt
|
||||
index f4a2eb2dddc..61a2548cf77 100644
|
||||
--- a/swift/SwiftCompilerSources/CMakeLists.txt
|
||||
+++ b/swift/SwiftCompilerSources/CMakeLists.txt
|
||||
@@ -102,7 +102,7 @@ function(add_swift_compiler_modules_library name)
|
||||
elseif(${BOOTSTRAPPING_MODE} STREQUAL "CROSSCOMPILE")
|
||||
set(sdk_option "-sdk" "${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_ARCH_${SWIFT_HOST_VARIANT_ARCH}_PATH}")
|
||||
get_filename_component(swift_exec_bin_dir ${ALS_SWIFT_EXEC} DIRECTORY)
|
||||
- set(sdk_option ${sdk_option} "-resource-dir" "${swift_exec_bin_dir}/../lib/swift")
|
||||
|
@ -89,16 +89,20 @@ index a448bcb23c4..0ddbac17a52 100644
|
|||
endif()
|
||||
get_versioned_target_triple(target ${SWIFT_HOST_VARIANT_SDK}
|
||||
${SWIFT_HOST_VARIANT_ARCH} "${deployment_version}")
|
||||
@@ -766,6 +766,9 @@ function(add_libswift name)
|
||||
COMMENT "Building libswift module ${module}")
|
||||
@@ -155,6 +155,9 @@ function(add_swift_compiler_modules_library name)
|
||||
|
||||
set("${module}_dep_target" ${dep_target})
|
||||
+ if(${LIBSWIFT_BUILD_MODE} STREQUAL "CROSSCOMPILE")
|
||||
set(all_module_targets ${all_module_targets} ${dep_target})
|
||||
+ if(${BOOTSTRAPPING_MODE} STREQUAL "CROSSCOMPILE")
|
||||
+ add_dependencies(${dep_target} swift-stdlib-android-${SWIFT_HOST_VARIANT_ARCH})
|
||||
+ endif()
|
||||
endforeach()
|
||||
|
||||
# Create a static libswift library containing all module object files.
|
||||
# Create a static library containing all module object files.
|
||||
diff --git a/swift/cmake/modules/AddSwift.cmake b/swift/cmake/modules/AddSwift.cmake
|
||||
index a448bcb23c4..0ddbac17a52 100644
|
||||
--- a/swift/cmake/modules/AddSwift.cmake
|
||||
+++ b/swift/cmake/modules/AddSwift.cmake
|
||||
@@ -922,7 +923,7 @@ function(add_swift_host_tool executable)
|
||||
# installed host toolchain.
|
||||
get_filename_component(swift_bin_dir ${SWIFT_EXEC_FOR_LIBSWIFT} DIRECTORY)
|
||||
|
@ -171,26 +175,6 @@ index f958d4ce899..ac6d7248606 100644
|
|||
TARGET_SDKS "${swiftGlibc_target_sdks}"
|
||||
INSTALL_IN_COMPONENT sdk-overlay
|
||||
DEPENDS glibc_modulemap)
|
||||
diff --git a/swift/stdlib/public/SwiftShims/CMakeLists.txt b/swift/stdlib/public/SwiftShims/CMakeLists.txt
|
||||
index 23ac72bcda5..23aecfc9bc5 100644
|
||||
--- a/swift/stdlib/public/SwiftShims/CMakeLists.txt
|
||||
+++ b/swift/stdlib/public/SwiftShims/CMakeLists.txt
|
||||
@@ -207,13 +207,13 @@ endif()
|
||||
|
||||
swift_install_symlink_component(clang-resource-dir-symlink
|
||||
LINK_NAME clang
|
||||
- TARGET ../clang/${CLANG_VERSION}
|
||||
+ TARGET ../clang/$ENV{TERMUX_CLANG_VERSION}
|
||||
DESTINATION "lib/swift")
|
||||
|
||||
if(SWIFT_BUILD_STATIC_STDLIB)
|
||||
swift_install_symlink_component(clang-resource-dir-symlink
|
||||
LINK_NAME clang
|
||||
- TARGET ../clang/${CLANG_VERSION}
|
||||
+ TARGET ../clang/$ENV{TERMUX_CLANG_VERSION}
|
||||
DESTINATION "lib/swift_static")
|
||||
endif()
|
||||
|
||||
diff --git a/swift/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake b/swift/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
|
||||
index 7a77e125f95..7eddfea2054 100644
|
||||
--- a/swift/tools/SourceKit/cmake/modules/AddSwiftSourceKit.cmake
|
||||
|
@ -205,15 +189,15 @@ index 7a77e125f95..7eddfea2054 100644
|
|||
endfunction()
|
||||
|
||||
# Add a new SourceKit library.
|
||||
@@ -165,7 +168,7 @@ macro(add_sourcekit_library name)
|
||||
endif()
|
||||
endif()
|
||||
@@ -115,7 +115,7 @@ function(add_sourcekitd_swifrt_linking target path HAS_SWIFT_MODULES)
|
||||
# installed host toolchain.
|
||||
get_filename_component(swift_bin_dir ${SWIFT_EXEC_FOR_SWIFT_MODULES} DIRECTORY)
|
||||
get_filename_component(swift_dir ${swift_bin_dir} DIRECTORY)
|
||||
- set(host_lib_dir "${swift_dir}/lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
|
||||
+ set(host_lib_dir "${SWIFT_BINARY_DIR}/lib/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}")
|
||||
|
||||
- if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
+ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" AND NOT "${SWIFT_HOST_VARIANT_SDK}" STREQUAL "ANDROID")
|
||||
if(SOURCEKITLIB_SHARED)
|
||||
set_target_properties(${name} PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
|
||||
set_target_properties(${name} PROPERTIES INSTALL_RPATH "$ORIGIN/../lib/swift/linux")
|
||||
target_link_libraries(${target} PRIVATE ${swiftrt})
|
||||
target_link_libraries(${target} PRIVATE "swiftCore")
|
||||
diff --git a/swift/tools/libSwiftSyntaxParser/CMakeLists.txt b/swift/tools/libSwiftSyntaxParser/CMakeLists.txt
|
||||
index 42dda212164..2338df9072a 100644
|
||||
--- a/swift/tools/libSwiftSyntaxParser/CMakeLists.txt
|
||||
|
|
|
@ -1,86 +0,0 @@
|
|||
From 3e7717673dcbb73b41a26ae5f70fd48620cca072
|
||||
Date: Mon, 20 Dec 2021 20:47:55 +0530
|
||||
Subject: [PATCH] [build] Add a flag that allows disabling appending the host
|
||||
target's name to the install-destdir for a cross-compiled toolchain
|
||||
|
||||
This is useful if you're cross-compiling the toolchain for a single host and don't
|
||||
want your specified install path modified.
|
||||
---
|
||||
utils/build-script-impl | 7 +++++--
|
||||
utils/build_swift/build_swift/driver_arguments.py | 6 ++++++
|
||||
.../swift_build_support/build_script_invocation.py | 2 ++
|
||||
.../swift_build_support/products/product.py | 6 ++++--
|
||||
5 files changed, 19 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/swift/utils/build-script-impl b/swift/utils/build-script-impl
|
||||
index a9a77e2fb370d..6d0709d82de7e 100755
|
||||
--- a/swift/utils/build-script-impl
|
||||
+++ b/swift/utils/build-script-impl
|
||||
@@ -249,6 +249,7 @@ KNOWN_SETTINGS=(
|
||||
cross-compile-with-host-tools "" "set to use the clang we build for the host to then build the cross-compile hosts"
|
||||
cross-compile-install-prefixes "" "semicolon-separated list of install prefixes to use for the cross-compiled hosts. The list expands, so if there are more cross-compile hosts than prefixes, unmatched hosts use the last prefix in the list"
|
||||
cross-compile-deps-path "" "path for CMake to look for cross-compiled library dependencies, such as libXML2"
|
||||
+ cross-compile-append-host-target-to-destdir "1" "turns on appending the host target name of each cross-compiled toolchain to its install-destdir, to keep them separate from the natively-built toolchain"
|
||||
skip-merge-lipo-cross-compile-tools "" "set to skip running merge-lipo after installing cross-compiled host Swift tools"
|
||||
coverage-db "" "If set, coverage database to use when prioritizing testing"
|
||||
skip-local-host-install "" "If we are cross-compiling multiple targets, skip an install pass locally if the hosts match"
|
||||
@@ -1133,8 +1134,10 @@ function get_host_install_destdir() {
|
||||
if [[ $(should_include_host_in_lipo ${host}) ]]; then
|
||||
# If this is one of the hosts we should lipo, install in to a temporary subdirectory.
|
||||
local host_install_destdir="${BUILD_DIR}/intermediate-install/${host}"
|
||||
- elif [[ "${host}" == "merged-hosts" ]]; then
|
||||
- # This assumes that all hosts are merged to the lipo.
|
||||
+ elif [[ "${host}" == "merged-hosts" ]] ||
|
||||
+ [[ "$(true_false ${CROSS_COMPILE_APPEND_HOST_TARGET_TO_DESTDIR})" == "FALSE" ]]; then
|
||||
+ # This assumes that all hosts are merged to the lipo, or the build
|
||||
+ # was told not to append anything.
|
||||
local host_install_destdir="${INSTALL_DESTDIR}"
|
||||
else
|
||||
local host_install_destdir="${INSTALL_DESTDIR}/${host}"
|
||||
diff --git a/swift/utils/build_swift/build_swift/driver_arguments.py b/swift/utils/build_swift/build_swift/driver_arguments.py
|
||||
index e10ef74dcefc1..ecbaa4a9dd5f4 100644
|
||||
--- a/swift/utils/build_swift/build_swift/driver_arguments.py
|
||||
+++ b/swift/utils/build_swift/build_swift/driver_arguments.py
|
||||
@@ -568,6 +568,12 @@ def create_argument_parser():
|
||||
'library dependencies of the corelibs and other Swift repos, '
|
||||
'such as the libcurl dependency of FoundationNetworking')
|
||||
|
||||
+ option('--cross-compile-append-host-target-to-destdir', toggle_true,
|
||||
+ default=True,
|
||||
+ help="Append each cross-compilation host target's name as a subdirectory "
|
||||
+ "for each cross-compiled toolchain's destdir, useful when building "
|
||||
+ "multiple toolchains and can be disabled if only cross-compiling one.")
|
||||
+
|
||||
option('--stdlib-deployment-targets', store,
|
||||
type=argparse.ShellSplitType(),
|
||||
default=None,
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py b/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py
|
||||
index d6faa0a7ba6c9..3ae3002f5d906 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py
|
||||
@@ -124,6 +124,8 @@ def convert_to_impl_arguments(self):
|
||||
"--lldb-assertions", str(
|
||||
args.lldb_assertions).lower(),
|
||||
"--cmake-generator", args.cmake_generator,
|
||||
+ "--cross-compile-append-host-target-to-destdir", str(
|
||||
+ args.cross_compile_append_host_target_to_destdir).lower(),
|
||||
"--build-jobs", str(args.build_jobs),
|
||||
"--common-cmake-options=%s" % ' '.join(
|
||||
pipes.quote(opt) for opt in cmake.common_options()),
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/products/product.py b/swift/utils/swift_build_support/swift_build_support/products/product.py
|
||||
index 2f02322ba1d92..9fc258789639b 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/product.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/product.py
|
||||
@@ -230,8 +230,10 @@ def host_install_destdir(self, host_target):
|
||||
# install in to a temporary subdirectory.
|
||||
return '%s/intermediate-install/%s' % \
|
||||
(os.path.dirname(self.build_dir), host_target)
|
||||
- elif host_target == "merged-hosts":
|
||||
- # This assumes that all hosts are merged to the lipo.
|
||||
+ elif host_target == "merged-hosts" or \
|
||||
+ not self.args.cross_compile_append_host_target_to_destdir:
|
||||
+ # This assumes that all hosts are merged to the lipo, or the build
|
||||
+ # was told not to append anything.
|
||||
return self.args.install_destdir
|
||||
else:
|
||||
return '%s/%s' % (self.args.install_destdir, host_target)
|
|
@ -0,0 +1,22 @@
|
|||
diff --git a/swift/include/swift/AST/Expr.h b/swift/include/swift/AST/Expr.h
|
||||
index 77695508386..719513b494f 100644
|
||||
--- a/swift/include/swift/AST/Expr.h
|
||||
+++ b/swift/include/swift/AST/Expr.h
|
||||
@@ -3306,7 +3306,7 @@ public:
|
||||
/// this array will be empty
|
||||
ArrayRef<ConversionPair> getArgumentConversions() const {
|
||||
return {getTrailingObjects<ConversionPair>(),
|
||||
- Bits.ErasureExpr.NumArgumentConversions };
|
||||
+ static_cast<size_t>(Bits.ErasureExpr.NumArgumentConversions) };
|
||||
}
|
||||
|
||||
/// Retrieve the conversion expressions mapping requirements from any
|
||||
@@ -3316,7 +3316,7 @@ public:
|
||||
/// this array will be empty
|
||||
MutableArrayRef<ConversionPair> getArgumentConversions() {
|
||||
return {getTrailingObjects<ConversionPair>(),
|
||||
- Bits.ErasureExpr.NumArgumentConversions };
|
||||
+ static_cast<size_t>(Bits.ErasureExpr.NumArgumentConversions) };
|
||||
}
|
||||
|
||||
void setArgumentConversion(unsigned i, const ConversionPair &p) {
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/swift/include/swift/Basic/BridgingUtils.h b/swift/include/swift/Basic/BridgingUtils.h
|
||||
index bd8fe2e6a06..55e962f2ec3 100644
|
||||
--- a/swift/include/swift/Basic/BridgingUtils.h
|
||||
+++ b/swift/include/swift/Basic/BridgingUtils.h
|
||||
@@ -54,7 +54,7 @@ getCharSourceRange(const BridgedCharSourceRange &bridged) {
|
||||
inline BridgedCharSourceRange
|
||||
getBridgedCharSourceRange(const CharSourceRange &range) {
|
||||
auto start = getBridgedSourceLoc(range.getStart());
|
||||
- return {start, range.getByteLength()};
|
||||
+ return {start, static_cast<SwiftInt>(range.getByteLength())};
|
||||
}
|
||||
|
||||
/// Copies the string in an malloc'ed memory and the caller is responsible for
|
|
@ -25,30 +25,3 @@ index dc14e7782c79a..6f85e245a002e 100644
|
|||
}
|
||||
|
||||
// Configure the toolchain.
|
||||
From 546768bb95b0bcc3fb480525f269d838c76da530 Mon Sep 17 00:00:00 2001
|
||||
Date: Sun, 14 Aug 2022 16:10:36 +0530
|
||||
Subject: [PATCH] Work around lld 13+ issue with --gc-sections for ELF by
|
||||
adding -z nostart-stop-gc
|
||||
|
||||
diff --git a/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift b/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
|
||||
index ff2799a82..c274901b3 100644
|
||||
--- a/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
|
||||
+++ b/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
|
||||
@@ -84,6 +84,17 @@ extension GenericUnixToolchain {
|
||||
#else
|
||||
commandLine.appendFlag("-fuse-ld=\(linker)")
|
||||
#endif
|
||||
+ // Starting with lld 13, Swift stopped working with the lld
|
||||
+ // --gc-sections implementation for ELF, unless -z nostart-stop-gc is
|
||||
+ // also passed to lld:
|
||||
+ //
|
||||
+ // https://reviews.llvm.org/D96914
|
||||
+ if linker == "lld" || linker.hasSuffix("ld.lld") {
|
||||
+ commandLine.appendFlag(.Xlinker)
|
||||
+ commandLine.appendFlag("-z")
|
||||
+ commandLine.appendFlag(.Xlinker)
|
||||
+ commandLine.appendFlag("nostart-stop-gc")
|
||||
+ }
|
||||
}
|
||||
|
||||
// Configure the toolchain.
|
||||
|
|
|
@ -1,518 +0,0 @@
|
|||
From 5eb29d99dd3e3944da43b29c0eafb8608202ddba
|
||||
Date: Tue, 11 May 2021 01:10:50 +0530
|
||||
Subject: [PATCH] [android] Switch to new single-header modulemap for Bionic
|
||||
too
|
||||
|
||||
---
|
||||
stdlib/public/Platform/CMakeLists.txt | 4 +-
|
||||
stdlib/public/Platform/SwiftGlibc.h.gyb | 1 -
|
||||
stdlib/public/Platform/bionic.modulemap.gyb | 393 ------------------
|
||||
stdlib/public/Platform/glibc.modulemap.gyb | 4 +-
|
||||
stdlib/public/SwiftShims/LibcShims.h | 2 +-
|
||||
test/Interop/C/libc/include-signal.swift | 4 +-
|
||||
.../Cxx/class/memory-layout-silgen.swift | 3 -
|
||||
test/Interop/Cxx/libc/include-glibc.swift | 2 +-
|
||||
8 files changed, 7 insertions(+), 406 deletions(-)
|
||||
delete mode 100644 stdlib/public/Platform/bionic.modulemap.gyb
|
||||
|
||||
diff --git a/swift/stdlib/public/Platform/CMakeLists.txt b/swift/stdlib/public/Platform/CMakeLists.txt
|
||||
index 9d6fccd4082ca..6ae5209186fd3 100644
|
||||
--- a/swift/stdlib/public/Platform/CMakeLists.txt
|
||||
+++ b/swift/stdlib/public/Platform/CMakeLists.txt
|
||||
@@ -130,9 +130,7 @@ foreach(sdk ${SWIFT_SDKS})
|
||||
set(module_dir "${SWIFTLIB_DIR}/${arch_subdir}")
|
||||
set(module_dir_static "${SWIFTSTATICLIB_DIR}/${arch_subdir}")
|
||||
|
||||
- if(${sdk} STREQUAL ANDROID)
|
||||
- set(glibc_modulemap_source "bionic.modulemap.gyb")
|
||||
- elseif(${sdk} STREQUAL OPENBSD)
|
||||
+ if(${sdk} STREQUAL OPENBSD)
|
||||
set(glibc_modulemap_source "libc-openbsd.modulemap.gyb")
|
||||
else()
|
||||
set(glibc_modulemap_source "glibc.modulemap.gyb")
|
||||
diff --git a/swift/stdlib/public/Platform/SwiftGlibc.h.gyb b/swift/stdlib/public/Platform/SwiftGlibc.h.gyb
|
||||
index 3391eaee29934..78c725bae8c73 100644
|
||||
--- a/swift/stdlib/public/Platform/SwiftGlibc.h.gyb
|
||||
+++ b/swift/stdlib/public/Platform/SwiftGlibc.h.gyb
|
||||
@@ -28,7 +28,6 @@ headers = [
|
||||
'tgmath.h',
|
||||
'time.h',
|
||||
'utmp.h',
|
||||
- 'utmpx.h',
|
||||
|
||||
# POSIX
|
||||
'aio.h',
|
||||
diff --git a/swift/stdlib/public/Platform/bionic.modulemap.gyb b/swift/stdlib/public/Platform/bionic.modulemap.gyb
|
||||
deleted file mode 100644
|
||||
index e44f9082653a6..0000000000000
|
||||
--- a/swift/stdlib/public/Platform/bionic.modulemap.gyb
|
||||
+++ /dev/null
|
||||
@@ -1,393 +0,0 @@
|
||||
-//===--- bionic.modulemap -------------------------------------------------===//
|
||||
-//
|
||||
-// This source file is part of the Swift.org open source project
|
||||
-//
|
||||
-// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
|
||||
-// Licensed under Apache License v2.0 with Runtime Library Exception
|
||||
-//
|
||||
-// See https://swift.org/LICENSE.txt for license information
|
||||
-// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
|
||||
-//
|
||||
-//===----------------------------------------------------------------------===//
|
||||
-
|
||||
-/// This is a semi-complete modulemap that maps bionics's headers in a roughly
|
||||
-/// similar way to the Darwin SDK modulemap. We do not take care to list every
|
||||
-/// single header which may be included by a particular submodule, so there can
|
||||
-/// still be issues if imported into the same context as one in which someone
|
||||
-/// included those headers directly.
|
||||
-///
|
||||
-/// It's not named just Bionic so that it doesn't conflict in the event of a
|
||||
-/// future official bionic modulemap.
|
||||
-module SwiftGlibc [system] {
|
||||
-
|
||||
- link "dl"
|
||||
-
|
||||
- // C standard library
|
||||
- module C {
|
||||
- module features {
|
||||
- header "${GLIBC_INCLUDE_PATH}/features.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- module complex {
|
||||
- header "${GLIBC_INCLUDE_PATH}/complex.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- module pty {
|
||||
- header "${GLIBC_INCLUDE_PATH}/pty.h"
|
||||
- export *
|
||||
- }
|
||||
- module utmp {
|
||||
- header "${GLIBC_INCLUDE_PATH}/utmp.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- module ctype {
|
||||
- header "${GLIBC_INCLUDE_PATH}/ctype.h"
|
||||
- export *
|
||||
- }
|
||||
- module errno {
|
||||
- header "${GLIBC_INCLUDE_PATH}/errno.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- module fenv {
|
||||
- header "${GLIBC_INCLUDE_PATH}/fenv.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- // note: supplied by compiler
|
||||
- // module float {
|
||||
- // header "${GLIBC_INCLUDE_PATH}/float.h"
|
||||
- // export *
|
||||
- // }
|
||||
-
|
||||
- module inttypes {
|
||||
- header "${GLIBC_INCLUDE_PATH}/inttypes.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- // note: potentially supplied by compiler
|
||||
- // module iso646 {
|
||||
- // header "${GLIBC_INCLUDE_PATH}/iso646.h"
|
||||
- // export *
|
||||
- // }
|
||||
- // module limits {
|
||||
- // header "${GLIBC_INCLUDE_PATH}/limits.h"
|
||||
- // export *
|
||||
- // }
|
||||
-
|
||||
- module locale {
|
||||
- header "${GLIBC_INCLUDE_PATH}/locale.h"
|
||||
- export *
|
||||
- }
|
||||
- module math {
|
||||
- link "m"
|
||||
- header "${GLIBC_INCLUDE_PATH}/math.h"
|
||||
- export *
|
||||
- }
|
||||
- module setjmp {
|
||||
- header "${GLIBC_INCLUDE_PATH}/setjmp.h"
|
||||
- export *
|
||||
- }
|
||||
- module signal {
|
||||
- header "${GLIBC_INCLUDE_PATH}/signal.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- // note: supplied by the compiler
|
||||
- // module stdarg {
|
||||
- // header "${GLIBC_INCLUDE_PATH}/stdarg.h"
|
||||
- // export *
|
||||
- // }
|
||||
- // module stdbool {
|
||||
- // header "${GLIBC_INCLUDE_PATH}/stdbool.h"
|
||||
- // export *
|
||||
- // }
|
||||
- // module stddef {
|
||||
- // header "${GLIBC_INCLUDE_PATH}/stddef.h"
|
||||
- // export *
|
||||
- // }
|
||||
- // module stdint {
|
||||
- // header "${GLIBC_INCLUDE_PATH}/stdint.h"
|
||||
- // export *
|
||||
- // }
|
||||
-
|
||||
- module stdio {
|
||||
- header "${GLIBC_INCLUDE_PATH}/stdio.h"
|
||||
- export *
|
||||
- }
|
||||
- module stdlib {
|
||||
- header "${GLIBC_INCLUDE_PATH}/stdlib.h"
|
||||
- export *
|
||||
- export stddef
|
||||
- }
|
||||
- module string {
|
||||
- header "${GLIBC_INCLUDE_PATH}/string.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- // note: supplied by the compiler
|
||||
- // explicit module tgmath {
|
||||
- // header "${GLIBC_INCLUDE_PATH}/tgmath.h"
|
||||
- // export *
|
||||
- // }
|
||||
-
|
||||
- module time {
|
||||
- header "${GLIBC_INCLUDE_PATH}/time.h"
|
||||
- export *
|
||||
- }
|
||||
- }
|
||||
-
|
||||
- // POSIX
|
||||
- module POSIX {
|
||||
- module wait {
|
||||
- header "${GLIBC_INCLUDE_PATH}/wait.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- module cpio {
|
||||
- header "${GLIBC_INCLUDE_PATH}/cpio.h"
|
||||
- export *
|
||||
- }
|
||||
- module nl_types {
|
||||
- header "${GLIBC_INCLUDE_PATH}/nl_types.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- module ftw {
|
||||
- header "${GLIBC_INCLUDE_PATH}/ftw.h"
|
||||
- export *
|
||||
- }
|
||||
- module glob {
|
||||
- header "${GLIBC_INCLUDE_PATH}/glob.h"
|
||||
- export *
|
||||
- }
|
||||
- module iconv {
|
||||
- header "${GLIBC_INCLUDE_PATH}/iconv.h"
|
||||
- export *
|
||||
- }
|
||||
- module langinfo {
|
||||
- header "${GLIBC_INCLUDE_PATH}/langinfo.h"
|
||||
- export *
|
||||
- }
|
||||
- module netdb {
|
||||
- header "${GLIBC_INCLUDE_PATH}/netdb.h"
|
||||
- export *
|
||||
- }
|
||||
- module ifaddrs {
|
||||
- header "${GLIBC_INCLUDE_PATH}/ifaddrs.h"
|
||||
- export *
|
||||
- }
|
||||
- module search {
|
||||
- header "${GLIBC_INCLUDE_PATH}/search.h"
|
||||
- export *
|
||||
- }
|
||||
- module spawn {
|
||||
- header "${GLIBC_INCLUDE_PATH}/spawn.h"
|
||||
- export *
|
||||
- }
|
||||
- module syslog {
|
||||
- header "${GLIBC_INCLUDE_PATH}/syslog.h"
|
||||
- export *
|
||||
- }
|
||||
- module tar {
|
||||
- header "${GLIBC_INCLUDE_PATH}/tar.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- module arpa {
|
||||
- module inet {
|
||||
- header "${GLIBC_INCLUDE_PATH}/arpa/inet.h"
|
||||
- export *
|
||||
- }
|
||||
- export *
|
||||
- }
|
||||
- module dirent {
|
||||
- header "${GLIBC_INCLUDE_PATH}/dirent.h"
|
||||
- export *
|
||||
- }
|
||||
- module dlfcn {
|
||||
- header "${GLIBC_INCLUDE_PATH}/dlfcn.h"
|
||||
- export *
|
||||
- }
|
||||
- module fcntl {
|
||||
- header "${GLIBC_INCLUDE_PATH}/fcntl.h"
|
||||
- export *
|
||||
- }
|
||||
- module fnmatch {
|
||||
- header "${GLIBC_INCLUDE_PATH}/fnmatch.h"
|
||||
- export *
|
||||
- }
|
||||
- module grp {
|
||||
- header "${GLIBC_INCLUDE_PATH}/grp.h"
|
||||
- export *
|
||||
- }
|
||||
- module ioctl {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/ioctl.h"
|
||||
- export *
|
||||
- }
|
||||
- module libgen {
|
||||
- header "${GLIBC_INCLUDE_PATH}/libgen.h"
|
||||
- export *
|
||||
- }
|
||||
- module net {
|
||||
- module if {
|
||||
- header "${GLIBC_INCLUDE_PATH}/net/if.h"
|
||||
- export *
|
||||
- }
|
||||
- }
|
||||
- module netinet {
|
||||
- module in {
|
||||
- header "${GLIBC_INCLUDE_PATH}/netinet/in.h"
|
||||
- export *
|
||||
-
|
||||
- exclude header "${GLIBC_INCLUDE_PATH}/netinet6/in6.h"
|
||||
- }
|
||||
- module tcp {
|
||||
- header "${GLIBC_INCLUDE_PATH}/netinet/tcp.h"
|
||||
- export *
|
||||
- }
|
||||
- }
|
||||
- module poll {
|
||||
- header "${GLIBC_INCLUDE_PATH}/poll.h"
|
||||
- export *
|
||||
- }
|
||||
- module pthread {
|
||||
- header "${GLIBC_INCLUDE_PATH}/pthread.h"
|
||||
- export *
|
||||
- }
|
||||
- module pwd {
|
||||
- header "${GLIBC_INCLUDE_PATH}/pwd.h"
|
||||
- export *
|
||||
- }
|
||||
- module regex {
|
||||
- header "${GLIBC_INCLUDE_PATH}/regex.h"
|
||||
- export *
|
||||
- }
|
||||
- module sched {
|
||||
- header "${GLIBC_INCLUDE_PATH}/sched.h"
|
||||
- export *
|
||||
- }
|
||||
- module semaphore {
|
||||
- header "${GLIBC_INCLUDE_PATH}/semaphore.h"
|
||||
- export *
|
||||
- }
|
||||
- module strings {
|
||||
- header "${GLIBC_INCLUDE_PATH}/strings.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- module sys {
|
||||
- export *
|
||||
-
|
||||
- module cdefs {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/cdefs.h"
|
||||
- export *
|
||||
- }
|
||||
- module file {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/file.h"
|
||||
- export *
|
||||
- }
|
||||
- module sem {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/sem.h"
|
||||
- export *
|
||||
- }
|
||||
- module shm {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/shm.h"
|
||||
- export *
|
||||
- }
|
||||
- module inotify {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/inotify.h"
|
||||
- export *
|
||||
- }
|
||||
- module statvfs {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/statvfs.h"
|
||||
- export *
|
||||
- }
|
||||
-
|
||||
- module ipc {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/ipc.h"
|
||||
- export *
|
||||
- }
|
||||
- module mman {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/mman.h"
|
||||
- export *
|
||||
- }
|
||||
- module msg {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/msg.h"
|
||||
- export *
|
||||
- }
|
||||
- module resource {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/resource.h"
|
||||
- export *
|
||||
- }
|
||||
- module select {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/select.h"
|
||||
- export *
|
||||
- }
|
||||
- module sendfile {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/sendfile.h"
|
||||
- export *
|
||||
- }
|
||||
- module socket {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/socket.h"
|
||||
- export *
|
||||
- }
|
||||
- module stat {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/stat.h"
|
||||
- export *
|
||||
- }
|
||||
- module time {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/time.h"
|
||||
- export *
|
||||
- }
|
||||
- module times {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/times.h"
|
||||
- export *
|
||||
- }
|
||||
- module types {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/types.h"
|
||||
- export *
|
||||
- }
|
||||
- module uio {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/uio.h"
|
||||
- export *
|
||||
- }
|
||||
- module un {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/un.h"
|
||||
- export *
|
||||
- }
|
||||
- module user {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/user.h"
|
||||
- export *
|
||||
- }
|
||||
- module utsname {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/utsname.h"
|
||||
- export *
|
||||
- }
|
||||
- module wait {
|
||||
- header "${GLIBC_ARCH_INCLUDE_PATH}/sys/wait.h"
|
||||
- export *
|
||||
- }
|
||||
- }
|
||||
- module sysexits {
|
||||
- header "${GLIBC_INCLUDE_PATH}/sysexits.h"
|
||||
- export *
|
||||
- }
|
||||
- module termios {
|
||||
- header "${GLIBC_INCLUDE_PATH}/termios.h"
|
||||
- export *
|
||||
- }
|
||||
- module unistd {
|
||||
- header "${GLIBC_INCLUDE_PATH}/unistd.h"
|
||||
- export *
|
||||
- }
|
||||
- module utime {
|
||||
- header "${GLIBC_INCLUDE_PATH}/utime.h"
|
||||
- export *
|
||||
- }
|
||||
- }
|
||||
-}
|
||||
-
|
||||
diff --git a/swift/stdlib/public/Platform/glibc.modulemap.gyb b/swift/stdlib/public/Platform/glibc.modulemap.gyb
|
||||
index 455dd111e2ce3..8f77e1028001c 100644
|
||||
--- a/swift/stdlib/public/Platform/glibc.modulemap.gyb
|
||||
+++ b/swift/stdlib/public/Platform/glibc.modulemap.gyb
|
||||
@@ -19,7 +19,7 @@
|
||||
/// It's not named just Glibc so that it doesn't conflict in the event of a
|
||||
/// future official glibc modulemap.
|
||||
module SwiftGlibc [system] {
|
||||
-% if CMAKE_SDK == "LINUX":
|
||||
+% if CMAKE_SDK in ["LINUX", "ANDROID"]:
|
||||
link "m"
|
||||
% end
|
||||
% if CMAKE_SDK in ["LINUX", "FREEBSD", "CYGWIN"]:
|
||||
@@ -43,7 +43,7 @@ module SwiftGlibc [system] {
|
||||
export *
|
||||
}
|
||||
|
||||
-% if CMAKE_SDK != "WASI":
|
||||
+% if CMAKE_SDK != "WASI" and CMAKE_SDK != "ANDROID":
|
||||
module CUUID [system] {
|
||||
header "${GLIBC_INCLUDE_PATH}/uuid/uuid.h"
|
||||
link "uuid"
|
||||
diff --git a/swift/stdlib/public/SwiftShims/LibcShims.h b/swift/stdlib/public/SwiftShims/LibcShims.h
|
||||
index 7dfde65ae46a8..82a43efa06e10 100644
|
||||
--- a/swift/stdlib/public/SwiftShims/LibcShims.h
|
||||
+++ b/swift/stdlib/public/SwiftShims/LibcShims.h
|
||||
@@ -68,7 +68,7 @@ static inline __swift_size_t _swift_stdlib_strlen_unsigned(const unsigned char *
|
||||
SWIFT_READONLY
|
||||
static inline int _swift_stdlib_memcmp(const void *s1, const void *s2,
|
||||
__swift_size_t n) {
|
||||
-#if defined(__APPLE__)
|
||||
+#if defined(__APPLE__) || defined(__ANDROID__)
|
||||
extern int memcmp(const void * _Nullable, const void * _Nullable, __swift_size_t);
|
||||
#else
|
||||
extern int memcmp(const void *, const void *, __swift_size_t);
|
||||
diff --git a/swift/test/Interop/C/libc/include-signal.swift b/swift/test/Interop/C/libc/include-signal.swift
|
||||
index 3b420364f3ce8..83029c9b3b530 100644
|
||||
--- a/swift/test/Interop/C/libc/include-signal.swift
|
||||
+++ b/swift/test/Interop/C/libc/include-signal.swift
|
||||
@@ -28,6 +28,6 @@
|
||||
// See https://forums.swift.org/t/problems-with-swiftglibc-and-proposed-fix/37594
|
||||
// for further details.
|
||||
|
||||
-// REQUIRES: OS=linux-gnu
|
||||
+// REQUIRES: OS=linux-gnu || OS=linux-android
|
||||
|
||||
-import IncludeSignal
|
||||
\ No newline at end of file
|
||||
+import IncludeSignal
|
||||
diff --git a/swift/test/Interop/Cxx/class/memory-layout-silgen.swift b/swift/test/Interop/Cxx/class/memory-layout-silgen.swift
|
||||
index a0301a03af7f3..35d3f2797ad32 100644
|
||||
--- a/swift/test/Interop/Cxx/class/memory-layout-silgen.swift
|
||||
+++ b/swift/test/Interop/Cxx/class/memory-layout-silgen.swift
|
||||
@@ -1,8 +1,5 @@
|
||||
// RUN: %target-swiftxx-frontend -I %S/Inputs -emit-ir -o - %s | %FileCheck %s
|
||||
|
||||
-// XFAIL: OS=linux-android
|
||||
-// XFAIL: OS=linux-androideabi
|
||||
-
|
||||
import MemoryLayout
|
||||
|
||||
var v = PrivateMemberLayout()
|
||||
diff --git a/swift/test/Interop/Cxx/libc/include-glibc.swift b/swift/test/Interop/Cxx/libc/include-glibc.swift
|
||||
index 116dc88895783..b36e7379d22b0 100644
|
||||
--- a/swift/test/Interop/Cxx/libc/include-glibc.swift
|
||||
+++ b/swift/test/Interop/Cxx/libc/include-glibc.swift
|
||||
@@ -1,7 +1,7 @@
|
||||
// RUN: %target-run-simple-swift(-Xfrontend -enable-cxx-interop)
|
||||
|
||||
// REQUIRES: executable_test
|
||||
-// REQUIRES: OS=linux-gnu
|
||||
+// REQUIRES: OS=linux-gnu || OS=linux-android
|
||||
|
||||
import Glibc
|
||||
import StdlibUnittest
|
|
@ -26,6 +26,14 @@ index b1d060328bc..218c9215260 100755
|
|||
)
|
||||
fi
|
||||
|
||||
@@ -2035,6 +2035,7 @@ for host in "${ALL_HOSTS[@]}"; do
|
||||
-DSWIFT_TOOLS_ENABLE_LTO:STRING="${SWIFT_TOOLS_ENABLE_LTO}"
|
||||
-DSWIFT_BUILD_RUNTIME_WITH_HOST_COMPILER:BOOL=$(true_false "${BUILD_RUNTIME_WITH_HOST_COMPILER}")
|
||||
-DLIBDISPATCH_CMAKE_BUILD_TYPE:STRING="${LIBDISPATCH_BUILD_TYPE}"
|
||||
+ -DSWIFT_CLANG_RESOURCE_DIR_SYMLINK_INSTALL_TARGET:STRING="../clang/${TERMUX_CLANG_VERSION}"
|
||||
"${swift_cmake_options[@]}"
|
||||
)
|
||||
|
||||
@@ -2045,6 +2045,8 @@ for host in "${ALL_HOSTS[@]}"; do
|
||||
cmake_options+=(
|
||||
-DCMAKE_FIND_ROOT_PATH:PATH="${CROSS_COMPILE_DEPS_PATH}"
|
||||
|
|
|
@ -1,376 +0,0 @@
|
|||
diff --git a/swift/utils/build_swift/build_swift/driver_arguments.py b/swift/utils/build_swift/build_swift/driver_arguments.py
|
||||
index cf2b19a4d7b44..1c153688146d6 100644
|
||||
--- a/swift/utils/build_swift/build_swift/driver_arguments.py
|
||||
+++ b/swift/utils/build_swift/build_swift/driver_arguments.py
|
||||
@@ -563,6 +563,11 @@ def create_argument_parser():
|
||||
help='A space separated list of targets to cross-compile host '
|
||||
'Swift tools for. Can be used multiple times.')
|
||||
|
||||
+ option('--cross-compile-deps-path', store_path,
|
||||
+ help='The path to a directory that contains prebuilt cross-compiled '
|
||||
+ 'library dependencies of the corelibs and other Swift repos, '
|
||||
+ 'such as the libcurl dependency of FoundationNetworking')
|
||||
+
|
||||
option('--stdlib-deployment-targets', store,
|
||||
type=argparse.ShellSplitType(),
|
||||
default=None,
|
||||
diff --git a/swift/utils/build_swift/tests/expected_options.py b/swift/utils/build_swift/tests/expected_options.py
|
||||
index 31e9a637e982f..e4a748119518d 100644
|
||||
--- a/swift/utils/build_swift/tests/expected_options.py
|
||||
+++ b/swift/utils/build_swift/tests/expected_options.py
|
||||
@@ -131,6 +131,7 @@
|
||||
'cmark_build_variant': 'Debug',
|
||||
'compiler_vendor': defaults.COMPILER_VENDOR,
|
||||
'coverage_db': None,
|
||||
+ 'cross_compile_deps_path': None,
|
||||
'cross_compile_hosts': [],
|
||||
'darwin_deployment_version_ios':
|
||||
defaults.DARWIN_DEPLOYMENT_VERSION_IOS,
|
||||
@@ -694,6 +695,7 @@ class BuildScriptImplOption(_BaseOption):
|
||||
PathOption('--clang-profile-instr-use'),
|
||||
PathOption('--cmake'),
|
||||
PathOption('--coverage-db'),
|
||||
+ PathOption('--cross-compile-deps-path'),
|
||||
PathOption('--host-cc'),
|
||||
PathOption('--host-cxx'),
|
||||
PathOption('--host-libtool'),
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py b/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py
|
||||
index 0b127d46c4890..0e9908b72989b 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py
|
||||
@@ -181,6 +181,10 @@ def convert_to_impl_arguments(self):
|
||||
if args.cross_compile_hosts:
|
||||
impl_args += [
|
||||
"--cross-compile-hosts", " ".join(args.cross_compile_hosts)]
|
||||
+ if args.cross_compile_deps_path is not None:
|
||||
+ impl_args += [
|
||||
+ "--cross-compile-deps-path=%s" % args.cross_compile_deps_path
|
||||
+ ]
|
||||
|
||||
if args.test_paths:
|
||||
impl_args += ["--test-paths", " ".join(args.test_paths)]
|
||||
@@ -664,12 +668,14 @@ def execute(self):
|
||||
self._execute_impl(pipeline, all_hosts, perform_epilogue_opts)
|
||||
else:
|
||||
assert(index != last_impl_index)
|
||||
- # Once we have performed our last impl pipeline, we no longer
|
||||
- # support cross compilation.
|
||||
- #
|
||||
- # This just maintains current behavior.
|
||||
if index > last_impl_index:
|
||||
- self._execute(pipeline, [self.args.host_target])
|
||||
+ non_darwin_cross_compile_hostnames = [
|
||||
+ target for target in self.args.cross_compile_hosts if not
|
||||
+ StdlibDeploymentTarget.get_target_for_name(
|
||||
+ target).platform.is_darwin
|
||||
+ ]
|
||||
+ self._execute(pipeline, [self.args.host_target] +
|
||||
+ non_darwin_cross_compile_hostnames)
|
||||
else:
|
||||
self._execute(pipeline, all_host_names)
|
||||
|
||||
@@ -727,6 +733,8 @@ def _execute_impl(self, pipeline, all_hosts, should_run_epilogue_operations):
|
||||
|
||||
def _execute(self, pipeline, all_host_names):
|
||||
for host_target in all_host_names:
|
||||
+ if self.args.skip_local_build and host_target == self.args.host_target:
|
||||
+ continue
|
||||
for product_class in pipeline:
|
||||
# Execute clean, build, test, install
|
||||
self.execute_product_build_steps(product_class, host_target)
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/products/benchmarks.py b/swift/utils/swift_build_support/swift_build_support/products/benchmarks.py
|
||||
index df3134ecb4194..0ec3f4c897e28 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/benchmarks.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/benchmarks.py
|
||||
@@ -104,9 +104,7 @@ def _get_toolchain_path(host_target, product, args):
|
||||
# this logic initially was inside run_build_script_helper
|
||||
# and was factored out so it can be used in testing as well
|
||||
|
||||
- toolchain_path = swiftpm.SwiftPM.get_install_destdir(args,
|
||||
- host_target,
|
||||
- product.build_dir)
|
||||
+ toolchain_path = product.host_install_destdir(host_target)
|
||||
if platform.system() == 'Darwin':
|
||||
# The prefix is an absolute path, so concatenate without os.path.
|
||||
toolchain_path += \
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/products/indexstoredb.py b/swift/utils/swift_build_support/swift_build_support/products/indexstoredb.py
|
||||
index 28838a443e8dd..af187e9e612ce 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/indexstoredb.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/indexstoredb.py
|
||||
@@ -80,13 +80,8 @@ def run_build_script_helper(action, host_target, product, args,
|
||||
script_path = os.path.join(
|
||||
product.source_dir, 'Utilities', 'build-script-helper.py')
|
||||
|
||||
- install_destdir = args.install_destdir
|
||||
- if swiftpm.SwiftPM.has_cross_compile_hosts(args):
|
||||
- install_destdir = swiftpm.SwiftPM.get_install_destdir(args,
|
||||
- host_target,
|
||||
- product.build_dir)
|
||||
- toolchain_path = targets.toolchain_path(install_destdir,
|
||||
- args.install_prefix)
|
||||
+ install_destdir = product.host_install_destdir(host_target)
|
||||
+ toolchain_path = product.native_toolchain_path(host_target)
|
||||
is_release = product.is_release()
|
||||
configuration = 'release' if is_release else 'debug'
|
||||
helper_cmd = [
|
||||
@@ -110,4 +105,22 @@ def run_build_script_helper(action, host_target, product, args,
|
||||
elif args.enable_tsan:
|
||||
helper_cmd.extend(['--sanitize', 'thread'])
|
||||
|
||||
+ if not product.is_darwin_host(
|
||||
+ host_target) and product.is_cross_compile_target(host_target):
|
||||
+ helper_cmd.extend(['--cross-compile-host', host_target])
|
||||
+ build_toolchain_path = install_destdir + args.install_prefix
|
||||
+ resource_dir = '%s/lib/swift' % build_toolchain_path
|
||||
+ helper_cmd += [
|
||||
+ '--cross-compile-config',
|
||||
+ targets.StdlibDeploymentTarget.get_target_for_name(host_target).platform
|
||||
+ .swiftpm_config(args, output_dir=build_toolchain_path,
|
||||
+ swift_toolchain=toolchain_path,
|
||||
+ resource_path=resource_dir)
|
||||
+ ]
|
||||
+
|
||||
+ if action == 'install' and product.product_name() == "sourcekitlsp":
|
||||
+ helper_cmd.extend([
|
||||
+ '--prefix', install_destdir + args.install_prefix
|
||||
+ ])
|
||||
+
|
||||
shell.call(helper_cmd)
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/products/product.py b/swift/utils/swift_build_support/swift_build_support/products/product.py
|
||||
index 405f479546171..2f02322ba1d92 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/product.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/product.py
|
||||
@@ -195,18 +195,23 @@ def install_toolchain_path(self, host_target):
|
||||
"""toolchain_path() -> string
|
||||
|
||||
Returns the path to the toolchain that is being created as part of this
|
||||
- build, or to a native prebuilt toolchain that was passed in.
|
||||
+ build
|
||||
"""
|
||||
- if self.args.native_swift_tools_path is not None:
|
||||
- return os.path.split(self.args.native_swift_tools_path)[0]
|
||||
-
|
||||
install_destdir = self.args.install_destdir
|
||||
if self.args.cross_compile_hosts:
|
||||
- build_root = os.path.dirname(self.build_dir)
|
||||
- install_destdir = '%s/intermediate-install/%s' % (build_root, host_target)
|
||||
+ if self.is_darwin_host(host_target):
|
||||
+ install_destdir = self.host_install_destdir(host_target)
|
||||
+ else:
|
||||
+ install_destdir = os.path.join(install_destdir, self.args.host_target)
|
||||
return targets.toolchain_path(install_destdir,
|
||||
self.args.install_prefix)
|
||||
|
||||
+ def native_toolchain_path(self, host_target):
|
||||
+ if self.args.native_swift_tools_path is not None:
|
||||
+ return os.path.split(self.args.native_swift_tools_path)[0]
|
||||
+ else:
|
||||
+ return self.install_toolchain_path(host_target)
|
||||
+
|
||||
def is_darwin_host(self, host_target):
|
||||
return host_target.startswith("macosx") or \
|
||||
host_target.startswith("iphone") or \
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/products/skstresstester.py b/swift/utils/swift_build_support/swift_build_support/products/skstresstester.py
|
||||
index 5e753a5624b8f..ea673f0bde5d2 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/skstresstester.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/skstresstester.py
|
||||
@@ -100,9 +100,7 @@ def should_install(self, host_target):
|
||||
return self.args.install_skstresstester
|
||||
|
||||
def install(self, host_target):
|
||||
- install_destdir = swiftpm.SwiftPM.get_install_destdir(self.args,
|
||||
- host_target,
|
||||
- self.build_dir)
|
||||
+ install_destdir = self.host_install_destdir(host_target)
|
||||
install_prefix = install_destdir + self.args.install_prefix
|
||||
self.run_build_script_helper('install', host_target, [
|
||||
'--prefix', install_prefix
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/products/swiftdriver.py b/swift/utils/swift_build_support/swift_build_support/products/swiftdriver.py
|
||||
index 3bd5755de35be..a3f04b08c0157 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/swiftdriver.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/swiftdriver.py
|
||||
@@ -86,13 +86,8 @@ def run_build_script_helper(action, host_target, product, args):
|
||||
script_path = os.path.join(
|
||||
product.source_dir, 'Utilities', 'build-script-helper.py')
|
||||
|
||||
- install_destdir = args.install_destdir
|
||||
- if swiftpm.SwiftPM.has_cross_compile_hosts(args):
|
||||
- install_destdir = swiftpm.SwiftPM.get_install_destdir(args,
|
||||
- host_target,
|
||||
- product.build_dir)
|
||||
- toolchain_path = targets.toolchain_path(install_destdir,
|
||||
- args.install_prefix)
|
||||
+ install_destdir = product.host_install_destdir(host_target)
|
||||
+ toolchain_path = product.native_toolchain_path(host_target)
|
||||
|
||||
# Pass Dispatch directory down if we built it
|
||||
dispatch_build_dir = os.path.join(
|
||||
@@ -134,10 +129,26 @@ def run_build_script_helper(action, host_target, product, args):
|
||||
]
|
||||
# Pass Cross compile host info
|
||||
if swiftpm.SwiftPM.has_cross_compile_hosts(args):
|
||||
- helper_cmd += ['--cross-compile-hosts']
|
||||
- for cross_compile_host in args.cross_compile_hosts:
|
||||
- helper_cmd += [cross_compile_host]
|
||||
+ if product.is_darwin_host(host_target):
|
||||
+ helper_cmd += ['--cross-compile-hosts']
|
||||
+ for cross_compile_host in args.cross_compile_hosts:
|
||||
+ helper_cmd += [cross_compile_host]
|
||||
+ elif product.is_cross_compile_target(host_target):
|
||||
+ helper_cmd += ['--cross-compile-hosts', host_target]
|
||||
+ build_toolchain_path = install_destdir + args.install_prefix
|
||||
+ resource_dir = '%s/lib/swift' % build_toolchain_path
|
||||
+ helper_cmd += [
|
||||
+ '--cross-compile-config',
|
||||
+ targets.StdlibDeploymentTarget.get_target_for_name(
|
||||
+ host_target).platform.swiftpm_config(
|
||||
+ args, output_dir=build_toolchain_path,
|
||||
+ swift_toolchain=toolchain_path, resource_path=resource_dir)]
|
||||
if args.verbose_build:
|
||||
helper_cmd.append('--verbose')
|
||||
|
||||
+ if action == 'install':
|
||||
+ helper_cmd += [
|
||||
+ '--prefix', install_destdir + args.install_prefix
|
||||
+ ]
|
||||
+
|
||||
shell.call(helper_cmd)
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/products/swiftpm.py b/swift/utils/swift_build_support/swift_build_support/products/swiftpm.py
|
||||
index 4a97f377ef408..57047a439c31d 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/products/swiftpm.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/products/swiftpm.py
|
||||
@@ -23,6 +23,7 @@
|
||||
from . import swift
|
||||
from . import xctest
|
||||
from .. import shell
|
||||
+from ..targets import StdlibDeploymentTarget
|
||||
|
||||
|
||||
class SwiftPM(product.Product):
|
||||
@@ -44,7 +45,8 @@ def should_build(self, host_target):
|
||||
def run_bootstrap_script(self, action, host_target, additional_params=[]):
|
||||
script_path = os.path.join(
|
||||
self.source_dir, 'Utilities', 'bootstrap')
|
||||
- toolchain_path = self.install_toolchain_path(host_target)
|
||||
+
|
||||
+ toolchain_path = self.native_toolchain_path(host_target)
|
||||
swiftc = os.path.join(toolchain_path, "bin", "swiftc")
|
||||
|
||||
# FIXME: We require llbuild build directory in order to build. Is
|
||||
@@ -92,9 +94,22 @@ def run_bootstrap_script(self, action, host_target, additional_params=[]):
|
||||
|
||||
# Pass Cross compile host info
|
||||
if self.has_cross_compile_hosts(self.args):
|
||||
- helper_cmd += ['--cross-compile-hosts']
|
||||
- for cross_compile_host in self.args.cross_compile_hosts:
|
||||
- helper_cmd += [cross_compile_host]
|
||||
+ if self.is_darwin_host(host_target):
|
||||
+ helper_cmd += ['--cross-compile-hosts']
|
||||
+ for cross_compile_host in self.args.cross_compile_hosts:
|
||||
+ helper_cmd += [cross_compile_host]
|
||||
+ elif self.is_cross_compile_target(host_target):
|
||||
+ helper_cmd += ['--cross-compile-hosts', host_target,
|
||||
+ '--skip-cmake-bootstrap']
|
||||
+ build_toolchain_path = self.host_install_destdir(
|
||||
+ host_target) + self.args.install_prefix
|
||||
+ resource_dir = '%s/lib/swift' % build_toolchain_path
|
||||
+ helper_cmd += [
|
||||
+ '--cross-compile-config',
|
||||
+ StdlibDeploymentTarget.get_target_for_name(host_target).platform
|
||||
+ .swiftpm_config(self.args, output_dir=build_toolchain_path,
|
||||
+ swift_toolchain=toolchain_path,
|
||||
+ resource_path=resource_dir)]
|
||||
|
||||
helper_cmd.extend(additional_params)
|
||||
|
||||
@@ -122,18 +137,8 @@ def should_install(self, host_target):
|
||||
def has_cross_compile_hosts(self, args):
|
||||
return args.cross_compile_hosts
|
||||
|
||||
- @classmethod
|
||||
- def get_install_destdir(self, args, host_target, build_dir):
|
||||
- install_destdir = args.install_destdir
|
||||
- if self.has_cross_compile_hosts(args):
|
||||
- build_root = os.path.dirname(build_dir)
|
||||
- install_destdir = '%s/intermediate-install/%s' % (build_root, host_target)
|
||||
- return install_destdir
|
||||
-
|
||||
def install(self, host_target):
|
||||
- install_destdir = self.get_install_destdir(self.args,
|
||||
- host_target,
|
||||
- self.build_dir)
|
||||
+ install_destdir = self.host_install_destdir(host_target)
|
||||
install_prefix = install_destdir + self.args.install_prefix
|
||||
|
||||
self.run_bootstrap_script('install', host_target, [
|
||||
diff --git a/swift/utils/swift_build_support/swift_build_support/targets.py b/swift/utils/swift_build_support/swift_build_support/targets.py
|
||||
index 05966defe2861..c5a86651bb869 100644
|
||||
--- a/swift/utils/swift_build_support/swift_build_support/targets.py
|
||||
+++ b/swift/utils/swift_build_support/swift_build_support/targets.py
|
||||
@@ -80,6 +80,13 @@ def cmake_options(self, args):
|
||||
"""
|
||||
return ''
|
||||
|
||||
+ def swiftpm_config(self, args, output_dir, swift_toolchain, resource_path):
|
||||
+ """
|
||||
+ Generate a JSON file that SPM can use to cross-compile
|
||||
+ """
|
||||
+ raise NotImplementedError('Generating a SwiftPM cross-compilation JSON file '
|
||||
+ 'for %s is not supported yet' % self.name)
|
||||
+
|
||||
|
||||
class DarwinPlatform(Platform):
|
||||
def __init__(self, name, archs, sdk_name=None, is_simulator=False):
|
||||
@@ -155,8 +162,7 @@ def swift_flags(self, args):
|
||||
flags += '-resource-dir %s/swift-%s-%s/lib/swift ' % (
|
||||
args.build_root, self.name, args.android_arch)
|
||||
|
||||
- android_toolchain_path = '%s/toolchains/llvm/prebuilt/%s' % (
|
||||
- args.android_ndk, StdlibDeploymentTarget.host_target().name)
|
||||
+ android_toolchain_path = self.ndk_toolchain_path(args)
|
||||
|
||||
flags += '-sdk %s/sysroot ' % (android_toolchain_path)
|
||||
flags += '-tools-directory %s/bin' % (android_toolchain_path)
|
||||
@@ -171,6 +177,42 @@ def cmake_options(self, args):
|
||||
options += '-DCMAKE_ANDROID_NDK:PATH=%s' % (args.android_ndk)
|
||||
return options
|
||||
|
||||
+ def ndk_toolchain_path(self, args):
|
||||
+ return '%s/toolchains/llvm/prebuilt/%s' % (
|
||||
+ args.android_ndk, StdlibDeploymentTarget.host_target().name)
|
||||
+
|
||||
+ def swiftpm_config(self, args, output_dir, swift_toolchain, resource_path):
|
||||
+ config_file = '%s/swiftpm-android-%s.json' % (output_dir, args.android_arch)
|
||||
+
|
||||
+ if os.path.exists(config_file):
|
||||
+ print("Using existing config at %s" % config_file)
|
||||
+ return config_file
|
||||
+
|
||||
+ spm_json = '{\n'
|
||||
+ spm_json += ' "version": 1,\n'
|
||||
+ spm_json += ' "target": "%s-unknown-linux-android%s",\n' % (
|
||||
+ args.android_arch, args.android_api_level)
|
||||
+ spm_json += ' "toolchain-bin-dir": "%s/bin",\n' % swift_toolchain
|
||||
+ spm_json += ' "sdk": "%s/sysroot",\n' % self.ndk_toolchain_path(args)
|
||||
+
|
||||
+ spm_json += ' "extra-cc-flags": [ "-fPIC", "-I%s/usr/include" ],\n' % (
|
||||
+ args.cross_compile_deps_path)
|
||||
+
|
||||
+ spm_json += ' "extra-swiftc-flags": [\n'
|
||||
+ spm_json += ' "-resource-dir", "%s",\n' % resource_path
|
||||
+ spm_json += ' "-tools-directory", "%s/bin",\n' % (
|
||||
+ self.ndk_toolchain_path(args))
|
||||
+ spm_json += ' "-Xcc", "-I%s/usr/include",\n' % args.cross_compile_deps_path
|
||||
+ spm_json += ' "-L%s/usr/lib"\n' % args.cross_compile_deps_path
|
||||
+ spm_json += ' ],\n'
|
||||
+
|
||||
+ spm_json += ' "extra-cpp-flags": [ "-lstdc++" ]\n'
|
||||
+ spm_json += '}'
|
||||
+
|
||||
+ with open(config_file, 'w') as f:
|
||||
+ f.write(spm_json)
|
||||
+ return config_file
|
||||
+
|
||||
|
||||
class Target(object):
|
||||
"""
|
|
@ -0,0 +1,324 @@
|
|||
commit e3a61c0c348646993d129bc39d13c938da3017b3
|
||||
Author: Saleem Abdulrasool <compnerd@compnerd.org>
|
||||
Date: Tue Aug 16 13:04:44 2022 -0700
|
||||
|
||||
Build: initial pass to support static archives on Windows (#5720)
|
||||
|
||||
Introduce a SPM controlled build rule for building static libraries.
|
||||
This is the intended way to use llbuild to drive the generation of
|
||||
static libraries. We would previously rely on the static default
|
||||
rule intended for testing to generate the static libraries. Not only
|
||||
did this tool not properly support Windows, it would actually cause
|
||||
problems on macOS due to the use of `ar` for the creation of the library
|
||||
over the preferred tool - `libtool`. We now locally determine the
|
||||
correct rule and generate the command.
|
||||
|
||||
This is incomplete support for Windows and in fact regresses
|
||||
functionality. We no longer honour `AR` as an environment variable on
|
||||
Windows and thus cannot switch the implementation of the librarian. We
|
||||
now drive the archiving through `lld-link` unconditionally while we
|
||||
should prefer `link` unless otherwise requested. This is covered as
|
||||
an issue in #5719.
|
||||
|
||||
diff --git a/swiftpm/Sources/Build/BuildPlan.swift b/swiftpm/Sources/Build/BuildPlan.swift
|
||||
index 23aedc70..a70003b5 100644
|
||||
--- a/swiftpm/Sources/Build/BuildPlan.swift
|
||||
+++ b/swiftpm/Sources/Build/BuildPlan.swift
|
||||
@@ -1344,6 +1344,19 @@ public final class ProductBuildDescription {
|
||||
}
|
||||
}
|
||||
|
||||
+ /// The arguments to the librarian to create a static library.
|
||||
+ public func archiveArguments() throws -> [String] {
|
||||
+ let librarian = buildParameters.toolchain.librarianPath.pathString
|
||||
+ let triple = buildParameters.triple
|
||||
+ if triple.isWindows(), librarian.hasSuffix("link") || librarian.hasSuffix("link.exe") {
|
||||
+ return [librarian, "/LIB", "/OUT:\(binary.pathString)", "@\(linkFileListPath.pathString)"]
|
||||
+ }
|
||||
+ if triple.isDarwin(), librarian.hasSuffix("libtool") {
|
||||
+ return [librarian, "-o", binary.pathString, "@\(linkFileListPath.pathString)"]
|
||||
+ }
|
||||
+ return [librarian, "crs", binary.pathString, "@\(linkFileListPath.pathString)"]
|
||||
+ }
|
||||
+
|
||||
/// The arguments to link and create this product.
|
||||
public func linkArguments() throws -> [String] {
|
||||
var args = [buildParameters.toolchain.swiftCompilerPath.pathString]
|
||||
diff --git a/swiftpm/Sources/Build/LLBuildManifestBuilder.swift b/swiftpm/Sources/Build/LLBuildManifestBuilder.swift
|
||||
index 4ca69495..47a4d0dc 100644
|
||||
--- a/swiftpm/Sources/Build/LLBuildManifestBuilder.swift
|
||||
+++ b/swiftpm/Sources/Build/LLBuildManifestBuilder.swift
|
||||
@@ -853,14 +853,17 @@ extension LLBuildManifestBuilder {
|
||||
private func createProductCommand(_ buildProduct: ProductBuildDescription) throws {
|
||||
let cmdName = try buildProduct.product.getCommandName(config: buildConfig)
|
||||
|
||||
- // Create archive tool for static library and shell tool for rest of the products.
|
||||
- if buildProduct.product.type == .library(.static) {
|
||||
- manifest.addArchiveCmd(
|
||||
+ switch buildProduct.product.type {
|
||||
+ case .library(.static):
|
||||
+ manifest.addShellCmd(
|
||||
name: cmdName,
|
||||
+ description: "Archiving \(buildProduct.binary.prettyPath())",
|
||||
inputs: buildProduct.objects.map(Node.file),
|
||||
- outputs: [.file(buildProduct.binary)]
|
||||
+ outputs: [.file(buildProduct.binary)],
|
||||
+ arguments: try buildProduct.archiveArguments()
|
||||
)
|
||||
- } else {
|
||||
+
|
||||
+ default:
|
||||
let inputs = buildProduct.objects + buildProduct.dylibs.map({ $0.binary })
|
||||
|
||||
manifest.addShellCmd(
|
||||
diff --git a/swiftpm/Sources/LLBuildManifest/BuildManifest.swift b/swiftpm/Sources/LLBuildManifest/BuildManifest.swift
|
||||
index dde10b7d..77e3a114 100644
|
||||
--- a/swiftpm/Sources/LLBuildManifest/BuildManifest.swift
|
||||
+++ b/swiftpm/Sources/LLBuildManifest/BuildManifest.swift
|
||||
@@ -88,16 +88,6 @@ public struct BuildManifest {
|
||||
commands[name] = Command(name: name, tool: tool)
|
||||
}
|
||||
|
||||
- public mutating func addArchiveCmd(
|
||||
- name: String,
|
||||
- inputs: [Node],
|
||||
- outputs: [Node]
|
||||
- ) {
|
||||
- assert(commands[name] == nil, "already had a command named '\(name)'")
|
||||
- let tool = ArchiveTool(inputs: inputs, outputs: outputs)
|
||||
- commands[name] = Command(name: name, tool: tool)
|
||||
- }
|
||||
-
|
||||
public mutating func addShellCmd(
|
||||
name: String,
|
||||
description: String,
|
||||
diff --git a/swiftpm/Sources/PackageModel/Toolchain.swift b/swiftpm/Sources/PackageModel/Toolchain.swift
|
||||
index 1c2b34ed..c932742f 100644
|
||||
--- a/swiftpm/Sources/PackageModel/Toolchain.swift
|
||||
+++ b/swiftpm/Sources/PackageModel/Toolchain.swift
|
||||
@@ -13,6 +13,9 @@
|
||||
import TSCBasic
|
||||
|
||||
public protocol Toolchain {
|
||||
+ /// Path of the librarian.
|
||||
+ var librarianPath: AbsolutePath { get }
|
||||
+
|
||||
/// Path of the `swiftc` compiler.
|
||||
var swiftCompilerPath: AbsolutePath { get }
|
||||
|
||||
diff --git a/swiftpm/Sources/PackageModel/ToolchainConfiguration.swift b/swiftpm/Sources/PackageModel/ToolchainConfiguration.swift
|
||||
index 00968aa8..7e377e29 100644
|
||||
--- a/swiftpm/Sources/PackageModel/ToolchainConfiguration.swift
|
||||
+++ b/swiftpm/Sources/PackageModel/ToolchainConfiguration.swift
|
||||
@@ -18,6 +18,9 @@ import TSCBasic
|
||||
/// These requirements are abstracted out to make it easier to add support for
|
||||
/// using the package manager with alternate toolchains in the future.
|
||||
public struct ToolchainConfiguration {
|
||||
+ /// The path of the librarian.
|
||||
+ public var librarianPath: AbsolutePath
|
||||
+
|
||||
/// The path of the swift compiler.
|
||||
public var swiftCompilerPath: AbsolutePath
|
||||
|
||||
@@ -43,13 +46,15 @@ public struct ToolchainConfiguration {
|
||||
/// Creates the set of manifest resources associated with a `swiftc` executable.
|
||||
///
|
||||
/// - Parameters:
|
||||
- /// - swiftCompilerPath: The absolute path of the associated swift compiler executable (`swiftc`).
|
||||
+ /// - librarianPath: The absolute path to the librarian
|
||||
+ /// - swiftCompilerPath: The absolute path of the associated swift compiler executable (`swiftc`).
|
||||
/// - swiftCompilerFlags: Extra flags to pass to the Swift compiler.
|
||||
/// - swiftCompilerEnvironment: Environment variables to pass to the Swift compiler.
|
||||
/// - swiftPMLibrariesRootPath: Custom path for SwiftPM libraries. Computed based on the compiler path by default.
|
||||
/// - sdkRootPath: Optional path to SDK root.
|
||||
/// - xctestPath: Optional path to XCTest.
|
||||
public init(
|
||||
+ librarianPath: AbsolutePath,
|
||||
swiftCompilerPath: AbsolutePath,
|
||||
swiftCompilerFlags: [String] = [],
|
||||
swiftCompilerEnvironment: EnvironmentVariables = .process(),
|
||||
@@ -61,6 +66,7 @@ public struct ToolchainConfiguration {
|
||||
return .init(swiftCompilerPath: swiftCompilerPath)
|
||||
}()
|
||||
|
||||
+ self.librarianPath = librarianPath
|
||||
self.swiftCompilerPath = swiftCompilerPath
|
||||
self.swiftCompilerFlags = swiftCompilerFlags
|
||||
self.swiftCompilerEnvironment = swiftCompilerEnvironment
|
||||
diff --git a/swiftpm/Sources/PackageModel/UserToolchain.swift b/swiftpm/Sources/PackageModel/UserToolchain.swift
|
||||
index a5248401..1e1c0bb6 100644
|
||||
--- a/swiftpm/Sources/PackageModel/UserToolchain.swift
|
||||
+++ b/swiftpm/Sources/PackageModel/UserToolchain.swift
|
||||
@@ -28,6 +28,9 @@ public final class UserToolchain: Toolchain {
|
||||
/// The toolchain configuration.
|
||||
private let configuration: ToolchainConfiguration
|
||||
|
||||
+ /// Path of the librarian.
|
||||
+ public let librarianPath: AbsolutePath
|
||||
+
|
||||
/// Path of the `swiftc` compiler.
|
||||
public let swiftCompilerPath: AbsolutePath
|
||||
|
||||
@@ -113,6 +116,43 @@ public final class UserToolchain: Toolchain {
|
||||
|
||||
// MARK: - public API
|
||||
|
||||
+ public static func determineLibrarian(triple: Triple, binDir: AbsolutePath,
|
||||
+ useXcrun: Bool,
|
||||
+ environment: EnvironmentVariables,
|
||||
+ searchPaths: [AbsolutePath]) throws
|
||||
+ -> AbsolutePath {
|
||||
+ let variable: String = triple.isDarwin() ? "LIBTOOL" : "AR"
|
||||
+ let tool: String = {
|
||||
+ if triple.isDarwin() { return "libtool" }
|
||||
+ if triple.isWindows() {
|
||||
+ if let librarian: AbsolutePath =
|
||||
+ UserToolchain.lookup(variable: "AR",
|
||||
+ searchPaths: searchPaths,
|
||||
+ environment: environment) {
|
||||
+ return librarian.basename
|
||||
+ }
|
||||
+ // TODO(5719) use `lld-link` if the build requests lld.
|
||||
+ return "link"
|
||||
+ }
|
||||
+ // TODO(compnerd) consider defaulting to `llvm-ar` universally with
|
||||
+ // a fallback to `ar`.
|
||||
+ return triple.isAndroid() ? "llvm-ar" : "ar"
|
||||
+ }()
|
||||
+
|
||||
+ if let librarian: AbsolutePath = UserToolchain.lookup(variable: variable,
|
||||
+ searchPaths: searchPaths,
|
||||
+ environment: environment) {
|
||||
+ if localFileSystem.isExecutableFile(librarian) {
|
||||
+ return librarian
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if let librarian = try? UserToolchain.getTool(tool, binDir: binDir) {
|
||||
+ return librarian
|
||||
+ }
|
||||
+ return try UserToolchain.findTool(tool, envSearchPaths: searchPaths, useXcrun: useXcrun)
|
||||
+ }
|
||||
+
|
||||
/// Determines the Swift compiler paths for compilation and manifest parsing.
|
||||
public static func determineSwiftCompilers(binDir: AbsolutePath, useXcrun: Bool, environment: EnvironmentVariables, searchPaths: [AbsolutePath]) throws -> SwiftCompilers {
|
||||
func validateCompiler(at path: AbsolutePath?) throws {
|
||||
@@ -339,6 +379,8 @@ public final class UserToolchain: Toolchain {
|
||||
// Use the triple from destination or compute the host triple using swiftc.
|
||||
var triple = destination.target ?? Triple.getHostTriple(usingSwiftCompiler: swiftCompilers.compile)
|
||||
|
||||
+ self.librarianPath = try UserToolchain.determineLibrarian(triple: triple, binDir: binDir, useXcrun: useXcrun, environment: environment, searchPaths: envSearchPaths)
|
||||
+
|
||||
// Change the triple to the specified arch if there's exactly one of them.
|
||||
// The Triple property is only looked at by the native build system currently.
|
||||
if archs.count == 1 {
|
||||
@@ -400,6 +442,7 @@ public final class UserToolchain: Toolchain {
|
||||
}
|
||||
|
||||
self.configuration = .init(
|
||||
+ librarianPath: librarianPath,
|
||||
swiftCompilerPath: swiftCompilers.manifest,
|
||||
swiftCompilerFlags: self.extraSwiftCFlags,
|
||||
swiftCompilerEnvironment: environment,
|
||||
diff --git a/swiftpm/Tests/BuildTests/BuildPlanTests.swift b/swiftpm/Tests/BuildTests/BuildPlanTests.swift
|
||||
index 166667d4..804bd5a0 100644
|
||||
--- a/swiftpm/Tests/BuildTests/BuildPlanTests.swift
|
||||
+++ b/swiftpm/Tests/BuildTests/BuildPlanTests.swift
|
||||
@@ -3227,6 +3227,77 @@ final class BuildPlanTests: XCTestCase {
|
||||
"""))
|
||||
}
|
||||
|
||||
+ func testArchiving() throws {
|
||||
+ let fs = InMemoryFileSystem(emptyFiles:
|
||||
+ "/Package/Sources/rary/rary.swift"
|
||||
+ )
|
||||
+
|
||||
+ let observability = ObservabilitySystem.makeForTesting()
|
||||
+ let graph = try loadPackageGraph(
|
||||
+ fileSystem: fs,
|
||||
+ manifests: [
|
||||
+ Manifest.createRootManifest(
|
||||
+ name: "Package",
|
||||
+ path: .init("/Package"),
|
||||
+ products: [
|
||||
+ ProductDescription(name: "rary", type: .library(.static), targets: ["rary"]),
|
||||
+ ],
|
||||
+ targets: [
|
||||
+ TargetDescription(name: "rary", dependencies: []),
|
||||
+ ]
|
||||
+ ),
|
||||
+ ],
|
||||
+ observabilityScope: observability.topScope
|
||||
+ )
|
||||
+ XCTAssertNoDiagnostics(observability.diagnostics)
|
||||
+
|
||||
+ let result = try BuildPlanResult(plan: BuildPlan(
|
||||
+ buildParameters: mockBuildParameters(),
|
||||
+ graph: graph,
|
||||
+ fileSystem: fs,
|
||||
+ observabilityScope: observability.topScope
|
||||
+ ))
|
||||
+
|
||||
+ let buildPath: AbsolutePath = result.plan.buildParameters.dataPath.appending(components: "debug")
|
||||
+
|
||||
+ let yaml = fs.tempDirectory.appending(components: UUID().uuidString, "debug.yaml")
|
||||
+ try fs.createDirectory(yaml.parentDirectory, recursive: true)
|
||||
+
|
||||
+ let llbuild = LLBuildManifestBuilder(result.plan, fileSystem: fs, observabilityScope: observability.topScope)
|
||||
+ try llbuild.generateManifest(at: yaml)
|
||||
+
|
||||
+ let contents: String = try fs.readFileContents(yaml)
|
||||
+
|
||||
+ if result.plan.buildParameters.triple.isWindows() {
|
||||
+ XCTAssertMatch(contents, .contains("""
|
||||
+ "C.rary-debug.a":
|
||||
+ tool: shell
|
||||
+ inputs: ["\(buildPath.appending(components: "rary.build", "rary.swift.o").escapedPathString())","\(buildPath.appending(components: "rary.build", "rary.swiftmodule.o").escapedPathString())"]
|
||||
+ outputs: ["\(buildPath.appending(components: "library.a").escapedPathString())"]
|
||||
+ description: "Archiving \(buildPath.appending(components: "library.a").escapedPathString())"
|
||||
+ args: ["\(result.plan.buildParameters.toolchain.librarianPath.escapedPathString())","/LIB","/OUT:\(buildPath.appending(components: "library.a").escapedPathString())","@\(buildPath.appending(components: "rary.product", "Objects.LinkFileList").escapedPathString())"]
|
||||
+ """))
|
||||
+ } else if result.plan.buildParameters.triple.isDarwin() {
|
||||
+ XCTAssertMatch(contents, .contains("""
|
||||
+ "C.rary-debug.a":
|
||||
+ tool: shell
|
||||
+ inputs: ["\(buildPath.appending(components: "rary.build", "rary.swift.o").escapedPathString())"]
|
||||
+ outputs: ["\(buildPath.appending(components: "library.a").escapedPathString())"]
|
||||
+ description: "Archiving \(buildPath.appending(components: "library.a").escapedPathString())"
|
||||
+ args: ["\(result.plan.buildParameters.toolchain.librarianPath.escapedPathString())","-o","\(buildPath.appending(components: "library.a").escapedPathString())","@\(buildPath.appending(components: "rary.product", "Objects.LinkFileList").escapedPathString())"]
|
||||
+ """))
|
||||
+ } else { // assume Unix `ar` is the librarian
|
||||
+ XCTAssertMatch(contents, .contains("""
|
||||
+ "C.rary-debug.a":
|
||||
+ tool: shell
|
||||
+ inputs: ["\(buildPath.appending(components: "rary.build", "rary.swift.o").escapedPathString())","\(buildPath.appending(components: "rary.build", "rary.swiftmodule.o").escapedPathString())"]
|
||||
+ outputs: ["\(buildPath.appending(components: "library.a").escapedPathString())"]
|
||||
+ description: "Archiving \(buildPath.appending(components: "library.a").escapedPathString())"
|
||||
+ args: ["\(result.plan.buildParameters.toolchain.librarianPath.escapedPathString())","crs","\(buildPath.appending(components: "library.a").escapedPathString())","@\(buildPath.appending(components: "rary.product", "Objects.LinkFileList").escapedPathString())"]
|
||||
+ """))
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
func testSwiftBundleAccessor() throws {
|
||||
// This has a Swift and ObjC target in the same package.
|
||||
let fs = InMemoryFileSystem(emptyFiles:
|
||||
diff --git a/swiftpm/Tests/BuildTests/MockBuildTestHelper.swift b/swiftpm/Tests/BuildTests/MockBuildTestHelper.swift
|
||||
index 90e9ec6d..e91ce847 100644
|
||||
--- a/swiftpm/Tests/BuildTests/MockBuildTestHelper.swift
|
||||
+++ b/swiftpm/Tests/BuildTests/MockBuildTestHelper.swift
|
||||
@@ -7,6 +7,15 @@ import TSCBasic
|
||||
import XCTest
|
||||
|
||||
struct MockToolchain: PackageModel.Toolchain {
|
||||
+#if os(Windows)
|
||||
+ let librarianPath = AbsolutePath("/fake/path/to/link.exe")
|
||||
+#elseif os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
|
||||
+ let librarianPath = AbsolutePath("/fake/path/to/libtool")
|
||||
+#elseif os(Android)
|
||||
+ let librarianPath = AbsolutePath("/fake/path/to/llvm-ar")
|
||||
+#else
|
||||
+ let librarianPath = AbsolutePath("/fake/path/to/ar")
|
||||
+#endif
|
||||
let swiftCompilerPath = AbsolutePath("/fake/path/to/swiftc")
|
||||
let extraCCFlags: [String] = []
|
||||
let extraSwiftCFlags: [String] = []
|
|
@ -5,7 +5,7 @@ termux_setup_swift() {
|
|||
if [ "$TERMUX_ON_DEVICE_BUILD" = "false" ]; then
|
||||
local TERMUX_SWIFT_VERSION=$(. $TERMUX_SCRIPTDIR/packages/swift/build.sh; echo $TERMUX_PKG_VERSION)
|
||||
local SWIFT_RELEASE=$(. $TERMUX_SCRIPTDIR/packages/swift/build.sh; echo $SWIFT_RELEASE)
|
||||
local SWIFT_BIN="swift-$TERMUX_SWIFT_VERSION-$SWIFT_RELEASE-ubuntu20.04"
|
||||
local SWIFT_BIN="swift-$TERMUX_SWIFT_VERSION-$SWIFT_RELEASE-ubuntu22.04"
|
||||
local SWIFT_FOLDER
|
||||
|
||||
if [ "${TERMUX_PACKAGES_OFFLINE-false}" = "true" ]; then
|
||||
|
@ -17,9 +17,9 @@ termux_setup_swift() {
|
|||
if [ ! -d "$SWIFT_FOLDER" ]; then
|
||||
local SWIFT_TAR=$TERMUX_PKG_TMPDIR/${SWIFT_BIN}.tar.gz
|
||||
termux_download \
|
||||
https://download.swift.org/swift-$TERMUX_SWIFT_VERSION-release/ubuntu2004/swift-$TERMUX_SWIFT_VERSION-$SWIFT_RELEASE/$SWIFT_BIN.tar.gz \
|
||||
https://download.swift.org/swift-$TERMUX_SWIFT_VERSION-release/ubuntu2204/swift-$TERMUX_SWIFT_VERSION-$SWIFT_RELEASE/$SWIFT_BIN.tar.gz \
|
||||
$SWIFT_TAR \
|
||||
81a81d46f517b485f16ebe41b7cf1411fd652f1290268d6983062b91cf3aee67
|
||||
642f76399556947f9ebf83d4b31580395459032be66d29a218f36b99fae37be8
|
||||
|
||||
(cd $TERMUX_PKG_TMPDIR ; tar xf $SWIFT_TAR ; mv $SWIFT_BIN $SWIFT_FOLDER; rm $SWIFT_TAR)
|
||||
fi
|
||||
|
|
Loading…
Reference in New Issue