git: 17af616b85fc - 2025Q3 - lang/swift510: fix for building with ccache plus a couple more small changes

From: Kurt Jaeger <pi_at_FreeBSD.org>
Date: Sun, 13 Jul 2025 08:24:08 UTC
The branch 2025Q3 has been updated by pi:

URL: https://cgit.FreeBSD.org/ports/commit/?id=17af616b85fc3f728d45c0ad6e918ce76d548f96

commit 17af616b85fc3f728d45c0ad6e918ce76d548f96
Author:     Jordan Gordeev <jgopensource@proton.me>
AuthorDate: 2025-07-13 08:21:28 +0000
Commit:     Kurt Jaeger <pi@FreeBSD.org>
CommitDate: 2025-07-13 08:23:55 +0000

    lang/swift510: fix for building with ccache plus a couple more small changes
    
    The attached patch includes the following changes:
         - Fix building with ccache
         - Improve readability of MAKE_JOBS_NUMBER code
         - Remove the workaround for libuuid
           After the dependency misc/e2fsprogs-libuuid was replaced with
           misc/libuuid the workaround became unnecessary
         - Bump PORTREVISION
    
    PR:             287968
    Reported by:    kib
    
    (cherry picked from commit 30261c88bb3d9c3568e4129e049b0c631c0aadef)
---
 lang/swift510/Makefile             |  9 +++++----
 lang/swift510/files/start-build.sh | 19 ++++++++++++++++---
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/lang/swift510/Makefile b/lang/swift510/Makefile
index 711f5df85914..6b82bc9d9045 100644
--- a/lang/swift510/Makefile
+++ b/lang/swift510/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	swift510
 DISTVERSION=	5.10.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	lang
 DIST_SUBDIR=	${PORTNAME}
 
@@ -95,7 +95,9 @@ post-patch:
 do-build:
 	@${MKDIR} ${early_stage_dir}
 	${SETENV} \
-		CCACHE_WRAPPER_PATH=${CCACHE_WRAPPER_PATH} \
+		CCACHE_ENABLED=${CCACHE_ENABLED} \
+		CCACHE_BIN=${CCACHE_BIN} \
+		CCACHE_DIR=${CCACHE_DIR} \
 		MAKE_JOBS_NUMBER=${MAKE_JOBS_NUMBER} \
 		${SH} -x ${FILESDIR}/start-build.sh ${WRKSRC} ${early_stage_dir} \
 			${swift_install_prefix} ${WRKDIR}/clang-module-cache
@@ -107,7 +109,6 @@ do-install:
 	${COPYTREE_BIN} .${swift_install_prefix}/bin ${STAGEDIR} ; \
 	for subdir in include lib local share; do \
 		${COPYTREE_SHARE} .${swift_install_prefix}/$${subdir} ${STAGEDIR} ; \
-	done ; \
-	${RM} ${STAGEDIR}/var/run/libuuid/*
+	done
 
 .include <bsd.port.post.mk>
diff --git a/lang/swift510/files/start-build.sh b/lang/swift510/files/start-build.sh
index da8e7fbbe0b2..c5f741292f4e 100644
--- a/lang/swift510/files/start-build.sh
+++ b/lang/swift510/files/start-build.sh
@@ -8,13 +8,26 @@ export PATH="/sbin:/bin:/usr/sbin:/usr/bin:${PATH}"
 
 export CLANG_MODULE_CACHE_PATH=${clang_module_cache_path}
 
+if [ ${CCACHE_ENABLED} = yes ] ; then
+	ccache_fragment="--cmake-c-launcher ${CCACHE_BIN} --cmake-cxx-launcher ${CCACHE_BIN}"
+else
+	ccache_fragment=
+fi
+
+if [ -n "${MAKE_JOBS_NUMBER}" ] ; then
+	jobs_fragment="--jobs ${MAKE_JOBS_NUMBER}"
+else
+	jobs_fragment=
+fi
+
 cd ${swift_project_dir}/swift &&
 utils/build-script --bootstrapping bootstrapping \
 --release \
 --assertions \
-${MAKE_JOBS_NUMBER+--jobs} ${MAKE_JOBS_NUMBER} \
---host-cc ${CCACHE_WRAPPER_PATH:-/usr/bin}/clang \
---host-cxx ${CCACHE_WRAPPER_PATH:-/usr/bin}/clang++ \
+--host-cc /usr/bin/clang \
+--host-cxx /usr/bin/clang++ \
+${ccache_fragment} \
+${jobs_fragment} \
 --llvm-targets-to-build 'AArch64;X86' \
 --skip-early-swift-driver \
 --skip-early-swiftsyntax \