git: f4e4b0bd39d5 - main - multimedia/navidrome: mark as only for arch amd64 and arm64

From: Baptiste Daroussin <bapt_at_FreeBSD.org>
Date: Thu, 08 Jan 2026 09:44:15 UTC
The branch main has been updated by bapt:

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

commit f4e4b0bd39d5795fe5e994c7fa0e6e6538921f1c
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2026-01-08 07:43:30 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2026-01-08 09:44:13 +0000

    multimedia/navidrome: mark as only for arch amd64 and arm64
    
    Navidrome uses some arch specific nodes modules: esbuild, to build its
    frontend. as such the node cache which is generated at pre-fetch is arch
    dependant, make it so.
    
    Add some hack to make sure make makesum will generate a distinfo which
    contains all supported arches
    
    Approved by:    kbowling (maintainer)
    Differential Revision:  https://reviews.freebsd.org/D54594
---
 multimedia/navidrome/Makefile | 68 ++++++++++++++++++++++++++++---------------
 multimedia/navidrome/distinfo |  8 +++--
 2 files changed, 49 insertions(+), 27 deletions(-)

diff --git a/multimedia/navidrome/Makefile b/multimedia/navidrome/Makefile
index 08c0ebb320a0..11d026b0290c 100644
--- a/multimedia/navidrome/Makefile
+++ b/multimedia/navidrome/Makefile
@@ -2,7 +2,6 @@ PORTNAME=	navidrome
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.59.0
 CATEGORIES=	multimedia
-DISTFILES+=	${PREFETCH_FILE}:prefetch
 
 MAINTAINER=	kbowling@FreeBSD.org
 COMMENT=	Modern Music Server and Streamer compatible with Subsonic/Airsonic
@@ -11,7 +10,7 @@ WWW=		https://www.navidrome.org/
 LICENSE=	GPLv3
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BROKEN_i386=	npm esbuild fails: "Unsupported platform: freebsd ia32 LE"
+ONLY_FOR_ARCHS=	aarch64 amd64
 
 FETCH_DEPENDS=	npm:www/npm${NODEJS_SUFFIX}
 FETCH_DEPENDS=	npm:www/npm${NODEJS_SUFFIX}
@@ -148,7 +147,6 @@ GH_TUPLE=	\
 		yaml:go-yaml:v3.0.4:yaml_go_yaml_1/vendor/go.yaml.in/yaml/v3 \
 		zeebo:xxh3:v1.0.2:zeebo_xxh3/vendor/github.com/zeebo/xxh3
 
-PREFETCH_FILE=	${PORTNAME}-${DISTVERSION}-node${NODEJS_VERSION}-modules${EXTRACT_SUFX}
 PREFETCH_TIMESTAMP=	61171200
 USE_RC_SUBR=	${PORTNAME}
 
@@ -164,6 +162,7 @@ SUB_LIST+=	NAVIDROMEGROUP=${GROUPS} \
 USERS=		www
 GROUPS=		www
 
+# We need ARCH to be defined, which can only happen after options.mk
 .include <bsd.port.options.mk>
 
 # Compiler runs out of memory when compiling the ui on 32-bit platforms:
@@ -172,27 +171,46 @@ GROUPS=		www
 MAKE_ENV+=	NODE_OPTIONS='--max-old-space-size=1492'
 .endif
 
-pre-fetch:
-	if [ ! -f ${DISTDIR}/${PREFETCH_FILE} ]; then \
-		${MKDIR} ${WRKDIR}/ui/node-modules-cache; \
-		${CP} -R ${FILESDIR}/packagejsons/* ${WRKDIR}/ui/node-modules-cache; \
-		cd ${WRKDIR}/ui/node-modules-cache && \
-		${SETENV} HOME=${WRKDIR} \
-			npm ci --ignore-scripts --no-progress --no-audit --no-fund; \
-		${FIND} ${WRKDIR}/ui/node-modules-cache -depth 1 -print | \
-			${GREP} -v node_modules | ${XARGS} ${RM} -r; \
-		${FIND} ${WRKDIR}/ui/node-modules-cache -type d -exec ${CHMOD} 755 {} ';'; \
-		cd ${WRKDIR}//ui/node-modules-cache && \
-		${MTREE_CMD} -cbnSp node_modules | ${MTREE_CMD} -C | ${SED} \
-			-e 's:time=[0-9.]*:time=${PREFETCH_TIMESTAMP}.000000000:' \
-			-e 's:\([gu]id\)=[0-9]*:\1=0:g' \
-			-e 's:flags=.*:flags=none:' \
-			-e 's:^\.:./node_modules:' > node-modules-cache.mtree; \
-		${TAR} -cz --options 'gzip:!timestamp' \
-			-f ${DISTDIR}/${PREFETCH_FILE} \
-			@node-modules-cache.mtree; \
-		${RM} -r ${WRKDIR}; \
-	fi
+.if ${ARCH} == amd64 || make(makesum)
+FILE_AMD64=		${PORTNAME}-${DISTVERSION}-node${NODEJS_VERSION}-amd64-modules.tar.gz
+DISTFILES+=	${FILE_AMD64}:prefetch
+COMBIARCH+=	x64 ${FILE_AMD64}
+.endif
+
+.if ${ARCH} == aarch64 || make(makesum)
+FILE_ARM64=		${PORTNAME}-${DISTVERSION}-node${NODEJS_VERSION}-arm64-modules.tar.gz
+DISTFILES+=	${FILE_ARM64}:prefetch
+COMBIARCH+=	arm64 ${FILE_ARM64}
+.endif
+
+# We need NODEJS_VERSION to be expanded before assigning it so MAKESUM_DEP and NODEJS_VERSION
+# is only expanded after pre.mk
+.include <bsd.port.pre.mk>
+
+.for c f in ${COMBIARCH}
+${DISTDIR}/$f:
+	${MKDIR} ${WRKDIR}/ui/node-modules-cache; \
+	${CP} -R ${FILESDIR}/packagejsons/* ${WRKDIR}/ui/node-modules-cache; \
+	cd ${WRKDIR}/ui/node-modules-cache && \
+	${SETENV} HOME=${WRKDIR} \
+		npm ci --ignore-scripts --no-progress --no-audit --no-fund --cpu=$c; \
+	${FIND} ${WRKDIR}/ui/node-modules-cache -depth 1 -print | \
+		${GREP} -v node_modules | ${XARGS} ${RM} -r; \
+	${FIND} ${WRKDIR}/ui/node-modules-cache -type d -exec ${CHMOD} 755 {} ';'; \
+	cd ${WRKDIR}//ui/node-modules-cache && \
+	${MTREE_CMD} -cbnSp node_modules | ${MTREE_CMD} -C | ${SED} \
+		-e 's:time=[0-9.]*:time=${PREFETCH_TIMESTAMP}.000000000:' \
+		-e 's:\([gu]id\)=[0-9]*:\1=0:g' \
+		-e 's:flags=.*:flags=none:' \
+		-e 's:^\.:./node_modules:' > node-modules-cache.mtree; \
+	${TAR} -cz --options 'gzip:!timestamp' \
+		-f ${DISTDIR}/$f \
+		@node-modules-cache.mtree; \
+	${RM} -r ${WRKDIR}; \
+
+pre-fetch: ${DISTDIR}/$f
+MAKESUM_DEP+= ${DISTDIR}/$f
+.endfor
 
 pre-build:
 	cd ${WRKSRC}/ui && ${SETENV} ${MAKE_ENV} npm run build
@@ -206,3 +224,5 @@ post-install:
 		${STAGEDIR}${ETCDIR}/config.toml.sample
 
 .include <bsd.port.mk>
+
+makesum: ${MAKESUM_DEP}
diff --git a/multimedia/navidrome/distinfo b/multimedia/navidrome/distinfo
index fc24b50a5e80..7e33e6af3471 100644
--- a/multimedia/navidrome/distinfo
+++ b/multimedia/navidrome/distinfo
@@ -1,6 +1,8 @@
-TIMESTAMP = 1767090628
-SHA256 (navidrome-0.59.0-node24-modules.tar.gz) = 9955267d1928787b3e65a7affb3f37d65da6f3128077e9c33f809081365ff084
-SIZE (navidrome-0.59.0-node24-modules.tar.gz) = 85602594
+TIMESTAMP = 1767858101
+SHA256 (navidrome-0.59.0-node24-amd64-modules.tar.gz) = 9955267d1928787b3e65a7affb3f37d65da6f3128077e9c33f809081365ff084
+SIZE (navidrome-0.59.0-node24-amd64-modules.tar.gz) = 85602594
+SHA256 (navidrome-0.59.0-node24-arm64-modules.tar.gz) = 3bbdf65d4d73afe015850c50039423a3edde2127efb1ec29b24c2f7895093230
+SIZE (navidrome-0.59.0-node24-arm64-modules.tar.gz) = 85216583
 SHA256 (navidrome-navidrome-v0.59.0_GH0.tar.gz) = b2a61c975029e59981cc2b443d9382ef92526325dcf26f82c9dd4b004454736d
 SIZE (navidrome-navidrome-v0.59.0_GH0.tar.gz) = 7777061
 SHA256 (Masterminds-semver-v3.4.0_GH0.tar.gz) = 47f43127587cd7750f2054c9ebab8851a3ea2011aefd7cc5319624dac8810799