git: 0fbb7d575521 - main - lang/swift6: Unbreak stage phase with unprivileged users

From: Hiroki Tagato <tagattie_at_FreeBSD.org>
Date: Tue, 30 Jun 2026 13:44:47 UTC
The branch main has been updated by tagattie:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0fbb7d57552133f769419bfa27fe3b6201635899

commit 0fbb7d57552133f769419bfa27fe3b6201635899
Author:     Hiroki Tagato <tagattie@FreeBSD.org>
AuthorDate: 2026-06-30 13:40:43 +0000
Commit:     Hiroki Tagato <tagattie@FreeBSD.org>
CommitDate: 2026-06-30 13:44:38 +0000

    lang/swift6: Unbreak stage phase with unprivileged users
    
    Stripping should have been done before COPYTREE_BIN, which drops the
    writable bit from the executables and leads to "permission denied"
    error.
    
    PR:             296382
    Reported by:    kib
    Tested by:      kib
    Fixes:          18ac8a4bf341 (lang/swift6: Add port: Powerful, flexible, multiplatform programming language (Version 6))
---
 lang/swift6/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lang/swift6/Makefile b/lang/swift6/Makefile
index cdbb1bead496..5e27f35f657a 100644
--- a/lang/swift6/Makefile
+++ b/lang/swift6/Makefile
@@ -242,14 +242,16 @@ do-build:
 .endif
 
 do-install:
+.for dir in bin lib
+	@${FIND} ${OUT5_DIR}${SWIFT_PREFIX}/${dir} -type f -exec ${FILE} {} ';' | \
+		${GREP} 'ELF.*FreeBSD' | ${CUT} -d ':' -f 1 | \
+		${XARGS} ${STRIP_CMD} --strip-debug
+.endfor
 	cd ${OUT5_DIR} && ${COPYTREE_BIN} .${SWIFT_PREFIX}/bin ${STAGEDIR}
 	cd ${OUT5_DIR} && \
 	for dir in include lib local share; do \
 		${COPYTREE_SHARE} .${SWIFT_PREFIX}/$${dir} ${STAGEDIR}; \
 	done
-	@${FIND} ${STAGEDIR}${SWIFT_PREFIX} -type f -exec ${FILE} {} ';' | \
-		${GREP} 'ELF.*FreeBSD' | ${CUT} -d ':' -f 1 | \
-		${XARGS} ${STRIP_CMD} --strip-debug
 	@${GZIP_CMD} ${STAGEDIR}${SWIFT_PREFIX}/share/man/man1/swift.1
 
 do-install-DOCS-on: