git: 674def2d5dda - 2026Q3 - devel/{,py-}ruff: fix build on armv7

From: Robert Clausecker <fuz_at_FreeBSD.org>
Date: Fri, 10 Jul 2026 08:59:35 UTC
The branch 2026Q3 has been updated by fuz:

URL: https://cgit.FreeBSD.org/ports/commit/?id=674def2d5dda2715c34874cce8270b058f746016

commit 674def2d5dda2715c34874cce8270b058f746016
Author:     Robert Clausecker <fuz@FreeBSD.org>
AuthorDate: 2026-07-09 09:08:54 +0000
Commit:     Robert Clausecker <fuz@FreeBSD.org>
CommitDate: 2026-07-10 08:59:25 +0000

    devel/{,py-}ruff: fix build on armv7
    
    Disable LTO to avoid running out of address space.
    
    Approved by:    portmgr (build fix blanket)
    MFH:            2026Q3
    
    (cherry picked from commit b20829566b2703b31b2a68567a02c6370f4fc617)
---
 devel/py-ruff/Makefile | 13 +++++++++++--
 devel/ruff/Makefile    | 14 ++++++++++++--
 2 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/devel/py-ruff/Makefile b/devel/py-ruff/Makefile
index a2fbf283bdcd..e4a234c967c1 100644
--- a/devel/py-ruff/Makefile
+++ b/devel/py-ruff/Makefile
@@ -521,6 +521,15 @@ CARGO_INSTALL=	no
 CARGO_TEST=	no
 CARGO_TARGET_DIR=	${WRKSRC}/target
 
-# suggested to the upstream to add an ability to use the external ruff executable, see https://github.com/astral-sh/ruff/issues/11932
+.include <bsd.port.pre.mk>
 
-.include <bsd.port.mk>
+# rustc runs out of address space during LTO otherwise
+.if ${ARCH:Marmv?}
+pre-configure:
+	${REINPLACE_CMD} -e '/^lto =/s,"fat",false,' ${WRKSRC}/Cargo.toml
+.endif
+
+# suggested to the upstream to add an ability to use the external ruff
+# executable, see https://github.com/astral-sh/ruff/issues/11932
+
+.include <bsd.port.post.mk>
diff --git a/devel/ruff/Makefile b/devel/ruff/Makefile
index aa989c454bbe..515d2e099b3d 100644
--- a/devel/ruff/Makefile
+++ b/devel/ruff/Makefile
@@ -19,10 +19,12 @@ USES=		cargo
 USE_GITHUB=	yes
 GH_ACCOUNT=	astral-sh
 
-RUSTFLAGS=	${ARCH:S/i386/YES/:C/^[a-z].*//:S/YES/-C target-feature=+sse,+sse2/} # add sse sse2 target-features only on i386
+# add sse sse2 target-features only on i386
+RUSTFLAGS=	${ARCH:S/i386/YES/:C/^[a-z].*//:S/YES/-C target-feature=+sse,+sse2/}
 
 #CARGO_BUILD_ARGS=	--package=file://${WRKSRC}/crates/ruff_cli
 CARGO_INSTALL_PATH=	crates/ruff_cli
+CARGO_INSTALL=	no
 
 PROGS=		ruff \
 		ruff_dev \
@@ -36,6 +38,14 @@ PLIST_FILES=	${PROGS:S/^/bin\//} \
 
 PORTSCOUT=	limit:^.*0\.0\.2[56789].* # don't report before 0.0.25x+
 
+.include <bsd.port.pre.mk>
+
+# rustc runs out of address space during LTO otherwise
+.if ${ARCH:Marmv?}
+LTO_UNSAFE=	yes
+CARGO_ENV+=	CARGO_PROFILE_RELEASE_LTO=false
+.endif
+
 do-install:
 	# workaround for error: found a virtual manifest at `xx` instead of a package manifest
 .for p in ${PROGS}
@@ -53,4 +63,4 @@ do-install:
 	${MKDIR} ${STAGEDIR}${PREFIX}/share/zsh/site-functions
 	${WRKDIR}/target/release/${PORTNAME} generate-shell-completion zsh > ${STAGEDIR}${PREFIX}/share/zsh/site-functions/_${PORTNAME}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>