aboutsummaryrefslogtreecommitdiff
path: root/Keywords
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2022-03-18 13:36:57 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2022-03-22 12:29:52 +0000
commit306567bc74fbdfb30c62479083b933835f314c8f (patch)
tree6f5b8c9a61a54524ad5661e2cd17bfd0481a8daf /Keywords
parent52598b84ea0eb90860dcf06d781883cd8fe187fe (diff)
downloadports-306567bc74fbdfb30c62479083b933835f314c8f.tar.gz
ports-306567bc74fbdfb30c62479083b933835f314c8f.zip
x11-fonts/fontconfig: Use triggers to rebuild fc-cache
Stop forcing the overwrite of the cache at each run it is not necessary most of the time. Reviewed by: tcberner Differencial Revision: https://reviews.freebsd.org/D34602 While here rework USES=fonts to drop @fcfontsdir which is not nessary anymore and convert the @fontsdir into lua which make it way simpler to read
Diffstat (limited to 'Keywords')
-rw-r--r--Keywords/fcfontsdir.ucl27
-rw-r--r--Keywords/fontsdir.ucl34
2 files changed, 14 insertions, 47 deletions
diff --git a/Keywords/fcfontsdir.ucl b/Keywords/fcfontsdir.ucl
deleted file mode 100644
index 81f9d4e716ab..000000000000
--- a/Keywords/fcfontsdir.ucl
+++ /dev/null
@@ -1,27 +0,0 @@
-# MAINTAINER: x11@FreeBSD.org
-
-actions: [dir]
-post-install: <<EOD
- case "%@" in
- /*) fontsdir="%@" ;;
- *) fontsdir="%D/%@" ;;
- esac
- fc-cache -fs ${fontsdir} 2>/dev/null || true
- mkfontscale ${fontsdir} 2>/dev/null || true
- mkfontdir ${fontsdir} 2>/dev/null || true
-EOD
-post-deinstall: <<EOD
- case "%@" in
- /*) fontsdir="%@" ;;
- *) fontsdir="%D/%@" ;;
- esac
- fc-cache -fs ${fontsdir} 2>/dev/null || true
- 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
diff --git a/Keywords/fontsdir.ucl b/Keywords/fontsdir.ucl
index 09c31572bf50..8c0701223e53 100644
--- a/Keywords/fontsdir.ucl
+++ b/Keywords/fontsdir.ucl
@@ -1,25 +1,19 @@
# 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
+post-install-lua: <<EOD
+ fontdir = pkg.prefixed_path("%@")
+ pkg.exec({"mkfontscale", fontdir})
+ pkg.exec({"mkfontdir", fontdir})
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
+post-deinstall-lua: <<EOD
+ fontdir = pkg.prefixed_path("%@")
+ pkg.exec({"mkfontscale", fontdir})
+ pkg.exec({"mkfontdir", fontdir})
+ for _, v in pairs {"/fonts.scale", "/fonts.dir" } do
+ local st = pkg.stat(fontdir .. v)
+ if st and st.type == "reg" and st.size == 2 then
+ os.remove(fontdir .. v)
+ end
+ end
EOD