git: aa46aa4ddc21 - main - Mk/Uses/emacs.mk: Add test argument
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 24 Jun 2026 19:54:33 UTC
The branch main has been updated by jrm:
URL: https://cgit.FreeBSD.org/ports/commit/?id=aa46aa4ddc210ce43ec07e0ccdfe2539d49433e8
commit aa46aa4ddc210ce43ec07e0ccdfe2539d49433e8
Author: Joseph Mingrone <jrm@FreeBSD.org>
AuthorDate: 2026-06-23 19:53:03 +0000
Commit: Joseph Mingrone <jrm@FreeBSD.org>
CommitDate: 2026-06-24 18:46:32 +0000
Mk/Uses/emacs.mk: Add test argument
The test argument will set the correct value for TEST_DEPENDS by
respecting the value of EMACS_DEFAULT.
Event: Halifax Hackathon 202606
Reviewed by: ashish
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57784
---
Mk/Uses/emacs.mk | 43 ++++++++++++++++++++++++++++---------------
1 file changed, 28 insertions(+), 15 deletions(-)
diff --git a/Mk/Uses/emacs.mk b/Mk/Uses/emacs.mk
index 4d4a1349cb94..2b395a2ba83b 100644
--- a/Mk/Uses/emacs.mk
+++ b/Mk/Uses/emacs.mk
@@ -2,16 +2,19 @@
#
# Feature: emacs
# Usage: USES=emacs or USES=emacs:args
-# Valid ARGS: build
+# Valid ARGS: build test
#
# build Indicates that Emacs is required at build time.
+# test Indicates that Emacs is required at test time.
#
# If build is omitted from the argument list, Emacs will not be added to
# BUILD_DEPENDS.
+# If test is omitted from the argument list, Emacs will not be added to
+# TEST_DEPENDS.
#
# Variables, which can be set in make.conf:
# DEFAULT_VERSIONS+=emacs= Select the Emacs port and flavor used for
-# USES=emacs:build.
+# USES=emacs:build and USES=emacs:test.
# Valid values: full canna nox wayland
# devel_full devel_nox
# Defaults to nox when not specified.
@@ -25,8 +28,8 @@
# EMACS_LIBDIR: Emacs Library directory without ${PREFIX} (e.g. share/emacs)
# EMACS_SITE_LISPDIR: Emacs site-lisp directory without ${PREFIX} (e.g. share/emacs/site-lisp)
#
-# Note: EMACS_CMD and EMACS_MAJOR_VER are only set if the build argument is
-# supplied.
+# Note: EMACS_CMD and EMACS_MAJOR_VER are only set if one or both of the build
+# or test argument are supplied.
#
# Note: No Emacs runtime dependency is declared here. USES=emacs ports now
# install only .el source files, avoiding the combinatorial explosion of
@@ -41,30 +44,40 @@ _INCLUDE_USES_EMACS_MK= yes
# Make sure that no dependency or some other environment variable
# pollutes the build/run dependency detection
-.undef _EMACS_BUILD_DEP
+.undef _EMACS_BUILD_DEP _EMACS_TEST_DEP
_EMACS_ARGS= ${emacs_ARGS:S/,/ /g}
. if ${_EMACS_ARGS:Mbuild}
_EMACS_BUILD_DEP= yes
_EMACS_ARGS:= ${_EMACS_ARGS:Nbuild}
. endif
+. if ${_EMACS_ARGS:Mtest}
+_EMACS_TEST_DEP= yes
+_EMACS_ARGS:= ${_EMACS_ARGS:Ntest}
+. endif
EMACS_LIBDIR= share/emacs
EMACS_SITE_LISPDIR= ${EMACS_LIBDIR}/site-lisp
-. if defined(_EMACS_BUILD_DEP)
+. if defined(_EMACS_BUILD_DEP) || defined(_EMACS_TEST_DEP)
. if defined(EMACS_DEFAULT) && ${EMACS_DEFAULT:Mdevel*}
-EMACS_VER= 32.0.50
-EMACS_PORTDIR= editors/emacs-devel
-EMACS_BUILD_FLAVOR= ${EMACS_DEFAULT:C/devel_//}
+_EMACS_VER= 32.0.50
+_EMACS_PORTDIR= editors/emacs-devel
+_EMACS_FLAVOR= ${EMACS_DEFAULT:C/devel_//}
. else
-EMACS_VER= 30.2
-EMACS_PORTDIR= editors/emacs
-EMACS_BUILD_FLAVOR= ${EMACS_DEFAULT:Unox}
+_EMACS_VER= 30.2
+_EMACS_PORTDIR= editors/emacs
+_EMACS_FLAVOR= ${EMACS_DEFAULT:Unox}
. endif
-EMACS_CMD= ${PREFIX}/bin/emacs-${EMACS_VER}
-EMACS_MAJOR_VER= ${EMACS_VER:C/\..*//}
+EMACS_CMD= ${PREFIX}/bin/emacs-${_EMACS_VER}
+EMACS_MAJOR_VER= ${_EMACS_VER:C/\..*//}
+. endif
+
+. if defined(_EMACS_BUILD_DEP)
MAKE_ARGS+= EMACS=${EMACS_CMD}
-BUILD_DEPENDS+= ${EMACS_CMD}:${EMACS_PORTDIR}@${EMACS_BUILD_FLAVOR}
+BUILD_DEPENDS+= ${EMACS_CMD}:${_EMACS_PORTDIR}@${_EMACS_FLAVOR}
+. endif
+. if defined(_EMACS_TEST_DEP)
+TEST_DEPENDS+= ${EMACS_CMD}:${_EMACS_PORTDIR}@${_EMACS_FLAVOR}
. endif
SCRIPTS_ENV+= EMACS_LIBDIR=${EMACS_LIBDIR} \