diff options
| author | Gleb Popov <arrowd@FreeBSD.org> | 2025-10-15 19:25:33 +0300 |
|---|---|---|
| committer | Gleb Popov <arrowd@FreeBSD.org> | 2025-10-20 16:27:48 +0300 |
| commit | eef4d4a98ab1975ba60425ca847851d4cbb762f7 (patch) | |
| tree | 32109d3cf8170ed6e0b68e1433003a250a4d0e24 | |
| parent | net/{,py-}scamper: Update 20250729 => 20251020 (diff) | |
Uses/display.mk: Overhaul the module
- Stop determining the free display port number. The whole block is under the
`!defined(DISPLAY)` condition and at the time `Xvfb` starts the `:0` port
is guaranteed to be available.
- Allow multiple values in the USES args.
- Set *_ENV and *_DEPENDS more granularly.
Approved by: bapt
Differential Revision: https://reviews.freebsd.org/D53122
Fixes: 453ec167a9f355e674cd35406725e0437cef722b
| -rw-r--r-- | Mk/Uses/display.mk | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/Mk/Uses/display.mk b/Mk/Uses/display.mk index e46fb10d1bba..b5471b95a8ce 100644 --- a/Mk/Uses/display.mk +++ b/Mk/Uses/display.mk @@ -1,6 +1,6 @@ # Feature: display # Usage: USES=display or USES=display:ARGS -# Valid ARGS: install (default, implicit), any target +# Valid ARGS: install (default, implicit), configure, build # # Except the target where the DISPLAY is needed # @@ -14,24 +14,39 @@ display_ARGS= install . endif . if !defined(DISPLAY) -BUILD_DEPENDS+= Xvfb:x11-servers/xorg-server@xvfb \ + +. if ${display_ARGS:Mconfigure} +DISPLAY_DEPENDS= BUILD_DEPENDS +CONFIGURE_ENV+= DISPLAY=":${XVFBPORT}" +. elif ${display_ARGS:Mbuild} +DISPLAY_DEPENDS= BUILD_DEPENDS +MAKE_ENV+= DISPLAY=":${XVFBPORT}" +. elif ${display_ARGS:Mtest} +DISPLAY_DEPENDS= TEST_DEPENDS +TEST_ENV+= DISPLAY=":${XVFBPORT}" +.else +IGNORE= USES=display: invalid arguments: ${display_ARGS} +.endif + +${DISPLAY_DEPENDS}+= \ + Xvfb:x11-servers/xorg-server@xvfb \ ${LOCALBASE}/share/fonts/misc/8x13O.pcf.gz:x11-fonts/xorg-fonts-miscbitmaps \ ${LOCALBASE}/share/fonts/misc/fonts.alias:x11-fonts/font-alias \ ${LOCALBASE}/share/X11/xkb/rules/base:x11/xkeyboard-config \ xkbcomp:x11/xkbcomp -XVFBPORT!= port=0; while test -S /tmp/.X11-unix/X$${port} ; do port=$$(( port + 1 )) ; done ; ${ECHO_CMD} $$port -PREV_XVFBPORT!= ${ECHO_CMD} $$(( ${XVFBPORT} - 1)) -XVFBPIDFILE= /tmp/.xvfb-${XVFBPORT}.pid -PREV_XVFBPIDFILE= /tmp/.xvfb-${PREV_XVFBPORT}.pid -MAKE_ENV+= DISPLAY=":${XVFBPORT}" +XVFBPORT?= 0 +XVFBPIDFILE= /tmp/.xvfb-${XVFBPORT}-display-mk.pid -_USES_${display_ARGS}+= 290:start-display 860:stop-display +. for t in ${display_ARGS} +_USES_${t}+= 290:start-display 860:stop-display +. endfor start-display: + pkill -15 -F ${XVFBPIDFILE} || ${TRUE} daemon -p ${XVFBPIDFILE} Xvfb :${XVFBPORT} stop-display: - pkill -15 -F ${PREV_XVFBPIDFILE} + pkill -15 -F ${XVFBPIDFILE} . endif .endif |
