public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/guru:master commit in: dev-lang/swift/, dev-lang/swift/files/
@ 2024-08-10 15:41 Lucio Sauer
  0 siblings, 0 replies; 2+ messages in thread
From: Lucio Sauer @ 2024-08-10 15:41 UTC (permalink / raw
  To: gentoo-commits

commit:     5efd1ce254e3f7813e9483d3e8755bf57ce8b2d3
Author:     Itai Ferber <itai <AT> itaiferber <DOT> net>
AuthorDate: Fri Aug  9 15:13:01 2024 +0000
Commit:     Lucio Sauer <watermanpaint <AT> posteo <DOT> net>
CommitDate: Fri Aug  9 15:13:10 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=5efd1ce2

dev-lang/swift: switch to source-based builds

Signed-off-by: Itai Ferber <itai <AT> itaiferber.net>

 dev-lang/swift/Manifest                            |  38 ++-
 .../swift/files/swift-5.10.1-link-with-lld.patch   | 144 +++++++++++
 ...-5.10.1-llbuild-link-ncurses-tinfo-gentoo.patch | 142 +++++++++++
 dev-lang/swift/swift-5.10.1.ebuild                 | 264 +++++++++++++++++----
 4 files changed, 547 insertions(+), 41 deletions(-)

diff --git a/dev-lang/swift/Manifest b/dev-lang/swift/Manifest
index 20eea2b81..774e29780 100644
--- a/dev-lang/swift/Manifest
+++ b/dev-lang/swift/Manifest
@@ -1 +1,37 @@
-DIST swift-5.10.1-RELEASE-fedora39.tar.gz 701249576 BLAKE2B 37e3e989476c9676c642c604948eec1285f06998f02e8d75ed723bebb360069dc77d1eabcc8c97039461e018034d71ff7867cb9308c839fd708cca87f3ee90e1 SHA512 582e2f23e6b9dca76c908452ad1a0f20e0ab1f789b3e140568427f13736071ec9ce9c16abaa90535510cc5a08001cd5e95961ae8bb591b249c16f3881d289859
+DIST Yams-5.0.1.tar.gz 658324 BLAKE2B 8e95d96df85115b59334c9e20e03120040f6095c3a3f00110c2cd890077dd17f2f79a22452d380e05e463860c367db39b4df13815ee00ea80964707ef038c9ee SHA512 91feecb95d1997235e443dea925ff11fa665e94c12c8eca2ed066ef340a51ec0253df2545d91184c31423cb4b039e1f89ac8f743cf3f154c9d93495eecc45432
+DIST icu-69.1.tar.gz 62824536 BLAKE2B 591ba9b790e24c824cf5e1108f3ee14bee6c9bbc2379db2e3062970331bb633aefd926e1d407782ccfa754e953d390a9bb9dae5c8a8f7883373a224b0ca010a7 SHA512 4bfe07fb2ce647961ada18b1c5bfa10f38b4b95b8801c9720b3e223f92e6eddabdfc9b9f8553cc092bed309ec663e7f63873e370e390a1de9f7779c6bfe133c1
+DIST indexstore-db-5.10.1.tar.gz 909365 BLAKE2B fde150aff5a46970aafc872be8f9a57e338c648e2d3f5ea49a223d72d3cd402496a1045716551fd07c9954ea123a87070593d6fdd315a825f57d9d513f01d6b3 SHA512 1fc62360a5cd4701da314774b4c5c6a6a9cc2a8d46881962fc80331006c255d173f8ace8d743a09b3fcdbf1e92570248666396a0b78ce8be19eeff65ab6c3235
+DIST llvm-project-5.10.1.tar.gz 171145818 BLAKE2B e314f2e8716cb36b43e1ec23fe2fe212e4ab79e711f4544d54788338067f75b87abe84ecc60b1b5f073f0349d45363346d8a6b89b85f2ae6801cd09709293f52 SHA512 c659041234da1fed29a7186f0e436b0867576096483333d71f11e72828b45e2c7bd9b15db7d3da348a114af48a649f8a484ba3bd4de84d2f5cdb8a7035c5ad30
+DIST sourcekit-lsp-5.10.1.tar.gz 301167 BLAKE2B a1ff3b22c4ab2583d39687aae385fc52dcbb02237035ace8bc0fc6c705db1cd6734dae1656078080c7599ad4b75f5e03def7f60b0e0361bcb25e45bc9ea3c676 SHA512 4a2f7c2129a69c05c8d158877efb1538f092f8eb2d1b1194661cb7c6f201330ecf7fd33bb0d06dd595bc6966e19b739d103478db6c9b2a4c2d7ae351bfb398a8
+DIST swift-5.10.1.tar.gz 31977733 BLAKE2B cc5d37fe5eaa50c912e3abad02e6b04c81cf66f8ea79c89868de323394dc720fc7e122c5b4d2e27291172d61b4c80259b2cf80547ccfaec0b14aae9b63b9b2d2 SHA512 212ede9ba6a874666ceeb30073dd2a9c8b6b08715f375c98b86bee4a78f4a235ad0f1e35ec3d7f9f97c79f963a9d8bd0a6c9737a8c32b073dca828c564145396
+DIST swift-argument-parser-1.2.3.tar.gz 645638 BLAKE2B 68fb561162f1d701ef7b67f6e4c47206b0fc446d5cd248d4b101436c4d444d146e0e39c384c4bf40e80406fa2a695350124c0da8f9144817ce03016a181c6e65 SHA512 2fa09e86da67b6feb09f3c11b656e0e17c050243f9cdf40da3646c881f441bb545c3820345934da60ab80f2e77f575d1c1adb55d8017277e4fe01b68b5a2f692
+DIST swift-asn1-1.0.0.tar.gz 72780 BLAKE2B 87299655f63c9e9ca7633173a824f1b95a77288b127d6bff9c5d9a70d2ac948d4fe51a03fbf8109f3a812948b19e74a2eeebf1a734661e5068a0b2f87ec6df50 SHA512 f0e3bd7a4369b84a140e46a111d3985b62e74581ca631e4354ef769ae7f9190ffb3ff68ea3917df9c377fc308a8681a69b8dea4158a05daf798960be229a48c2
+DIST swift-atomics-1.0.2.tar.gz 158849 BLAKE2B d454e99d5588f2819238deaab15484eb01828cfe0be249381c9cd67fcd9b452df7b0815aa3788e8940889bccee8f1769738425b03b6aeb8ddea32a3827775c5d SHA512 b538a9709eadfe96831393b977add28227da65d814b248bd03effc2bb7e36fff69cca692a6fd5946a029d43ddaca9b38aee91d9abf01e09ec8e5473d07d6886f
+DIST swift-certificates-1.0.1.tar.gz 456979 BLAKE2B 909bfd5ec060cc827541a9740d6ace4ff62f254d510bdb25d3d44692a8c0322572b34779cf3e14c48753d2a936a217912c055831945f99c36dfcab7a42dddb2a SHA512 ea645425fffdb377efe1de9b897a7a6e42dc6668ce93068bbe6de69d42ab6e9801b6d9ff817b728d58eb9e2f66c4932869c281864bc432bd9fb9acb829311c41
+DIST swift-cmark-5.10.1.tar.gz 311407 BLAKE2B fae5e3b6146299012b0881049a2118bcb6c630e292d16217915661dc17d9f05c5995d69e7939243469fb3fd4cf0652ca226e867d5bb1802dd4e495caa81f1ccb SHA512 cb7ffad3ec3fbc74de28df56f4ec5850047abf38ae4a2fdfa37aeacd122c52e3164ef965b582a184911612608df0e450481f9f8c25d11c565518ab39a0d24199
+DIST swift-collections-1.0.5.tar.gz 3796586 BLAKE2B eeb5ec3418b79ba956c1417bc8c12b8affc2d517dcb174f2215de1bec00c802572e6c19598005298ffc6a57e31493d7cdd1c9214b97762f9bff6d0fa01f2263c SHA512 87309c52e5d2115ce8aedda05f35f40e919b367663d9032a159a31163fda7d0aa78df9049e424bda65fe58c4f2a1c74a784c4c6b485581eef450a022a5a7d700
+DIST swift-corelibs-foundation-5.10.1.tar.gz 4479830 BLAKE2B 3fc6773d5fe6971d73360105a25af8d69b6d0f89aa2e04e54f914a433edd97bc7f28f02876fbf84c602ea6c81431d0f490013b988abb56e9a3503c095222994a SHA512 e4ff04e1eb742455f52b43f0a3a1725d0c1c132d2192e4779073c7690ff12991c62c20ca0a42b81d2af12b394e4720309a07cd303ba12f22c2f917570ed0ff5d
+DIST swift-corelibs-libdispatch-5.10.1.tar.gz 594770 BLAKE2B 7e983d27e04dba01f04a2a2e3d5ff6652a2b435497b5cbf392fd77fd385d8dc67a7f1cba7d483a2ee69a9e39e0b7761e31d63dcf6aa8cf068356994c446151ed SHA512 fa8278adbdfd5b041c89a7b14a17aaa805a6f4db12221ff469288bb8d945fd28f16a8d66f56148aeba2e6be30bd6655fbe375d7843d1cb54407527d998e6d6fa
+DIST swift-corelibs-xctest-5.10.1.tar.gz 85377 BLAKE2B aca181aa499b90009678fd10d3a60c063546d66f511ddab9ea88b8674d3919b969924ffacd350aef7a9c7b7ba911a15022f7fce3b578d4dccaa29d89e6f094ca SHA512 6dad6f84ef5a47a74d25211efc25cc2baa13bf0019145cc96ad4d5ac7ddcf79b60dd775f610d099848e3a7b4856f8bb9c06558f6f971324474ae2e6fa8a7cd4f
+DIST swift-crypto-3.0.0.tar.gz 6840005 BLAKE2B 847314bbb05a744198d85b740175b393c3d2b67df068fb096702d932a3482a61fb1d89b95516974437d4ddabdcb8f5f227e8dd9965a4bd69ecd19ddde9c5f88e SHA512 2d79147d32bfb8449726c73c8b267262cf1ddc7c18637f4168e3fd848ba71c0719b23b5683ca513260cbc537fc439e38488ae16010717303625bceb7d5edd36f
+DIST swift-docc-5.10.1.tar.gz 16281601 BLAKE2B b95080699fa1ac9b85a8d6f4e596016362e0699800db088b802ac9abf0ee537416eb63fe1c785a57b0dafd24cb269af1872f0b48eef7e0eabf4c1c3ad2f12e47 SHA512 d72849e583211ff5fef449de2257629b67511476f06724ed798428bd4f5e29224860854bbd262c3d4ae786397704d9589eb2d84a9d4d95f385fba9bc491e208b
+DIST swift-docc-render-artifact-5.10.1.tar.gz 284108 BLAKE2B 1edcdd656a856cc5c75983fd433a3bd0b6288238731fd9e6d2deaaa83b5284fbdab64080027670d90405bafb0ba82296adc4409bb0247ff7ec38b26f0a4094a3 SHA512 d646a4263cade323c2a19f06f1c909e02606b92953b72aa37dc1e49e99199085484d68f90259a821b4e81f2b18de624648db50bde0d8cfd852c291cad39ff282
+DIST swift-docc-symbolkit-5.10.1.tar.gz 171631 BLAKE2B fd72a3e7e36162a0ef91ad60166b4abbe56b52c4ca7bebbd045163e45fc85f196999ddaedd8066dc8c6fd24e949c4f299ca3d9023b73abbda1a9c618a71c5e16 SHA512 cf7a058aeded8455656fa70443b9e280488391957e9003c85c4166925ec6de74675fe9a61571da5897853626e91e4353d72abc76d71a79f4f32e2e4d5b7f4ed9
+DIST swift-driver-5.10.1.tar.gz 2444415 BLAKE2B 5cd3ed582e1473db8c6d571be8d459b29fe4d1b21ffdc686f72b96495c7f0f33565ed27f8822cc157d2db4b7703b07b23dddd9a0ac925d52af68c55dfcc7c0b8 SHA512 77ce7412cf2a5077331250b1fa70e56b6300340aef7224089840018519cab46bcc011074478045e4bf30502912a0619a842bc082509145871a3c0f1da14ccde5
+DIST swift-experimental-string-processing-5.10.1.tar.gz 2579674 BLAKE2B 0f65c0daaeef6bd461fd13d85f822d7878e1d7c99fd03fa828f54f87743048807aee2aa24e5c6962acf29b06aeb56f4578df89f12427585a891a37caf9032abc SHA512 89650c6b68ee6a256fadda84e68d7ea4faf3c09859e80bcc270ca36433ed3e652c7139ed868f6f515e3193928a100c99500574eb614dbf97c345cbfefdb245c2
+DIST swift-format-5.10.1.tar.gz 253210 BLAKE2B 3ca03c57a538e7a894d01d102dea53b07535022b63291633fed55e762be1065951af20cb34aa1e039f43b2cc819a6096474cb693b072f312524191b38ecd564d SHA512 ea072e5c73f14e3c7382bdeba8029ac32d85cb69f99ded1af20c0f3412c8f40ff1ec831edf3e0c8453ffc6fe2d0ae0acdff57cdf914dd796520420ac486c11ef
+DIST swift-installer-scripts-5.10.1.tar.gz 187723 BLAKE2B dc5839f547771b6728be204e90be5b34499dc2490b9ef6fb025c62ba580c6e7e3e0bfc0f186dc88c72f9229362c1867db5818b5b212230d38e4b6de1edd5d075 SHA512 91ff31237218415271008867c11447bbec7c78999430792d338e404aa9a0028b23d6f1526eaa2f75aa9a3db341a9d1cbd769807e8ac5920140d8e68ed4febb8f
+DIST swift-integration-tests-5.10.1.tar.gz 17872 BLAKE2B 33061a544f0c34d9719e2e1da7f1ea5ca72c2f7f15fd8bd2626fac6e07a14d76b40fc299adf8925c9c6e94c6052578d8124355757f4fd4163341fdf9e680b03b SHA512 52dbcd7a9b509253b6f2df4467ebcf0ade8d941581883fa9edf6461ab308f2e07b80e95aa673155066324802e57397887d01249bf055178e08ca7483c11b2250
+DIST swift-llbuild-5.10.1.tar.gz 7092051 BLAKE2B ddbbb05375e024a1b832e42d1a37b6baf09f59dfe4b4b208b000ba274431c39679c5e1e8c4bba3f27caed87e98d1201b1ccd0f693808a3e9ac5566ae8f4823d8 SHA512 010ac22ff4c6e803a537e6e84b3f6047d74fc35f773fcf51f52f9d1546196ed73ab42ab90d1346a0a74239c4f1d11cd183018f42726df42dc921bf0d2235d850
+DIST swift-llvm-bindings-5.10.1.tar.gz 7164 BLAKE2B e466b395f8964b2f340737b47675af65d71742d581fda08ccca66025314a8a792f11a0edccb4816ef3508f3fb15039986432164ece827d59812db9af81d62d5a SHA512 c2f5ed4e6e33b3f9bf3c746cf01a59e98476b402e69cd8dc6f3527e6376669274360ad1aa2035d9dea87d3ab43cf20817aa42a779a3b777d9670e4f954800262
+DIST swift-lmdb-5.10.1.tar.gz 153468 BLAKE2B 56b94dd54ed68d3d70cd482273d0e963c540009401ed497b65a4be03975d4370fa674b82cd3ad1d90b8399111fd20d44ca57991868785fb3d5bb81ffb74bbc5b SHA512 ffbdb5f0efd84b9826c23919a7d4941f6b71ad78a389814e56c2862f441a37484c020aa54e5984076634d5f15c088eeaa84b658f357d4585109c4ca8535ef6cc
+DIST swift-markdown-5.10.1.tar.gz 107990 BLAKE2B fdb8519b634d86b7e2ecc5b12e31f412657cd5462d5c45ef64b621243e1710978a7b05916a1a22acf96741acef3ca94ffeaab6e3bf353fdbd57ac0655cb408dc SHA512 df4d1f240c0d92b2df9bd48b5cd750402a2f855d2a989d7c3722f3eeeaec067d7562caa38b8ea664114359b9c6bf4f2d5502acd62225e3a5e278bf9525f7d24c
+DIST swift-nio-2.31.2.tar.gz 761397 BLAKE2B 567acc6487769e5b8b68a7d51e93f84646bcf66d8569b41a631077af3b2be3ab6bf1aaa2d3f59d2705b9f1e2448d99754e625409a78c29dc80770577b0bfa631 SHA512 e8b8bc5d49c92e327d660c1ee34a9bbdb169e19501211ed56765c51303905494f808d4b76ae9f9a50718db5efe337961ef6baad146197c9d7ba7a8b6c08e3a8e
+DIST swift-nio-ssl-2.15.0.tar.gz 2448033 BLAKE2B a4f795ca965313d4ec33e9b265f2af9fe1a483bc1f266602056c97bb190ff56010c62d3729b66ff1180ff9c2b8f48e697f237b87c3ce0602b717d8d2e8c00b16 SHA512 5ba54beb93d669715b05627455003aad29847f04886ed08fd6bcc37f3ffcb64183c033ae3220446d69bc720a3da5940f3979b8039ddbe8869d81d70a18c42e36
+DIST swift-numerics-1.0.1.tar.gz 55942 BLAKE2B ef3be69b6ac73a86f2dfb7dd5757129d45a2b8dc67500a656d8d68fadba05340032eaa710110cfe7a95ddb438785011416aad8c988e25ba3161dd0a2184bced5 SHA512 7d0d8f27d8c639f92fb652183ade9032b36f39e19b966aa734cab5b4d43ce5d342856dddd87ac1d4cd605c18583c8e629f37634e440de34ec0d5e18aa138d0ba
+DIST swift-package-manager-5.10.1.tar.gz 1522538 BLAKE2B 79406e3f28f6cd577b42c3afdfaa64cd180364eda4165b0256ee36979b340d609162e8dcfcd63c57f7ac5277a92facf5cf9b304dbe19aab6f6632b1bbd379ceb SHA512 303e2b02bdc16cfe3a8812e4d5a79de09ef7367a2f0bbca28c55e2f037b0a8dab684bcaa7189dbcc6c6876d21a4e4da2b0956743b99a0b2c7d4a1be415e0df92
+DIST swift-stress-tester-5.10.1.tar.gz 97998 BLAKE2B a06b983df45c3664f5e74c235f44c1dc887d7ceb10a8751b8f800e33fe8d6017429e50d3e7598f0d3eec4741445884c1224f445d13eb08fd8de0773e59cb84ef SHA512 a0f63b902e7243b455a0e7f60b11e8c0e6448c56a8db39c96fc40bd99a79f2a23147f631b04d79713832bca44403c5cba5b2a8d96eb5bbd4515295a00126290e
+DIST swift-syntax-5.10.1.tar.gz 1142270 BLAKE2B f80ede64271445136a68bdefec85d9da6657b4c14e987af5f6ee7b3054e0a1908ae2ada6980da4bc27a8ed8ada4459ec96efe6fba119a4ad4c1487174405f576 SHA512 6c163502fcf9ae5775ebe7ddc9446a69a2f31e78a161a3f6414a173f501d5479e8be5023a8514ec14a54d5448404df4a4505b4459a8b06fa6b470a453cab5769
+DIST swift-system-1.1.1.tar.gz 69981 BLAKE2B c6e6685228642bcdf403806b58d5ca426ef3c5f85737ddfd52e189b326871f2c482436c90a841c35e83db6dec95cbad3538a38b5c112de9ae7495d7495c61861 SHA512 fec08fbc352197215596974303cd7e08b46ff44b1bd36c70b95be4e7490880f4d7e645e64e90f1c81bfca06d9302c600ccc02c9f5cc7b83a69da46489b105e1c
+DIST swift-tools-support-core-5.10.1.tar.gz 240649 BLAKE2B 42c4106a94252fd5cc0667e94daf107373996a1aac71c0f2d73307c6186d18e61f04cbae574cfd75e848262ab423faaea79555f0b15b699d3441d2f6d80d2bfe SHA512 d69d2e4e9b1e6c44b97c88b73101f7b66a8adb59275e77ca0e3ededd7bf444285a649855f94e7f8aee7b965b734e9b657eef65671f3ce0c4b0c6971380672e6a
+DIST swift-xcode-playground-support-5.10.1.tar.gz 127305 BLAKE2B 702f331c5dbb6fd6c11506b8cd10cdf27d36ee4ab273d5a18d5d80c068ba3fdb7a8b99eeb27f4dfcb7a8bfa060a73452ed4a8e98ac7eb33f8ea657ae67573b21 SHA512 d1f9a178891c64c3e40cd2ae56a48b8afedeb1981330776a04bddff9b94dcaf09542291bf234e6ed1515e046fa8fced506e7b3c3461bc690ca01a58640222c24

diff --git a/dev-lang/swift/files/swift-5.10.1-link-with-lld.patch b/dev-lang/swift/files/swift-5.10.1-link-with-lld.patch
new file mode 100644
index 000000000..5921b301f
--- /dev/null
+++ b/dev-lang/swift/files/swift-5.10.1-link-with-lld.patch
@@ -0,0 +1,144 @@
+# Swift defaults to building with `gold` on Linux because it doesn't build with
+# `bfd`; Gentoo no longer supports `gold`, so we have to build with `lld`.
+#
+# We need to:
+# 1. Have the Swift drivers default to linking with `lld` over `gold` (both for)
+#    eventual end-user code, but also for the built Swift compiler stages to
+#    bootstrap the next stage,
+# 2. Have the `SWIFT_USE_LINKER` flag be correctly respected everywhere, and
+# 3. Set the right linker flags for `lld` because its behavior for ELF on Linux
+#    differs from other platforms, and certain Swift symbols need to not be GC'd
+#    out
+#
+# See https://github.com/swiftlang/swift/pull/69538 (merged to main after 5.10
+# branched).
+
+--- a/swift/lib/Driver/UnixToolChains.cpp
++++ b/swift/lib/Driver/UnixToolChains.cpp
+@@ -110,34 +110,7 @@ ToolChain::InvocationInfo toolchains::GenericUnix::constructInvocation(
+   return II;
+ }
+ 
+-std::string toolchains::GenericUnix::getDefaultLinker() const {
+-  if (getTriple().isAndroid())
+-    return "lld";
+-
+-  switch (getTriple().getArch()) {
+-  case llvm::Triple::arm:
+-  case llvm::Triple::aarch64:
+-  case llvm::Triple::aarch64_32:
+-  case llvm::Triple::armeb:
+-  case llvm::Triple::thumb:
+-  case llvm::Triple::thumbeb:
+-    // BFD linker has issues wrt relocation of the protocol conformance
+-    // section on these targets, it also generates COPY relocations for
+-    // final executables, as such, unless specified, we default to gold
+-    // linker.
+-    return "gold";
+-  case llvm::Triple::x86:
+-  case llvm::Triple::x86_64:
+-  case llvm::Triple::ppc64:
+-  case llvm::Triple::ppc64le:
+-  case llvm::Triple::systemz:
+-    // BFD linker has issues wrt relocations against protected symbols.
+-    return "gold";
+-  default:
+-    // Otherwise, use the default BFD linker.
+-    return "";
+-  }
+-}
++std::string toolchains::GenericUnix::getDefaultLinker() const { return "lld"; }
+ 
+ bool toolchains::GenericUnix::addRuntimeRPath(const llvm::Triple &T,
+                                               const llvm::opt::ArgList &Args) const {
+
+--- a/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
++++ b/swift-driver/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
+@@ -17,25 +17,7 @@ import struct TSCBasic.AbsolutePath
+ 
+ extension GenericUnixToolchain {
+   private func defaultLinker(for targetTriple: Triple) -> String? {
+-    if targetTriple.os == .openbsd || targetTriple.os == .freeBSD ||
+-        targetTriple.environment == .android {
+-      return "lld"
+-    }
+-
+-    switch targetTriple.arch {
+-    case .arm, .aarch64, .armeb, .thumb, .thumbeb:
+-      // BFD linker has issues wrt relocation of the protocol conformance
+-      // section on these targets, it also generates COPY relocations for
+-      // final executables, as such, unless specified, we default to gold
+-      // linker.
+-      return "gold"
+-    case .x86, .x86_64, .ppc64, .ppc64le, .systemz:
+-      // BFD linker has issues wrt relocations against protected symbols.
+-      return "gold"
+-    default:
+-      // Otherwise, use the default BFD linker.
+-      return ""
+-    }
++    "lld"
+   }
+ 
+   private func majorArchitectureName(for triple: Triple) -> String {
+--- a/swift/cmake/modules/AddPureSwift.cmake
++++ b/swift/cmake/modules/AddPureSwift.cmake
+@@ -224,6 +224,10 @@ function(add_pure_swift_host_library name)
+     target_link_options(${name} PRIVATE
+       "-use-ld=${LLVM_USE_LINKER}"
+     )
++  elseif(SWIFT_USE_LINKER)
++    target_link_options(${name} PRIVATE
++      "-use-ld=${SWIFT_USE_LINKER}"
++    )
+   endif()
+
+   # Export this target.
+@@ -322,6 +326,10 @@ function(add_pure_swift_host_tool name)
+     target_link_options(${name} PRIVATE
+       "-use-ld=${LLVM_USE_LINKER}"
+     )
++  elseif(SWIFT_USE_LINKER)
++    target_link_options(${name} PRIVATE
++      "-use-ld=${SWIFT_USE_LINKER}"
++    )
+   endif()
+
+   # Workaround to touch the library and its objects so that we don't
+--- a/swift/cmake/modules/AddSwift.cmake
++++ b/swift/cmake/modules/AddSwift.cmake
+@@ -629,6 +629,10 @@ function(_add_swift_runtime_link_flags target relpath_to_lib_dir bootstrapping)
+         endif()
+       endif()
+     endif()
++
++    if(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD" AND SWIFT_USE_LINKER STREQUAL "lld")
++      target_link_options(${target} PRIVATE "LINKER:-z,nostart-stop-gc")
++    endif()
+   endif()
+
+   set_property(TARGET ${target} PROPERTY BUILD_WITH_INSTALL_RPATH YES)
+--- a/swift/tools/libStaticMirror/CMakeLists.txt
++++ b/swift/tools/libStaticMirror/CMakeLists.txt
+@@ -29,6 +29,10 @@ add_llvm_symbol_exports(libStaticMirror ${LLVM_EXPORTED_SYMBOL_FILE})
+ # Adds -dead_strip option
+ add_link_opts(libStaticMirror)
+
++if(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD" AND SWIFT_USE_LINKER STREQUAL "lld")
++  target_link_options(libStaticMirror PRIVATE "LINKER:-z,nostart-stop-gc")
++endif()
++
+ add_dependencies(static-mirror-lib libStaticMirror)
+ swift_install_in_component(TARGETS libStaticMirror
+   ARCHIVE DESTINATION "lib${LLVM_LIBDIR_SUFFIX}/swift/${SWIFT_SDK_${SWIFT_HOST_VARIANT_SDK}_LIB_SUBDIR}" COMPONENT static-mirror-lib
+--- a/swift/tools/libSwiftScan/CMakeLists.txt
++++ b/swift/tools/libSwiftScan/CMakeLists.txt
+@@ -67,6 +67,10 @@ add_llvm_symbol_exports(libSwiftScan ${LLVM_EXPORTED_SYMBOL_FILE})
+ # Adds -dead_strip option
+ add_link_opts(libSwiftScan)
+
++if(SWIFT_HOST_VARIANT_SDK MATCHES "LINUX|ANDROID|OPENBSD|FREEBSD" AND SWIFT_USE_LINKER STREQUAL "lld")
++  target_link_options(libSwiftScan PRIVATE "LINKER:-z,nostart-stop-gc")
++endif()
++
+ add_dependencies(compiler libSwiftScan)

diff --git a/dev-lang/swift/files/swift-5.10.1-llbuild-link-ncurses-tinfo-gentoo.patch b/dev-lang/swift/files/swift-5.10.1-llbuild-link-ncurses-tinfo-gentoo.patch
new file mode 100644
index 000000000..ca1642d11
--- /dev/null
+++ b/dev-lang/swift/files/swift-5.10.1-llbuild-link-ncurses-tinfo-gentoo.patch
@@ -0,0 +1,142 @@
+# `llbuild` requires various products to link against `curses`; Gentoo doesn't
+# offer `curses` as an alias for `ncurses`, so `llbuild` has to link against
+# `ncurses` explicitly. `ncurses` on Gentoo also doesn't expose the `curses`
+# terminfo database interface (e.g., `set_curterm`, `del_curterm`, etc.), so we
+# have to also explicitly link against `tinfo`.
+
+--- a/llbuild/Package.swift
++++ b/llbuild/Package.swift
+@@ -227,7 +227,8 @@ let package = Package(
+             path: "lib/llvm/Support",
+             linkerSettings: [
+                 .linkedLibrary("m", .when(platforms: [.linux])),
+-                .linkedLibrary("ncurses", .when(platforms: [.linux, .macOS, .android]))]
++                .linkedLibrary("ncurses", .when(platforms: [.linux, .macOS, .android])),
++                .linkedLibrary("tinfo", .when(platforms: [.linux]))]
+         ),
+     ],
+     cxxLanguageStandard: .cxx14
+--- a/llbuild/lib/llvm/Support/CMakeLists.txt
++++ b/llbuild/lib/llvm/Support/CMakeLists.txt
+@@ -65,5 +65,5 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+ endif()
+ 
+ if(${CMAKE_SYSTEM_NAME} MATCHES "Android|Darwin|Linux")
+-  target_link_libraries(llvmSupport PRIVATE curses)
++  target_link_libraries(llvmSupport PRIVATE ncurses tinfo)
+ endif()
+--- a/llbuild/products/libllbuild/CMakeLists.txt
++++ b/llbuild/products/libllbuild/CMakeLists.txt
+@@ -28,7 +28,7 @@ endif()
+ 
+ if(NOT CMAKE_SYSTEM_NAME STREQUAL Windows)
+   target_link_libraries(libllbuild PRIVATE
+-    curses)
++    ncurses tinfo)
+ endif()
+ 
+ target_include_directories(libllbuild
+@@ -79,7 +79,7 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+     llbuildNinja
+     llvmSupport
+     SQLite::SQLite3
+-    curses)
++    ncurses tinfo)
+ 
+   # Manually set up the remaining framework structure.
+   set(LLBUILD_FW_INPUTS)
+--- a/llbuild/products/llbuild/CMakeLists.txt
++++ b/llbuild/products/llbuild/CMakeLists.txt
+@@ -16,5 +16,5 @@ endif()
+ 
+ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+   target_link_libraries(llbuild PRIVATE
+-    curses)
++    ncurses tinfo)
+ endif()
+--- a/llbuild/products/swift-build-tool/CMakeLists.txt
++++ b/llbuild/products/swift-build-tool/CMakeLists.txt
+@@ -10,7 +10,7 @@ target_link_libraries(swift-build-tool PRIVATE
+ 
+ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+   target_link_libraries(swift-build-tool PRIVATE
+-    curses)
++    ncurses tinfo)
+ endif()
+ 
+ install(TARGETS swift-build-tool
+--- a/llbuild/unittests/Basic/CMakeLists.txt
++++ b/llbuild/unittests/Basic/CMakeLists.txt
+@@ -14,5 +14,5 @@ target_link_libraries(BasicTests PRIVATE
+ 
+ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+   target_link_libraries(BasicTests PRIVATE
+-    curses)
++    ncurses tinfo)
+ endif()
+--- a/llbuild/unittests/BuildSystem/CMakeLists.txt
++++ b/llbuild/unittests/BuildSystem/CMakeLists.txt
+@@ -16,5 +16,5 @@ target_link_libraries(BuildSystemTests PRIVATE
+ 
+ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+   target_link_libraries(BuildSystemTests PRIVATE
+-    curses)
++    ncurses tinfo)
+ endif()
+--- a/llbuild/unittests/CAPI/CMakeLists.txt
++++ b/llbuild/unittests/CAPI/CMakeLists.txt
+@@ -15,5 +15,5 @@ target_link_libraries(CAPITests PRIVATE
+ 
+ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+   target_link_libraries(CAPITests PRIVATE
+-    curses)
++    ncurses tinfo)
+ endif()
+--- a/llbuild/unittests/CAS/CMakeLists.txt
++++ b/llbuild/unittests/CAS/CMakeLists.txt
+@@ -8,6 +8,6 @@ target_link_libraries(CASTests PRIVATE
+ 
+ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+   target_link_libraries(CASTests PRIVATE
+-    curses)
++    ncurses tinfo)
+ endif()
+ 
+--- a/llbuild/unittests/Core/CMakeLists.txt
++++ b/llbuild/unittests/Core/CMakeLists.txt
+@@ -15,6 +15,6 @@ target_link_libraries(CoreTests PRIVATE
+ 
+ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+   target_link_libraries(CoreTests PRIVATE
+-    curses)
++    ncurses tinfo)
+ endif()
+ 
+--- a/llbuild/unittests/Evo/CMakeLists.txt
++++ b/llbuild/unittests/Evo/CMakeLists.txt
+@@ -11,6 +11,6 @@ target_link_libraries(EvoTests PRIVATE
+ 
+ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+   target_link_libraries(EvoTests PRIVATE
+-    curses)
++    ncurses tinfo)
+ endif()
+ 
+--- a/llbuild/unittests/Ninja/CMakeLists.txt
++++ b/llbuild/unittests/Ninja/CMakeLists.txt
+@@ -8,5 +8,5 @@ target_link_libraries(NinjaTests PRIVATE
+ 
+ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+   target_link_libraries(NinjaTests PRIVATE
+-    curses)
++    ncurses tinfo)
+ endif()
+--- a/llbuild/utils/adjust-times/CMakeLists.txt
++++ b/llbuild/utils/adjust-times/CMakeLists.txt
+@@ -7,5 +7,5 @@ target_link_libraries(adjust-times PRIVATE llvmSupport)
+ 
+ if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+   target_link_libraries(adjust-times PRIVATE
+-    curses)
++    ncurses tinfo)
+ endif()

diff --git a/dev-lang/swift/swift-5.10.1.ebuild b/dev-lang/swift/swift-5.10.1.ebuild
index 8938f227e..a205ad19d 100644
--- a/dev-lang/swift/swift-5.10.1.ebuild
+++ b/dev-lang/swift/swift-5.10.1.ebuild
@@ -1,63 +1,247 @@
-# Copyright 2024 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{10..13} )
+PYTHON_COMPAT=( python3_{6..13} )
 inherit python-single-r1
 
-DESCRIPTION="A high-level general-purpose, multi-paradigm, compiled programming language"
-HOMEPAGE="https://www.swift.org/"
-SRC_URI="https://download.swift.org/${P}-release/fedora39/${P}-RELEASE/${P}-RELEASE-fedora39.tar.gz"
-S="${WORKDIR}/${P}-RELEASE-fedora39/usr"
+DESCRIPTION="A high-level, general-purpose, multi-paradigm, compiled programming language"
+HOMEPAGE="https://www.swift.org"
 
+SRC_URI="
+	https://github.com/apple/swift-argument-parser/archive/refs/tags/1.2.3.tar.gz -> swift-argument-parser-1.2.3.tar.gz
+	https://github.com/apple/swift-asn1/archive/refs/tags/1.0.0.tar.gz -> swift-asn1-1.0.0.tar.gz
+	https://github.com/apple/swift-atomics/archive/refs/tags/1.0.2.tar.gz -> swift-atomics-1.0.2.tar.gz
+	https://github.com/apple/swift-certificates/archive/refs/tags/1.0.1.tar.gz -> swift-certificates-1.0.1.tar.gz
+	https://github.com/apple/swift-collections/archive/refs/tags/1.0.5.tar.gz -> swift-collections-1.0.5.tar.gz
+	https://github.com/apple/swift-corelibs-foundation/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-corelibs-foundation-${PV}.tar.gz
+	https://github.com/apple/swift-corelibs-libdispatch/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-corelibs-libdispatch-${PV}.tar.gz
+	https://github.com/apple/swift-corelibs-xctest/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-corelibs-xctest-${PV}.tar.gz
+	https://github.com/apple/swift-crypto/archive/refs/tags/3.0.0.tar.gz -> swift-crypto-3.0.0.tar.gz
+	https://github.com/apple/swift-nio-ssl/archive/refs/tags/2.15.0.tar.gz -> swift-nio-ssl-2.15.0.tar.gz
+	https://github.com/apple/swift-nio/archive/refs/tags/2.31.2.tar.gz -> swift-nio-2.31.2.tar.gz
+	https://github.com/apple/swift-numerics/archive/refs/tags/1.0.1.tar.gz -> swift-numerics-1.0.1.tar.gz
+	https://github.com/apple/swift-system/archive/refs/tags/1.1.1.tar.gz -> swift-system-1.1.1.tar.gz
+	https://github.com/apple/swift-xcode-playground-support/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-xcode-playground-support-${PV}.tar.gz
+	https://github.com/jpsim/Yams/archive/refs/tags/5.0.1.tar.gz -> Yams-5.0.1.tar.gz
+	https://github.com/swiftlang/indexstore-db/archive/refs/tags/${P}-RELEASE.tar.gz -> indexstore-db-${PV}.tar.gz
+	https://github.com/swiftlang/llvm-project/archive/refs/tags/${P}-RELEASE.tar.gz -> llvm-project-${PV}.tar.gz
+	https://github.com/swiftlang/sourcekit-lsp/archive/refs/tags/${P}-RELEASE.tar.gz -> sourcekit-lsp-${PV}.tar.gz
+	https://github.com/swiftlang/swift-cmark/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-cmark-${PV}.tar.gz
+	https://github.com/swiftlang/swift-docc-render-artifact/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-docc-render-artifact-${PV}.tar.gz
+	https://github.com/swiftlang/swift-docc-symbolkit/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-docc-symbolkit-${PV}.tar.gz
+	https://github.com/swiftlang/swift-docc/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-docc-${PV}.tar.gz
+	https://github.com/swiftlang/swift-driver/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-driver-${PV}.tar.gz
+	https://github.com/swiftlang/swift-experimental-string-processing/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-experimental-string-processing-${PV}.tar.gz
+	https://github.com/swiftlang/swift-format/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-format-${PV}.tar.gz
+	https://github.com/swiftlang/swift-installer-scripts/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-installer-scripts-${PV}.tar.gz
+	https://github.com/swiftlang/swift-integration-tests/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-integration-tests-${PV}.tar.gz
+	https://github.com/swiftlang/swift-llbuild/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-llbuild-${PV}.tar.gz
+	https://github.com/swiftlang/swift-llvm-bindings/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-llvm-bindings-${PV}.tar.gz
+	https://github.com/swiftlang/swift-lmdb/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-lmdb-${PV}.tar.gz
+	https://github.com/swiftlang/swift-markdown/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-markdown-${PV}.tar.gz
+	https://github.com/swiftlang/swift-package-manager/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-package-manager-${PV}.tar.gz
+	https://github.com/swiftlang/swift-stress-tester/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-stress-tester-${PV}.tar.gz
+	https://github.com/swiftlang/swift-syntax/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-syntax-${PV}.tar.gz
+	https://github.com/swiftlang/swift-tools-support-core/archive/refs/tags/${P}-RELEASE.tar.gz -> swift-tools-support-core-${PV}.tar.gz
+	https://github.com/swiftlang/swift/archive/refs/tags/${P}-RELEASE.tar.gz -> ${P}.tar.gz
+	https://github.com/unicode-org/icu/archive/refs/tags/release-69-1.tar.gz -> icu-69.1.tar.gz
+"
+
+PATCHES="
+	${FILESDIR}/${P}-link-with-lld.patch
+	${FILESDIR}/${P}-llbuild-link-ncurses-tinfo-gentoo.patch
+"
+
+S="${WORKDIR}"
 LICENSE="Apache-2.0"
 SLOT="0"
-KEYWORDS="-* ~amd64"
+KEYWORDS="~amd64"
 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
 
 RESTRICT="strip"
 
 RDEPEND="
 	${PYTHON_DEPS}
-	dev-db/sqlite
+	>=dev-build/cmake-3.24.2
+	>=dev-build/ninja-1.11
+	>=dev-db/sqlite-3
+	>=dev-libs/icu-69
+	>=dev-libs/libedit-20221030
+	>=dev-libs/libxml2-2.11.5
+	>=dev-vcs/git-2.39
+	>=net-misc/curl-8.4
+	>=sys-devel/lld-15
+	>=sys-libs/ncurses-6
+	>=sys-libs/zlib-1.3
 	dev-lang/python
-	dev-libs/libedit
-	dev-libs/libxml2
-	dev-vcs/git
-	net-misc/curl
-	sys-devel/binutils[gold]
-	sys-devel/gcc
-	sys-libs/ncurses
-	sys-libs/zlib
 "
 
-BDEPEND="dev-util/patchelf"
+BDEPEND="
+	>=dev-util/patchelf-0.18
+	>=sys-apps/coreutils-9
+"
+
+src_unpack() {
+	default
+
+	# The Swift project expects a specific directory structure that we have to
+	# match. For most directories, it's enough to trim the version number at the
+	# end:
+	find "${S}" \
+		-mindepth 1 -maxdepth 1 \
+		-execdir sh -c \
+			"mv '{}' \"\$(echo '{}' | sed -e 's_-\(swift-5\.10\.1-RELEASE\|\([0-9]\+\.\)*[0-9]\+\)\$__' | tr '[:upper:]' '[:lower:]')\"" ';' \
+		|| die
+
+	# Some one-off fixups:
+	pushd "${S}" \
+		&& mv 'icu-release-69' 'icu' \
+		&& mv 'swift-cmark' 'cmark' \
+		&& mv 'swift-llbuild' 'llbuild' \
+		&& mv 'swift-package-manager' 'swiftpm' \
+		&& popd \
+		|| die
+}
+
+src_compile() {
+	# The Swift 5.10 compiler is partially written in Swift itself (the new
+	# `swift-driver` + macro support via `swift-syntax`), which requires
+	# bootstrapping with an existing Swift compiler.
+	#
+	# We don't have an existing Swift compiler, but we can bootstrap it with
+	# itself in a 3-stage process:
+	#
+	# 0. We'll build LLVM+Clang and a bare Swift compiler with the old C++-based
+	#    driver and no macro support
+	# 1. We'll use that bare compiler to build a base compiler with the new
+	#    Swift-based driver and macro support, with some base libs
+	# 2. We'll then use that base compiler to build a full Swift toolchain with
+	#    all necessary libs
+	#
+	# Build products will be intentionally shared between stages as much as
+	# possible to avoid unnecessary repeated compilation.
 
-QA_PREBUILT="*"
+	# Building swift-driver writes to this directory for some reason, but the
+	# contents are irrelevant.
+	addpredict /var/lib/portage/home/.swiftpm
+
+	local _extra_cmake_options=(
+		# BFD doesn't link Swift symbols properly, so we have to ensure Swift is
+		# built with LLD.
+		'-DSWIFT_USE_LINKER=lld',
+
+		# We don't need to build any test code or test executables, which Swift
+		# (and some components) does by default.
+		'-DBUILD_TESTING:BOOL=NO',
+		'-DSWIFT_INCLUDE_TESTS:BOOL=NO',
+		'-DSWIFT_INCLUDE_TEST_BINARIES:BOOL=NO',
+
+		# The Clang `compiler-rt` library builds the LLVM ORC JIT component by
+		# default, which we don't need; the component builds with an executable
+		# stack, which we'd like to avoid.
+		'-DCOMPILER_RT_BUILD_ORC:BOOL=NO'
+	)
+	local extra_cmake_options="$(IFS=,; echo "${_extra_cmake_options[*]}")"
+
+	# stage0:
+	# * Bare Swift compiler (no bootstrapping; no Swift driver or macros)
+	# * LLVM+Clang; this is the only stage where these are built because as a
+	#   base dependency, their flags never change, and the build products can be
+	#   reused
+	"${S}/swift/utils/build-script" \
+		--verbose-build \
+		--release \
+		--install-destdir="${S}/stage0" \
+		--extra-cmake-options="${extra_cmake_options}" \
+		--bootstrapping=off \
+		--build-swift-libexec=false \
+		--llvm-install-components='llvm-ar;llvm-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;lld;LTO;clang-features-file' \
+		--llvm-targets-to-build=host \
+		--skip-build-benchmarks \
+		--skip-early-swift-driver --skip-early-swiftsyntax \
+		--skip-test-cmark \
+		--skip-test-linux \
+		--skip-test-swift \
+		--install-all \
+		|| die
+
+	# stage1:
+	# * Base Swift compiler and driver (bootstrapping from stage1; with macros)
+	# * Base libs: swift-driver depends on llbuild + swiftpm, which depend on
+	#   Foundation + libdispatch + XCTest
+	local original_path="${PATH}"
+	export PATH="${S}/stage0/usr/bin:${original_path}"
+	"${S}/swift/utils/build-script" \
+		--verbose-build \
+		--release \
+		--install-destdir="${S}/stage1" \
+		--extra-cmake-options="${extra_cmake_options}" \
+		--build-swift-libexec=false \
+		--cmark --skip-test-cmark \
+		--foundation --skip-test-foundation \
+		--libdispatch --skip-test-libdispatch \
+		--llbuild --skip-test-llbuild \
+		--skip-build-benchmarks \
+		--skip-build-llvm \
+		--skip-test-linux \
+		--skip-test-swift \
+		--swift-driver --skip-test-swift-driver \
+		--swiftpm --skip-test-swiftpm \
+		--xctest --skip-test-xctest \
+		--install-all \
+		|| die
+
+	# stage2: full Swift toolchain (bootstrapping from stage2)
+	export PATH="${S}/stage1/usr/bin:${original_path}"
+	"${S}/swift/utils/build-script" \
+		--verbose-build \
+		--release \
+		--install-destdir="${S}/stage2" \
+		--extra-cmake-options="${extra_cmake_options}" \
+		--build-swift-libexec=false \
+		--foundation --skip-test-foundation \
+		--indexstore-db --skip-test-indexstore-db \
+		--libdispatch --skip-test-libdispatch \
+		--llbuild --skip-test-llbuild \
+		--lldb --skip-test-lldb \
+		--skip-build-benchmarks \
+		--skip-build-llvm \
+		--skip-test-linux \
+		--skip-test-swift \
+		--sourcekit-lsp --skip-test-sourcekit-lsp \
+		--swift-driver --skip-test-swift-driver \
+		--swift-install-components='autolink-driver;compiler;clang-resource-dir-symlink;stdlib;swift-remote-mirror;sdk-overlay;static-mirror-lib;toolchain-tools;license;sourcekit-inproc' \
+		--swiftdocc --skip-test-swiftdocc \
+		--swiftpm --skip-test-swiftpm \
+		--xctest --skip-test-xctest \
+		--install-all \
+		|| die
+
+	export PATH="${original_path}"
+}
 
 src_install() {
-	# lib/swift/linux/libicudataswift.so.69.1 has an empty DT_RUNPATH, which
-	# fails `rpath_security_checks`. It contains only data, so we can remove its
-	# rpath altogether.
-	patchelf --remove-rpath lib/swift/linux/libicudataswift.so.69.1
-
-	# The RELEASE tarball is a self-contained portable installation that's
-	# _significantly_ easier to leave as-is rather than attempt to splat onto
-	# the filesystem; we'll install the contents as-is into
-	# `/usr/lib64/swift-{version}` (e.g., `/usr/lib64/swift-5.10.1`) and expose
-	# the relevant binaries via linking.
-	local dest_dir="/usr/lib64/swift-${PV}"
-	mkdir -p "${ED}${dest_dir}" || die
-	cp -pPR "${S}" "${ED}${dest_dir}" || die
-
-	# Swift ships with its own `clang`, `lldb`, etc.; these don't need to be
+	# `libicudataswift.so.69.1` has an empty `DT_RUNPATH`, which fails
+	# `rpath_security_checks`. It contains only data, so we can remove its rpath
+	# altogether.
+	patchelf --remove-rpath "${S}/stage2/usr/lib/swift/linux/libicudataswift.so.69.1"
+
+	# The Swift build output is intended to be self-contained, and is
+	# _significantly_ easier to leave as-is than attempt to splat onto the
+	# filesystem; we'll install the output versioned into `/usr/lib64` and
+	# expose the relevant binaries via linking.
+	local dest_dir="/usr/lib64/${P}"
+	mkdir -p "${ED}/${dest_dir}" \
+		&& cp -pPR "${S}/stage2/." "${ED}/${dest_dir}" \
+		|| die
+
+	# Swift ships with its own `clang`, `lldb`, etc.; we don't want these to be
 	# exposed externally, so we'll just symlink Swift-specific binaries into
-	# `/usr/bin`.
-	find bin -maxdepth 1 \( -type f -o -type l \) \
-		\( -name "swift*" -o -name "sourcekit*" \) -executable -print0 |
-		while IFS= read -r -d '' exe_path; do
-			local exe_name="$(basename "$exe_path")"
-			dosym -r "${dest_dir}/usr/bin/${exe_name}" "/usr/bin/${exe_name}"
-		done
+	# `/usr/bin`. (The majority of executables don't need to be exposed as
+	# `swift <command>` calls `swift-<command>` directly.)
+	for bin in swift swiftc sourcekit-lsp; do
+		dosym -r "${dest_dir}/usr/bin/${bin}" "/usr/bin/${bin}"
+	done
 }


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] repo/proj/guru:master commit in: dev-lang/swift/, dev-lang/swift/files/
@ 2024-09-16 15:51 David Roman
  0 siblings, 0 replies; 2+ messages in thread
From: David Roman @ 2024-09-16 15:51 UTC (permalink / raw
  To: gentoo-commits

commit:     c9dfaf59e30a6e3d6bb138eb47d1fa8d03c19d51
Author:     Itai Ferber <itai <AT> itaiferber <DOT> net>
AuthorDate: Sun Sep 15 23:49:12 2024 +0000
Commit:     David Roman <davidroman96 <AT> gmail <DOT> com>
CommitDate: Sun Sep 15 23:50:13 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=c9dfaf59

dev-lang/swift: set LLDB to respect PYTHON_SINGLE_TARGET

Closes: https://bugs.gentoo.org/939685
Signed-off-by: Itai Ferber <itai <AT> itaiferber.net>

 .../files/swift-5.10.1-lldb-cmake-minimum-version.patch | 15 +++++++++++++++
 dev-lang/swift/swift-5.10.1.ebuild                      | 17 +++++++++++++++--
 2 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/dev-lang/swift/files/swift-5.10.1-lldb-cmake-minimum-version.patch b/dev-lang/swift/files/swift-5.10.1-lldb-cmake-minimum-version.patch
new file mode 100644
index 000000000..1e29f956c
--- /dev/null
+++ b/dev-lang/swift/files/swift-5.10.1-lldb-cmake-minimum-version.patch
@@ -0,0 +1,15 @@
+# The LLDB Python bindings rely on CMake to find Python, and by default, CMake
+# tries to use the newest Python version found on disk. To get CMake to respect
+# the version of Python set up by `python_setup`, we to set
+# `-DPython3_FIND_UNVERSIONED_NAMES=FIRST`, which is only available from CMake
+# 3.20. (Even if the `cmake` executable is a newer version, it still relies on
+# `cmake_minimum_required` for feature testing.)
+
+--- a/llvm-project/lldb/CMakeLists.txt
++++ b/llvm-project/lldb/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-cmake_minimum_required(VERSION 3.13.4)
++cmake_minimum_required(VERSION 3.20)
+
+ # Add path for custom modules.
+ set(CMAKE_MODULE_PATH

diff --git a/dev-lang/swift/swift-5.10.1.ebuild b/dev-lang/swift/swift-5.10.1.ebuild
index dc70e51ae..29980b12b 100644
--- a/dev-lang/swift/swift-5.10.1.ebuild
+++ b/dev-lang/swift/swift-5.10.1.ebuild
@@ -51,6 +51,7 @@ SRC_URI="
 PATCHES=(
 	"${FILESDIR}/${P}-link-with-lld.patch"
 	"${FILESDIR}/${P}-llbuild-link-ncurses-tinfo-gentoo.patch"
+	"${FILESDIR}/${P}-lldb-cmake-minimum-version.patch"
 )
 
 S="${WORKDIR}"
@@ -119,7 +120,8 @@ src_unpack() {
 src_configure() {
 	default
 
-	# Necessary to respect PYTHON_SINGLE_TARGET, if defined.
+	# Sets `${EPYTHON}` according to `PYTHON_SINGLE_TARGET`, sets up
+	# `${T}/${EPYTHON}` with that version, and adds it to the `PATH`.
 	python_setup
 }
 
@@ -159,7 +161,18 @@ src_compile() {
 		# The Clang `compiler-rt` library builds the LLVM ORC JIT component by
 		# default, which we don't need; the component builds with an executable
 		# stack, which we'd like to avoid.
-		'-DCOMPILER_RT_BUILD_ORC:BOOL=NO'
+		'-DCOMPILER_RT_BUILD_ORC:BOOL=NO',
+
+		# LLDB ships with Python bindings, and uses CMake to search for Python.
+		# By default, CMake tries to find the latest version of Python available
+		# on disk (currently `python3.13`, then `python3.12`, then...). This
+		# might not be the version of Python the rest of the system uses, or
+		# which is specified by `PYTHON_SINGLE_TARGET`.
+		#
+		# Since `python_setup` already places `${EPYTHON}` in the `PATH`, we can
+		# tell CMake to use the unversioned `python` rather than a versioned
+		# one to end up respecting `PYTHON_SINGLE_TARGET`.
+		'-DPython3_FIND_UNVERSIONED_NAMES=FIRST'
 	)
 	local extra_cmake_options="$(IFS=,; echo "${_extra_cmake_options[*]}")"
 


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-09-16 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-16 15:51 [gentoo-commits] repo/proj/guru:master commit in: dev-lang/swift/, dev-lang/swift/files/ David Roman
  -- strict thread matches above, loose matches on Subject: below --
2024-08-10 15:41 Lucio Sauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox