aboutsummaryrefslogtreecommitdiff
path: root/Mk/Uses/display.mk
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2013-06-14 12:47:19 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2013-06-14 12:47:19 +0000
commite290dec1caa56584083a04765d8702107c7f0948 (patch)
treebf212593157006a670a5741b54859c4570fa4533 /Mk/Uses/display.mk
parent662f2e724dbbc16b8259907d8b6bf760088c31eb (diff)
downloadports-e290dec1caa56584083a04765d8702107c7f0948.tar.gz
ports-e290dec1caa56584083a04765d8702107c7f0948.zip
Notes
Diffstat (limited to 'Mk/Uses/display.mk')
-rw-r--r--Mk/Uses/display.mk42
1 files changed, 42 insertions, 0 deletions
diff --git a/Mk/Uses/display.mk b/Mk/Uses/display.mk
new file mode 100644
index 000000000000..d6f531b3fbad
--- /dev/null
+++ b/Mk/Uses/display.mk
@@ -0,0 +1,42 @@
+# $FreeBSD$
+#
+# MAINTAINER: x11@FreeBSD.org
+#
+# Feature: display
+# Usage: USES=display or USES=display:ARGS
+# Valid ARGS: install (default, implicit), build
+#
+# Except the target where the DISPLAY is needed
+#
+
+.if !defined(_INCLUDE_USES_DISPLAY_MK)
+_INCLUDE_USES_DISPLAY_MK= yes
+
+display_ARGS?= install
+.if ${display_ARGS} != build && ${display_ARGS} != install
+IGNORE= USES=display can only take 'build', 'install' and none
+.endif
+
+.if !defined(DISPLAY)
+BUILD_DEPENDS+= Xvfb:${PORTSDIR}/x11-servers/xorg-vfbserver \
+ ${LOCALBASE}/lib/X11/fonts/misc/8x13O.pcf.gz:${X_FONTS_MISC_PORT} \
+ ${LOCALBASE}/lib/X11/fonts/misc/fonts.alias:${X_FONTS_ALIAS_PORT} \
+ ${LOCALBASE}/share/X11/xkb/rules/base:${PORTSDIR}/x11/xkeyboard-config \
+ xkbcomp:${PORTSDIR}/x11/xkbcomp
+
+XVFBPORT!= port=0; while test -S /tmp/.X11-unix/X$${port} ; do port=$$(( port + 1 )) ; done ; ${ECHO_CMD} $$port
+XVFBPIDFILE= /tmp/.xvfb-${XVFBPORT}.pid
+MAKE_ENV+= DISPLAY=":${XVFBPORT}"
+
+pre-${display_ARGS}: start-display
+
+post-${display_ARGS}: stop-display
+
+start-display:
+ daemon -p ${XVFBPIDFILE} Xvfb :${XVFBPORT}
+
+stop-display:
+ pkill -15 ${XVFBPIDFILE}
+
+.endif
+.endif