Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Sep 2015 23:30:22 +0000 (UTC)
From:      Hiroki Sato <hrs@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r396872 - in head: Keywords Mk/Uses
Message-ID:  <201509132330.t8DNUMEd025676@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hrs
Date: Sun Sep 13 23:30:21 2015
New Revision: 396872
URL: https://svnweb.freebsd.org/changeset/ports/396872

Log:
  Add "fc", "fcfontsdir", "fontsdir", and "none" arguments to USES=fonts.
  They controls whether fc-cache and/or mkfontdir run in
  post-{,de}install targets.
  
  japanese/font-* use manually generates fonts.dir entries to utilize
  special modifiers which are useful for CJK fonts.  Because mkfontdir
  does not understand and silently remove them from fonts.dir,
  options like fonts:fc or fonts:none is required.
  
  Approved by:	portmgr (bapt)

Added:
  head/Keywords/fc.ucl   (contents, props changed)
  head/Keywords/fontsdir.ucl   (contents, props changed)
Modified:
  head/Mk/Uses/fonts.mk

Added: head/Keywords/fc.ucl
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/Keywords/fc.ucl	Sun Sep 13 23:30:21 2015	(r396872)
@@ -0,0 +1,19 @@
+# $FreeBSD$
+#
+# MAINTAINER: x11@FreeBSD.org
+
+actions: [dir]
+post-install: <<EOD
+  case "%@" in
+  /*) fontsdir="%@" ;;
+  *) fontsdir="%D/%@" ;;
+  esac
+  fc-cache -fs ${fontsdir} 2>/dev/null || true
+EOD
+post-deinstall: <<EOD
+  case "%@" in
+  /*) fontsdir="%@" ;;
+  *) fontsdir="%D/%@" ;;
+  esac
+  fc-cache -fs ${fontsdir} 2>/dev/null || true
+EOD

Added: head/Keywords/fontsdir.ucl
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/Keywords/fontsdir.ucl	Sun Sep 13 23:30:21 2015	(r396872)
@@ -0,0 +1,27 @@
+# $FreeBSD$
+#
+# MAINTAINER: x11@FreeBSD.org
+
+actions: [dir]
+post-install: <<EOD
+  case "%@" in
+  /*) fontsdir="%@" ;;
+  *) fontsdir="%D/%@" ;;
+  esac
+  mkfontscale ${fontsdir} 2>/dev/null || true
+  mkfontdir ${fontsdir} 2>/dev/null || true
+EOD
+post-deinstall: <<EOD
+  case "%@" in
+  /*) fontsdir="%@" ;;
+  *) fontsdir="%D/%@" ;;
+  esac
+  mkfontscale ${fontsdir} 2>/dev/null || true
+  if [ -e ${fontsdir}/fonts.scale -a "`stat -f '%%z' ${fontsdir}/fonts.scale 2>/dev/null`" = '2' ]; then
+    rm ${fontsdir}/fonts.scale
+  fi
+  mkfontdir ${fontsdir} 2>/dev/null || true
+  if [ -e ${fontsdir}/fonts.dir -a "`stat -f '%%z' ${fontsdir}/fonts.dir 2>/dev/null`" = '2' ]; then
+    rm ${fontsdir}/fonts.dir
+  fi
+EOD

Modified: head/Mk/Uses/fonts.mk
==============================================================================
--- head/Mk/Uses/fonts.mk	Sun Sep 13 22:16:09 2015	(r396871)
+++ head/Mk/Uses/fonts.mk	Sun Sep 13 23:30:21 2015	(r396872)
@@ -3,21 +3,37 @@
 # handle fonts
 # Feature:	fonts
 # Usage:	USES=fonts
+# Valid ARGS:	fc, fontsdir, fcfontsdir, none (empty means fcfontsdir)
+
+#  fc		Add @fc ${FONTSDIR} to PLIST_FILES
+#  fontsdir	Add @fontsdir ${FONTSDIR} to PLIST_FILES
+#  fcfontsdir	Add @fcfontsdir ${FONTSDIR} to PLIST_FILES
+#  none		No special handling of ${FONTSDIR} in PLIST_FILES
 
 .if !defined(_INCLUDE_USES_FONTS_MK)
 _INCLUDE_USES_FONTS_MK=	yes
 
-.if !empty(fonts_ARGS)
-IGNORE=	USES=fonts - expecting no arguments
+.if empty(fonts_ARGS)
+fonts_ARGS=	fcfontsdir
+.endif
+
+.if !empty(fonts_ARGS:Nfc:Nfontsdir:Nfcfontsdir:Nnone)
+IGNORE=	USES=fonts - invalid ARGS (${fonts_ARGS)
 .endif
 
-RUN_DEPENDS+=	fc-cache:${PORTSDIR}/x11-fonts/fontconfig \
-		mkfontdir:${PORTSDIR}/x11-fonts/mkfontdir \
+.if !empty(fonts_ARGS:Mfc) || !empty(fonts_ARGS:Mfcfontsdir)
+RUN_DEPENDS+=	fc-cache:${PORTSDIR}/x11-fonts/fontconfig
+.endif
+.if !empty(fonts_ARGS:Mfontsdir) || !empty(fonts_ARGS:Mfcfontsdir)
+RUN_DEPENDS+=	mkfontdir:${PORTSDIR}/x11-fonts/mkfontdir \
 		mkfontscale:${PORTSDIR}/x11-fonts/mkfontscale
+.endif
 
 FONTNAME?=	${PORTNAME}
 FONTSDIR?=	${PREFIX}/share/fonts/${FONTNAME}
-PLIST_FILES+=	"@fcfontsdir ${FONTSDIR}"
+.if !empty(fonts_ARGS:Nnone)
+PLIST_FILES+=	"@${fonts_ARGS} ${FONTSDIR}"
+.endif
 SUB_LIST+=	FONTSDIR="${FONTSDIR}"
 PLIST_SUB+=	FONTSDIR="${FONTSDIR}"
 .endif



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509132330.t8DNUMEd025676>