git: d86a98ea7a48 - main - Uses/electronfix.mk: Rework to not require listing supported electron versions

From: Gleb Popov <arrowd_at_FreeBSD.org>
Date: Wed, 04 Sep 2024 04:44:50 UTC
The branch main has been updated by arrowd:

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

commit d86a98ea7a484cc5a3b4b95342ceb60906abafbd
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2024-07-16 09:57:58 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2024-09-04 04:44:28 +0000

    Uses/electronfix.mk: Rework to not require listing supported electron versions
---
 Mk/Uses/electronfix.mk | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/Mk/Uses/electronfix.mk b/Mk/Uses/electronfix.mk
index 73e2e69ffcaf..f5e33da516cb 100644
--- a/Mk/Uses/electronfix.mk
+++ b/Mk/Uses/electronfix.mk
@@ -17,24 +17,18 @@
 .if !defined(_INCLUDE_USES_ELECTRONFIX_MK)
 _INCLUDE_USES_ELECTRONFIX_MK=	yes
 
-_ELECTRONFIX_MK_VALID_VERSIONS=	22 23 24 25 27 28 30
+.  if empty(electronfix_ARGS)
+.    error USES=electronfix requires a version argument
+.  endif
 
-# === parse version arguments ===
-_ELECTRONFIX_MK_VERSION=	# empty
-.  for _ver in ${_ELECTRONFIX_MK_VALID_VERSIONS}
-.    if ${electronfix_ARGS:M${_ver}}
-.      if !empty(_ELECTRONFIX_MK_VERSION)
-BROKEN=		USES=electronfix:${electronfix_ARGS} contains multiple version definitions
-.      else
-_ELECTRONFIX_MK_VERSION=	${_ver}
-.      endif
-.    endif
-.  endfor
+_ELECTRON_MAKEFILE_VERSION=	${.CURDIR}/../../devel/electron${electronfix_ARGS}/Makefile.version
 
-.  include "${.CURDIR}/../../devel/electron${_ELECTRONFIX_MK_VERSION}/Makefile.version"
+.  if !exists(${_ELECTRON_MAKEFILE_VERSION})
+.    error Unknown Electron version in USES=electronfix:${electronfix_ARGS}
+.  endif
 
-BUILD_DEPENDS+=	electron${_ELECTRONFIX_MK_VERSION}:devel/electron${_ELECTRONFIX_MK_VERSION}
-RUN_DEPENDS+=	electron${_ELECTRONFIX_MK_VERSION}:devel/electron${_ELECTRONFIX_MK_VERSION}
+BUILD_DEPENDS+=	electron${electronfix_ARGS}:devel/electron${electronfix_ARGS}
+RUN_DEPENDS+=	electron${electronfix_ARGS}:devel/electron${electronfix_ARGS}
 
 ELECTRONFIX_SYMLINK_FILES?= \
 			chromedriver \
@@ -58,11 +52,11 @@ electronfix-post-install:
 	${RM} ${STAGEDIR}${DATADIR}/libvulkan.so.1
 .  for f in ${ELECTRONFIX_SYMLINK_FILES}
 	${RM} ${STAGEDIR}${DATADIR}/${f}
-	${LN} -s ${LOCALBASE}/share/electron${_ELECTRONFIX_MK_VERSION}/${f} ${STAGEDIR}${DATADIR}/${f}
+	${LN} -s ${LOCALBASE}/share/electron${electronfix_ARGS}/${f} ${STAGEDIR}${DATADIR}/${f}
 .  endfor
 .  ifdef ELECTRONFIX_MAIN_EXECUTABLE
 # We have to copy the electron binary instead of symlinking
-	${CP} ${LOCALBASE}/share/electron${_ELECTRONFIX_MK_VERSION}/electron ${STAGEDIR}${DATADIR}/${ELECTRONFIX_MAIN_EXECUTABLE}
+	${CP} ${LOCALBASE}/share/electron${electronfix_ARGS}/electron ${STAGEDIR}${DATADIR}/${ELECTRONFIX_MAIN_EXECUTABLE}
 .  endif
 
 electronfix-stage-qa: