git: 781076cce2ac - main - lang/swift6: Fix compilation of math functions when using c++ interoperability mode

From: Hiroki Tagato <tagattie_at_FreeBSD.org>
Date: Tue, 06 Oct 2026 09:23:08 UTC
The branch main has been updated by tagattie:

URL: https://cgit.FreeBSD.org/ports/commit/?id=781076cce2ac6effb09c34a6418e63f5e8b25839

commit 781076cce2ac6effb09c34a6418e63f5e8b25839
Author:     Hiroki Tagato <tagattie@FreeBSD.org>
AuthorDate: 2026-10-06 09:17:05 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2026-10-06 09:22:57 +0000

    lang/swift6: Fix compilation of math functions when using c++ interoperability mode
    
    The following code failed to build if it was compiled with c++
    interoperability mode:
    ```
    import Foundation
    print(log2(2.0))
    ```
    with the following error:
    error: reference to declaration 'log2' broken by a context change; the declaration kind of 'log2'  changed since building 'Foundation', it was in 'SwiftGlibc' and now a candidate is found only in 'Foundation'
    
    This commit fixes it.
---
 lang/swift6/Makefile                               |  1 +
 ...wift_stdlib_public_Platform_glibc.modulemap.gyb | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+)

diff --git a/lang/swift6/Makefile b/lang/swift6/Makefile
index 1eba33415db3..78fcc8fe6c9f 100644
--- a/lang/swift6/Makefile
+++ b/lang/swift6/Makefile
@@ -2,6 +2,7 @@ PORTNAME=	swift
 DISTVERSIONPREFIX=	swift-
 DISTVERSION=	6.4.0
 DISTVERSIONSUFFIX=	-RELEASE
+PORTREVISION=	1
 CATEGORIES=	lang
 PKGNAMESUFFIX=	6
 DIST_SUBDIR=	${PORTNAME}
diff --git a/lang/swift6/files/patch-swift_stdlib_public_Platform_glibc.modulemap.gyb b/lang/swift6/files/patch-swift_stdlib_public_Platform_glibc.modulemap.gyb
new file mode 100644
index 000000000000..7f38c2a28268
--- /dev/null
+++ b/lang/swift6/files/patch-swift_stdlib_public_Platform_glibc.modulemap.gyb
@@ -0,0 +1,22 @@
+--- swift/stdlib/public/Platform/glibc.modulemap.gyb.orig	2026-09-13 22:35:30 UTC
++++ swift/stdlib/public/Platform/glibc.modulemap.gyb
+@@ -18,7 +18,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] {
++module SwiftGlibc [system] [no_undeclared_includes] {
+ % if CMAKE_SDK in ["LINUX", "FREEBSD", "OPENBSD"]:
+       link "m"
+ % end
+@@ -42,6 +42,10 @@ module SwiftGlibc [system] {
+ % end
+ 
+   header "SwiftGlibc.h"
++
++% if CMAKE_SDK == "FREEBSD":
++  use signal_h
++% end
+ 
+   // <assert.h>'s use of NDEBUG requires textual inclusion. 
+   textual header "assert.h"