From ed2090ec4b0be911cb2920aeb3283a26a384baf5 Mon Sep 17 00:00:00 2001
From: Marcin Krzyzanowski <marcin.krzyzanowski@gmail.com>
Date: Sun, 14 Jan 2024 05:09:26 +0100
Subject: [PATCH 1/6] add 'swift'

---
 projects/swift.org/package.yml | 73 ++++++++++++++++++++++++++++++++++
 1 file changed, 73 insertions(+)
 create mode 100644 projects/swift.org/package.yml

diff --git a/projects/swift.org/package.yml b/projects/swift.org/package.yml
new file mode 100644
index 0000000000..985eeb8afc
--- /dev/null
+++ b/projects/swift.org/package.yml
@@ -0,0 +1,73 @@
+distributable:
+  url: https://download.swift.org/swift-{{version}}-release/xcode/swift-{{version}}-RELEASE/swift-{{version}}-RELEASE-osx.pkg
+  strip-components: 1
+
+display-name: swift
+
+# if there’s a github then we can parse the versions
+versions:
+  github: apple/swift  # reads github tags but only tags of releases (this is usually what you want)
+  strip:
+    - /^swift-/
+    - /-RELEASE$/
+
+dependencies:
+  zlib.net: 1
+
+platforms:
+  - darwin
+  # - linux/x86-64
+  # - linux/aarch64
+
+runtime:
+  env:
+    TOOLCHAINS: ${{prefix}}/usr/bin/swift
+
+build:
+  script:
+    - mkdir -p {{prefix}}/bin
+    - tar xf Payload -C {{prefix}}
+    - rm -rf {{prefix}}/_CodeSignature
+    - rm -rf {{prefix}}/Info.plist
+    - run: ln -sh ../usr/bin/* {{prefix}}/bin
+      working-directory: ${{prefix}}/bin
+
+provides:
+  - bin/clang-13
+  - bin/clangd
+  - bin/docc
+  - bin/dsymutil
+  - bin/llvm-ar
+  - bin/llvm-cov
+  - bin/llvm-profdata
+  - bin/sourcekit-lsp
+  - bin/swift-build-sdk-interfaces
+  - bin/swift-build-tool
+  - bin/swift-demangle
+  - bin/swift-driver
+  - bin/swift-format
+  - bin/swift-frontend
+  - bin/swift-help
+  - bin/swift-package
+  - bin/swift-plugin-server
+  - bin/swift-stdlib-tool
+  - bin/swift-api-checker.py
+  - bin/clang
+  - bin/clang-cache
+  - bin/clang-cl
+  - bin/clang-cpp
+  - bin/clang++
+  - bin/swift
+  - bin/swift-api-digester
+  - bin/swift-api-extract
+  - bin/swift-autolink-extract
+  - bin/swift-experimental-sdk
+  - bin/swift-package-collection
+  - bin/swift-package-registry
+  - bin/swift-run
+  - bin/swift-symbolgraph-extract
+  - bin/swift-test
+  - bin/swiftc
+
+test: |
+  swift --version

From 91a625dd326795f73e633ad957995e2f4b6c66ab Mon Sep 17 00:00:00 2001
From: Marcin Krzyzanowski <marcin.krzyzanowski@gmail.com>
Date: Sun, 14 Jan 2024 18:07:41 +0100
Subject: [PATCH 2/6] Conditional for platforms

---
 projects/swift.org/package.yml | 38 ++++++++++++++++++++--------------
 1 file changed, 23 insertions(+), 15 deletions(-)

diff --git a/projects/swift.org/package.yml b/projects/swift.org/package.yml
index 985eeb8afc..5a8c37f837 100644
--- a/projects/swift.org/package.yml
+++ b/projects/swift.org/package.yml
@@ -1,36 +1,44 @@
-distributable:
-  url: https://download.swift.org/swift-{{version}}-release/xcode/swift-{{version}}-RELEASE/swift-{{version}}-RELEASE-osx.pkg
-  strip-components: 1
-
 display-name: swift
 
-# if there’s a github then we can parse the versions
+warnings:
+  - vendored
+
 versions:
-  github: apple/swift  # reads github tags but only tags of releases (this is usually what you want)
+  github: apple/swift
   strip:
     - /^swift-/
     - /-RELEASE$/
 
-dependencies:
-  zlib.net: 1
-
 platforms:
-  - darwin
-  # - linux/x86-64
-  # - linux/aarch64
+  - darwin/aarch64
+  - linux/x86-64
+  - linux/aarch64
 
 runtime:
   env:
     TOOLCHAINS: ${{prefix}}/usr/bin/swift
 
 build:
+  dependencies:
+    curl.se: '*'
   script:
     - mkdir -p {{prefix}}/bin
-    - tar xf Payload -C {{prefix}}
-    - rm -rf {{prefix}}/_CodeSignature
-    - rm -rf {{prefix}}/Info.plist
+    - run: |
+        curl -SfL "$DOWNLOAD_URL" | tar xzf - --strip-components=2
+        tar xzf Payload -C {{prefix}}
+        rm -rf {{prefix}}/_CodeSignature
+        rm -rf {{prefix}}/Info.plist
+      if: darwin
     - run: ln -sh ../usr/bin/* {{prefix}}/bin
       working-directory: ${{prefix}}/bin
+      if: darwin
+    - run: |
+        curl -SfL "$DOWNLOAD_URL" | tar xzf - -C {{ prefix }} --strip-components=2
+      if: linux
+  env:
+    darwin/aarch64: { DOWNLOAD_URL: "https://download.swift.org/swift-{{version}}-release/xcode/swift-{{version}}-RELEASE/swift-{{version}}-RELEASE-osx.pkg" }
+    linux/aarch64:  { DOWNLOAD_URL: "https://download.swift.org/swift-{{version}}-release/ubuntu2204-aarch64/swift-{{version}}-RELEASE/swift-{{version}}-RELEASE-ubuntu22.04-aarch64.tar.gz" }
+    linux/x86-64:   { DOWNLOAD_URL: "https://download.swift.org/swift-{{version}}-release/ubuntu2204/swift-{{version}}-RELEASE/swift-{{version}}-RELEASE-ubuntu22.04.tar.gz" }
 
 provides:
   - bin/clang-13

From 313b93ef715aab4fc8d7dfc377ef67a6216cbb98 Mon Sep 17 00:00:00 2001
From: Marcin Krzyzanowski <marcin.krzyzanowski@gmail.com>
Date: Sun, 14 Jan 2024 18:23:08 +0100
Subject: [PATCH 3/6] Update provides per platform

---
 projects/swift.org/package.yml | 116 +++++++++++++++++++++++----------
 1 file changed, 80 insertions(+), 36 deletions(-)

diff --git a/projects/swift.org/package.yml b/projects/swift.org/package.yml
index 5a8c37f837..6a30fe532c 100644
--- a/projects/swift.org/package.yml
+++ b/projects/swift.org/package.yml
@@ -41,41 +41,85 @@ build:
     linux/x86-64:   { DOWNLOAD_URL: "https://download.swift.org/swift-{{version}}-release/ubuntu2204/swift-{{version}}-RELEASE/swift-{{version}}-RELEASE-ubuntu22.04.tar.gz" }
 
 provides:
-  - bin/clang-13
-  - bin/clangd
-  - bin/docc
-  - bin/dsymutil
-  - bin/llvm-ar
-  - bin/llvm-cov
-  - bin/llvm-profdata
-  - bin/sourcekit-lsp
-  - bin/swift-build-sdk-interfaces
-  - bin/swift-build-tool
-  - bin/swift-demangle
-  - bin/swift-driver
-  - bin/swift-format
-  - bin/swift-frontend
-  - bin/swift-help
-  - bin/swift-package
-  - bin/swift-plugin-server
-  - bin/swift-stdlib-tool
-  - bin/swift-api-checker.py
-  - bin/clang
-  - bin/clang-cache
-  - bin/clang-cl
-  - bin/clang-cpp
-  - bin/clang++
-  - bin/swift
-  - bin/swift-api-digester
-  - bin/swift-api-extract
-  - bin/swift-autolink-extract
-  - bin/swift-experimental-sdk
-  - bin/swift-package-collection
-  - bin/swift-package-registry
-  - bin/swift-run
-  - bin/swift-symbolgraph-extract
-  - bin/swift-test
-  - bin/swiftc
-
+  darwin:
+    - bin/clang-13
+    - bin/clangd
+    - bin/docc
+    - bin/dsymutil
+    - bin/llvm-ar
+    - bin/llvm-cov
+    - bin/llvm-profdata
+    - bin/sourcekit-lsp
+    - bin/swift-api-checker.py
+    - bin/swift-build-sdk-interfaces
+    - bin/swift-build-tool
+    - bin/swift-demangle
+    - bin/swift-driver
+    - bin/swift-format
+    - bin/swift-frontend
+    - bin/swift-help
+    - bin/swift-package
+    - bin/swift-plugin-server
+    - bin/swift-stdlib-tool
+    - bin/clang
+    - bin/clang-cache
+    - bin/clang-cl
+    - bin/clang-cpp
+    - bin/clang++
+    - bin/swift
+    - bin/swift-api-digester
+    - bin/swift-api-extract
+    - bin/swift-autolink-extract
+    - bin/swift-build
+    - bin/swift-experimental-sdk
+    - bin/swift-package-collection
+    - bin/swift-package-registry
+    - bin/swift-run
+    - bin/swift-symbolgraph-extract
+    - bin/swift-test
+    - bin/swiftc
+  linux:
+    - bin/clang-13
+    - bin/clangd
+    - bin/docc
+    - bin/lld
+    - bin/lldb
+    - bin/lldb-argdumper
+    - bin/lldb-server
+    - bin/llvm-ar
+    - bin/llvm-cov
+    - bin/llvm-profdata
+    - bin/plutil
+    - bin/repl_swift
+    - bin/sourcekit-lsp
+    - bin/swift-api-checker.py
+    - bin/swift-build-sdk-interfaces
+    - bin/swift-build-tool
+    - bin/swift-demangle
+    - bin/swift-driver
+    - bin/swift-frontend
+    - bin/swift-help
+    - bin/swift-package
+    - bin/swift-plugin-server
+    - bin/clang
+    - bin/clang-cache
+    - bin/clang-cl
+    - bin/clang-cpp
+    - bin/clang++
+    - bin/ld.lld
+    - bin/ld64.lld
+    - bin/lld-link
+    - bin/swift
+    - bin/swift-api-digester
+    - bin/swift-api-extract
+    - bin/swift-autolink-extract
+    - bin/swift-build
+    - bin/swift-experimental-sdk
+    - bin/swift-package-collection
+    - bin/swift-package-registry
+    - bin/swift-run
+    - bin/swift-symbolgraph-extract
+    - bin/swift-test
+    - bin/swiftc
 test: |
   swift --version

From 800fb5fa192f596d54d8f5502960380d08ff74fa Mon Sep 17 00:00:00 2001
From: Marcin Krzyzanowski <marcin.krzyzanowski@gmail.com>
Date: Sun, 14 Jan 2024 18:29:25 +0100
Subject: [PATCH 4/6] linux dep on gcc

---
 projects/swift.org/package.yml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/projects/swift.org/package.yml b/projects/swift.org/package.yml
index 6a30fe532c..1463f09477 100644
--- a/projects/swift.org/package.yml
+++ b/projects/swift.org/package.yml
@@ -14,6 +14,10 @@ platforms:
   - linux/x86-64
   - linux/aarch64
 
+dependencies:
+  linux:
+    gnu.org/gcc: '*'
+
 runtime:
   env:
     TOOLCHAINS: ${{prefix}}/usr/bin/swift

From c13b89dc070427291834dbd59d9ed0b3070e950b Mon Sep 17 00:00:00 2001
From: Marcin Krzyzanowski <marcin.krzyzanowski@gmail.com>
Date: Sun, 14 Jan 2024 21:16:42 +0100
Subject: [PATCH 5/6] Add deps

---
 projects/swift.org/package.yml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/projects/swift.org/package.yml b/projects/swift.org/package.yml
index 1463f09477..9aa3f478e8 100644
--- a/projects/swift.org/package.yml
+++ b/projects/swift.org/package.yml
@@ -17,6 +17,12 @@ platforms:
 dependencies:
   linux:
     gnu.org/gcc: '*'
+    gnu.org/binutils: '*'
+    gnupg.org: ^2
+    gnome.org/libxml2: '*'
+    libgit2.org: '*'
+    curl.se: '*'
+    sqlite.org: ^3
 
 runtime:
   env:

From 34613f2311be9bdaa146f50cb091a73ab60caf75 Mon Sep 17 00:00:00 2001
From: Marcin Krzyzanowski <marcin.krzyzanowski@gmail.com>
Date: Sun, 14 Jan 2024 21:19:42 +0100
Subject: [PATCH 6/6] Disable linux platform

---
 projects/swift.org/package.yml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/projects/swift.org/package.yml b/projects/swift.org/package.yml
index 9aa3f478e8..d5b381160b 100644
--- a/projects/swift.org/package.yml
+++ b/projects/swift.org/package.yml
@@ -11,8 +11,10 @@ versions:
 
 platforms:
   - darwin/aarch64
-  - linux/x86-64
-  - linux/aarch64
+# It is ready to run on linux. It going to work with ubuntu 22.04,
+# and not with debian-buster and tests going to fail
+#  - linux/x86-64
+#  - linux/aarch64
 
 dependencies:
   linux: