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
This commit is contained in:
parent
52598b84ea
commit
306567bc74
@ -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
|
|
@ -1,25 +1,19 @@
|
|||||||
# MAINTAINER: x11@FreeBSD.org
|
# MAINTAINER: x11@FreeBSD.org
|
||||||
|
|
||||||
actions: [dir]
|
actions: [dir]
|
||||||
post-install: <<EOD
|
post-install-lua: <<EOD
|
||||||
case "%@" in
|
fontdir = pkg.prefixed_path("%@")
|
||||||
/*) fontsdir="%@" ;;
|
pkg.exec({"mkfontscale", fontdir})
|
||||||
*) fontsdir="%D/%@" ;;
|
pkg.exec({"mkfontdir", fontdir})
|
||||||
esac
|
|
||||||
mkfontscale ${fontsdir} 2>/dev/null || true
|
|
||||||
mkfontdir ${fontsdir} 2>/dev/null || true
|
|
||||||
EOD
|
EOD
|
||||||
post-deinstall: <<EOD
|
post-deinstall-lua: <<EOD
|
||||||
case "%@" in
|
fontdir = pkg.prefixed_path("%@")
|
||||||
/*) fontsdir="%@" ;;
|
pkg.exec({"mkfontscale", fontdir})
|
||||||
*) fontsdir="%D/%@" ;;
|
pkg.exec({"mkfontdir", fontdir})
|
||||||
esac
|
for _, v in pairs {"/fonts.scale", "/fonts.dir" } do
|
||||||
mkfontscale ${fontsdir} 2>/dev/null || true
|
local st = pkg.stat(fontdir .. v)
|
||||||
if [ -e ${fontsdir}/fonts.scale -a "`stat -f '%%z' ${fontsdir}/fonts.scale 2>/dev/null`" = '2' ]; then
|
if st and st.type == "reg" and st.size == 2 then
|
||||||
rm ${fontsdir}/fonts.scale
|
os.remove(fontdir .. v)
|
||||||
fi
|
end
|
||||||
mkfontdir ${fontsdir} 2>/dev/null || true
|
end
|
||||||
if [ -e ${fontsdir}/fonts.dir -a "`stat -f '%%z' ${fontsdir}/fonts.dir 2>/dev/null`" = '2' ]; then
|
|
||||||
rm ${fontsdir}/fonts.dir
|
|
||||||
fi
|
|
||||||
EOD
|
EOD
|
||||||
|
@ -41,23 +41,23 @@
|
|||||||
_INCLUDE_USES_FONTS_MK= yes
|
_INCLUDE_USES_FONTS_MK= yes
|
||||||
|
|
||||||
.if empty(fonts_ARGS)
|
.if empty(fonts_ARGS)
|
||||||
fonts_ARGS= fcfontsdir
|
fonts_ARGS= fontsdir
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if !empty(fonts_ARGS:Nfc:Nfontsdir:Nfcfontsdir:Nnone)
|
.if !empty(fonts_ARGS:Nfc:Nfontsdir:Nnone)
|
||||||
IGNORE= USES=fonts - invalid ARGS (${fonts_ARGS})
|
IGNORE= USES=fonts - invalid ARGS (${fonts_ARGS})
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if !empty(fonts_ARGS:Mfc) || !empty(fonts_ARGS:Mfcfontsdir)
|
.if !empty(fonts_ARGS:Mfc) || !empty(fonts_ARGS:Mfontsdir)
|
||||||
RUN_DEPENDS+= fc-cache:x11-fonts/fontconfig
|
RUN_DEPENDS+= fc-cache:x11-fonts/fontconfig
|
||||||
.endif
|
.endif
|
||||||
.if !empty(fonts_ARGS:Mfontsdir) || !empty(fonts_ARGS:Mfcfontsdir)
|
.if !empty(fonts_ARGS:Mfontsdir)
|
||||||
RUN_DEPENDS+= mkfontscale:x11-fonts/mkfontscale
|
RUN_DEPENDS+= mkfontscale:x11-fonts/mkfontscale
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
FONTNAME?= ${PORTNAME}
|
FONTNAME?= ${PORTNAME}
|
||||||
FONTSDIR?= ${PREFIX}/share/fonts/${FONTNAME}
|
FONTSDIR?= ${PREFIX}/share/fonts/${FONTNAME}
|
||||||
.if !empty(fonts_ARGS:Nnone)
|
.if !empty(fonts_ARGS:Mfontsdir)
|
||||||
PLIST_FILES+= "@${fonts_ARGS} ${FONTSDIR}"
|
PLIST_FILES+= "@${fonts_ARGS} ${FONTSDIR}"
|
||||||
.endif
|
.endif
|
||||||
.if defined(FONTPATHSPEC) && !empty(FONTPATHSPEC)
|
.if defined(FONTPATHSPEC) && !empty(FONTPATHSPEC)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
@fcfontsdir share/fonts/OTF
|
@fontsdir share/fonts/OTF
|
||||||
share/fonts/OTF/GohaTibebZemen.otf
|
share/fonts/OTF/GohaTibebZemen.otf
|
||||||
share/fonts/TTF/GohaTibebZemen.ttf
|
share/fonts/TTF/GohaTibebZemen.ttf
|
||||||
@comment share/fonts/OTF/fonts.dir
|
@comment share/fonts/OTF/fonts.dir
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
PORTNAME= fontconfig
|
PORTNAME= fontconfig
|
||||||
DISTVERSION= 2.13.94
|
DISTVERSION= 2.13.94
|
||||||
PORTREVISION= 1
|
PORTREVISION= 2
|
||||||
PORTEPOCH= 1
|
PORTEPOCH= 1
|
||||||
CATEGORIES= x11-fonts
|
CATEGORIES= x11-fonts
|
||||||
MASTER_SITES= https://www.freedesktop.org/software/fontconfig/release/
|
MASTER_SITES= https://www.freedesktop.org/software/fontconfig/release/
|
||||||
@ -16,7 +16,8 @@ LICENSE_FILE= ${WRKSRC}/COPYING
|
|||||||
LIB_DEPENDS= libfreetype.so:print/freetype2 \
|
LIB_DEPENDS= libfreetype.so:print/freetype2 \
|
||||||
libexpat.so:textproc/expat2
|
libexpat.so:textproc/expat2
|
||||||
|
|
||||||
USES= cpe gperf meson pkgconfig python:3.6+,build shebangfix tar:xz
|
USES= cpe gperf meson pkgconfig python:3.6+,build shebangfix tar:xz \
|
||||||
|
trigger
|
||||||
CPE_VENDOR= fontconfig_project
|
CPE_VENDOR= fontconfig_project
|
||||||
USE_LDCONFIG= yes
|
USE_LDCONFIG= yes
|
||||||
|
|
||||||
@ -26,8 +27,6 @@ SHEBANG_FILES= conf.d/link_confs.py \
|
|||||||
fc-lang/fc-lang.py
|
fc-lang/fc-lang.py
|
||||||
|
|
||||||
TEST_TARGET= test
|
TEST_TARGET= test
|
||||||
SUB_FILES= pkg-install
|
|
||||||
SUB_LIST= PREFIX=${PREFIX}
|
|
||||||
|
|
||||||
# Custom configuration variables
|
# Custom configuration variables
|
||||||
FCDEFAULTFONTS= ${PREFIX}/share/fonts
|
FCDEFAULTFONTS= ${PREFIX}/share/fonts
|
||||||
|
9
x11-fonts/fontconfig/files/fontconfig.ucl.in
Normal file
9
x11-fonts/fontconfig/files/fontconfig.ucl.in
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
path: [ "%%PREFIX%%/share/fonts", %%PREFIX%%/etc/fonts/conf.d ]
|
||||||
|
trigger: {
|
||||||
|
type: lua
|
||||||
|
sandbox: false
|
||||||
|
script: <<EOS
|
||||||
|
print("Running fc-cache to build fontconfig cache...")
|
||||||
|
pkg.exec({"%%PREFIX%%/bin/fc-cache", "-s" })
|
||||||
|
EOS
|
||||||
|
}
|
@ -1,10 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:%%PREFIX%%/bin
|
|
||||||
export PATH
|
|
||||||
|
|
||||||
if [ "$2" = "POST-INSTALL" ]; then
|
|
||||||
echo "Running fc-cache to build fontconfig cache..."
|
|
||||||
fc-cache -f -s -v
|
|
||||||
exit 0
|
|
||||||
fi
|
|
Loading…
Reference in New Issue
Block a user