Index | Thread | Search

From:
"Anthony J. Bentley" <bentley@openbsd.org>
Subject:
woff2/woff support in font module
To:
ports@openbsd.org
Date:
Wed, 12 Nov 2025 06:18:04 -0700

Download raw body.

Thread
Hi,

We used to sometimes provide .woff2 and .woff (the common "web font"
formats) in our font packages. But it was effectively pointless--files 
installed to /usr/local/share can't be referenced from httpd.conf, nor
hardlinked or softlinked to /var/www--and bloated the package size, so
we removed them. Still, it wouldn't take much to provide dedicated
subpackages for these that install to a more sensible place and don't
impact the size of the main package.

Here's a diff that allows font ports to declare MODFONT_WEBFILES (just
like they currently declare MODFONT_FONTFILES and MODFONT_DOCFILES) and
have the module do the rest of the work, i.e., install them to
/var/www/fonts. Also included are two examples (openmoji, public-sans)
of what the result looks like: basically, set MULTI_PACKAGES = -main -web
and MODFONT_WEBFILES, rerun 'make plist', and the module does the rest.

'make package' in /usr/ports still succeeds with this diff applied.

ok?


blob - c21c3e11875ed7695d74b84aa1def3b654e223b0
blob + bce4741cd71797dc9ae2edbcedd0c88af53c40d5
--- infrastructure/mk/font.port.mk
+++ infrastructure/mk/font.port.mk
@@ -13,9 +13,11 @@ PKGNAME ?=	${MODFONT_FAMILY}-${MODFONT_VERSION}
 
 MODFONT_FONTDIR ?=	${PREFIX}/share/fonts/${MODFONT_FAMILY}
 MODFONT_DOCDIR ?=	${PREFIX}/share/doc/${MODFONT_FAMILY}
+MODFONT_WEBDIR ?=	${WRKINST}${VARBASE}/www/fonts/${MODFONT_FAMILY}
 
 MODFONT_FONTFILES ?=
 MODFONT_DOCFILES ?=
+MODFONT_WEBFILES ?=
 
 MODFONT_do-install = ${INSTALL_DATA_DIR} ${MODFONT_FONTDIR};
 
@@ -32,6 +34,12 @@ MODFONT_do-install += ; ${INSTALL_DATA_DIR} ${MODFONT_
 MODFONT_do-install += ; for t in ${MODFONT_DOCFILES}; do ${INSTALL_DATA} ${WRKSRC}/$$t ${MODFONT_DOCDIR}; done
 .endif
 
+.if !empty(MODFONT_WEBFILES)
+PREFIX-web ?=	${VARBASE}/www
+MODFONT_do-install += ; ${INSTALL_DATA_DIR} ${MODFONT_WEBDIR}
+MODFONT_do-install += ; for t in ${MODFONT_WEBFILES}; do ${INSTALL_DATA} ${WRKSRC}/$$t ${MODFONT_WEBDIR}; done
+.endif
+
 .  if !target(do-install)
 do-install:
 	${MODFONT_do-install}
blob - 44377d3c5c26622b6d8aea19a9079f87eb946b7d
blob + da26c9a215c65fc831362d43b84298980ae83926
--- fonts/openmoji/Makefile
+++ fonts/openmoji/Makefile
@@ -1,9 +1,12 @@
-COMMENT =		SVG/COLR-based open source emoji fonts
+COMMENT-main =		SVG/COLR-based open source emoji fonts
+COMMENT-web =		SVG/COLR-based open source emoji fonts (web fonts)
 
 MODFONT_FAMILY =	openmoji
 MODFONT_VERSION =	16.0.0
-REVISION =		0
+REVISION-main =		1
 
+MULTI_PACKAGES =	-main -web
+
 DIST_TUPLE =		github hfg-gmuend openmoji ${MODFONT_VERSION} .
 
 CATEGORIES =		fonts
@@ -20,6 +23,8 @@ NO_TEST =		Yes
 
 MODFONT_FONTFILES =	font/OpenMoji-color-colr1_svg/*.ttf \
 			font/OpenMoji-black-glyf/*.ttf
+MODFONT_WEBFILES =	font/OpenMoji-color-colr1_svg/*.woff2 \
+			font/OpenMoji-black-glyf/*.woff2
 
 post-install:
 	${INSTALL_DATA_DIR} ${PREFIX}/share/openmoji
blob - 61f138a85f185d9ace332a0da8d698ba91c2cc5f (mode 644)
blob + /dev/null
--- fonts/openmoji/pkg/DESCR
+++ /dev/null
@@ -1 +0,0 @@
-Open-source emojis for designers, developers and everyone else!
blob - /dev/null
blob + 61f138a85f185d9ace332a0da8d698ba91c2cc5f (mode 644)
--- /dev/null
+++ fonts/openmoji/pkg/DESCR-main
@@ -0,0 +1 @@
+Open-source emojis for designers, developers and everyone else!
blob - /dev/null
blob + 61f138a85f185d9ace332a0da8d698ba91c2cc5f (mode 644)
--- /dev/null
+++ fonts/openmoji/pkg/DESCR-web
@@ -0,0 +1 @@
+Open-source emojis for designers, developers and everyone else!
blob - 674daf6d3938e1ef37d412a39fc7f5bdabf5165c (mode 644)
blob + /dev/null
--- fonts/openmoji/pkg/PLIST
+++ /dev/null
@@ -1,6 +0,0 @@
-share/fonts/
-@fontdir share/fonts/openmoji/
-share/fonts/openmoji/OpenMoji-black-glyf.ttf
-share/fonts/openmoji/OpenMoji-color-colr1_svg.ttf
-share/openmoji/
-share/openmoji/90-openmoji-aliases.conf
blob - /dev/null
blob + 674daf6d3938e1ef37d412a39fc7f5bdabf5165c (mode 644)
--- /dev/null
+++ fonts/openmoji/pkg/PLIST-main
@@ -0,0 +1,6 @@
+share/fonts/
+@fontdir share/fonts/openmoji/
+share/fonts/openmoji/OpenMoji-black-glyf.ttf
+share/fonts/openmoji/OpenMoji-color-colr1_svg.ttf
+share/openmoji/
+share/openmoji/90-openmoji-aliases.conf
blob - /dev/null
blob + 9f464b6f591afedceaed4da166ea1d9a0a2f6963 (mode 644)
--- /dev/null
+++ fonts/openmoji/pkg/PLIST-web
@@ -0,0 +1,4 @@
+fonts/
+fonts/openmoji/
+fonts/openmoji/OpenMoji-black-glyf.woff2
+fonts/openmoji/OpenMoji-color-colr1_svg.woff2
blob - 2032018acb0590f9ebf6753045aa0d403c386f2e
blob + 4b3694763ec7f4789db92172dbaa9ac8f88b7597
--- fonts/public-sans/Makefile
+++ fonts/public-sans/Makefile
@@ -1,10 +1,13 @@
-COMMENT =		strong, neutral, principles-driven typeface
+COMMENT-main =		strong, neutral, principles-driven typeface
+COMMENT-web =		strong, neutral, principles-driven typeface (web fonts)
 
 MODFONT_FAMILY =	public-sans
 MODFONT_VERSION =	2.001
 
-REVISION =		0
+MULTI_PACKAGES =	-main -web
 
+REVISION-main =		1
+
 DISTNAME =		public-sans-v${MODFONT_VERSION}
 
 HOMEPAGE =		https://public-sans.digital.gov/
@@ -18,6 +21,7 @@ MODULES =		font
 
 MODFONT_FONTFILES =	fonts/*/*.ttf \
 			fonts/*/*.otf
+MODFONT_WEBFILES =	fonts/*/*.woff2
 
 NO_BUILD =		Yes
 NO_TEST =		Yes
blob - 649b234615cb3c53ef1199e78494b28021a022db (mode 644)
blob + /dev/null
--- fonts/public-sans/pkg/DESCR
+++ /dev/null
@@ -1,8 +0,0 @@
-Public Sans is a strong, neutral, principles-driven, open-source typeface
-for text or display. Developed by the US government's General Services
-Administration, it is a fork of the SIL Open Licensed face Libre Franklin.
-Public Sans has many similarities with its parent, but differs in its focus
-on longform reading and neutral UI applicability. It takes inspiration from
-geometric sans faces of the 20th century, as well as the original Franklins
-of the 19th, resulting in something of a mongrel face that retains its
-American origin.
blob - /dev/null
blob + 649b234615cb3c53ef1199e78494b28021a022db (mode 644)
--- /dev/null
+++ fonts/public-sans/pkg/DESCR-main
@@ -0,0 +1,8 @@
+Public Sans is a strong, neutral, principles-driven, open-source typeface
+for text or display. Developed by the US government's General Services
+Administration, it is a fork of the SIL Open Licensed face Libre Franklin.
+Public Sans has many similarities with its parent, but differs in its focus
+on longform reading and neutral UI applicability. It takes inspiration from
+geometric sans faces of the 20th century, as well as the original Franklins
+of the 19th, resulting in something of a mongrel face that retains its
+American origin.
blob - 866342d34cfeacb8f30b7a94b4cd84798462d89f (mode 644)
blob + /dev/null
--- fonts/public-sans/pkg/PLIST
+++ /dev/null
@@ -1,40 +0,0 @@
-share/fonts/
-@fontdir share/fonts/public-sans/
-share/fonts/public-sans/PublicSans-Black.otf
-share/fonts/public-sans/PublicSans-Black.ttf
-share/fonts/public-sans/PublicSans-BlackItalic.otf
-share/fonts/public-sans/PublicSans-BlackItalic.ttf
-share/fonts/public-sans/PublicSans-Bold.otf
-share/fonts/public-sans/PublicSans-Bold.ttf
-share/fonts/public-sans/PublicSans-BoldItalic.otf
-share/fonts/public-sans/PublicSans-BoldItalic.ttf
-share/fonts/public-sans/PublicSans-ExtraBold.otf
-share/fonts/public-sans/PublicSans-ExtraBold.ttf
-share/fonts/public-sans/PublicSans-ExtraBoldItalic.otf
-share/fonts/public-sans/PublicSans-ExtraBoldItalic.ttf
-share/fonts/public-sans/PublicSans-ExtraLight.otf
-share/fonts/public-sans/PublicSans-ExtraLight.ttf
-share/fonts/public-sans/PublicSans-ExtraLightItalic.otf
-share/fonts/public-sans/PublicSans-ExtraLightItalic.ttf
-share/fonts/public-sans/PublicSans-Italic.otf
-share/fonts/public-sans/PublicSans-Italic.ttf
-share/fonts/public-sans/PublicSans-Italic[wght].ttf
-share/fonts/public-sans/PublicSans-Light.otf
-share/fonts/public-sans/PublicSans-Light.ttf
-share/fonts/public-sans/PublicSans-LightItalic.otf
-share/fonts/public-sans/PublicSans-LightItalic.ttf
-share/fonts/public-sans/PublicSans-Medium.otf
-share/fonts/public-sans/PublicSans-Medium.ttf
-share/fonts/public-sans/PublicSans-MediumItalic.otf
-share/fonts/public-sans/PublicSans-MediumItalic.ttf
-share/fonts/public-sans/PublicSans-Regular.otf
-share/fonts/public-sans/PublicSans-Regular.ttf
-share/fonts/public-sans/PublicSans-SemiBold.otf
-share/fonts/public-sans/PublicSans-SemiBold.ttf
-share/fonts/public-sans/PublicSans-SemiBoldItalic.otf
-share/fonts/public-sans/PublicSans-SemiBoldItalic.ttf
-share/fonts/public-sans/PublicSans-Thin.otf
-share/fonts/public-sans/PublicSans-Thin.ttf
-share/fonts/public-sans/PublicSans-ThinItalic.otf
-share/fonts/public-sans/PublicSans-ThinItalic.ttf
-share/fonts/public-sans/PublicSans[wght].ttf
blob - /dev/null
blob + 649b234615cb3c53ef1199e78494b28021a022db (mode 644)
--- /dev/null
+++ fonts/public-sans/pkg/DESCR-web
@@ -0,0 +1,8 @@
+Public Sans is a strong, neutral, principles-driven, open-source typeface
+for text or display. Developed by the US government's General Services
+Administration, it is a fork of the SIL Open Licensed face Libre Franklin.
+Public Sans has many similarities with its parent, but differs in its focus
+on longform reading and neutral UI applicability. It takes inspiration from
+geometric sans faces of the 20th century, as well as the original Franklins
+of the 19th, resulting in something of a mongrel face that retains its
+American origin.
blob - /dev/null
blob + 866342d34cfeacb8f30b7a94b4cd84798462d89f (mode 644)
--- /dev/null
+++ fonts/public-sans/pkg/PLIST-main
@@ -0,0 +1,40 @@
+share/fonts/
+@fontdir share/fonts/public-sans/
+share/fonts/public-sans/PublicSans-Black.otf
+share/fonts/public-sans/PublicSans-Black.ttf
+share/fonts/public-sans/PublicSans-BlackItalic.otf
+share/fonts/public-sans/PublicSans-BlackItalic.ttf
+share/fonts/public-sans/PublicSans-Bold.otf
+share/fonts/public-sans/PublicSans-Bold.ttf
+share/fonts/public-sans/PublicSans-BoldItalic.otf
+share/fonts/public-sans/PublicSans-BoldItalic.ttf
+share/fonts/public-sans/PublicSans-ExtraBold.otf
+share/fonts/public-sans/PublicSans-ExtraBold.ttf
+share/fonts/public-sans/PublicSans-ExtraBoldItalic.otf
+share/fonts/public-sans/PublicSans-ExtraBoldItalic.ttf
+share/fonts/public-sans/PublicSans-ExtraLight.otf
+share/fonts/public-sans/PublicSans-ExtraLight.ttf
+share/fonts/public-sans/PublicSans-ExtraLightItalic.otf
+share/fonts/public-sans/PublicSans-ExtraLightItalic.ttf
+share/fonts/public-sans/PublicSans-Italic.otf
+share/fonts/public-sans/PublicSans-Italic.ttf
+share/fonts/public-sans/PublicSans-Italic[wght].ttf
+share/fonts/public-sans/PublicSans-Light.otf
+share/fonts/public-sans/PublicSans-Light.ttf
+share/fonts/public-sans/PublicSans-LightItalic.otf
+share/fonts/public-sans/PublicSans-LightItalic.ttf
+share/fonts/public-sans/PublicSans-Medium.otf
+share/fonts/public-sans/PublicSans-Medium.ttf
+share/fonts/public-sans/PublicSans-MediumItalic.otf
+share/fonts/public-sans/PublicSans-MediumItalic.ttf
+share/fonts/public-sans/PublicSans-Regular.otf
+share/fonts/public-sans/PublicSans-Regular.ttf
+share/fonts/public-sans/PublicSans-SemiBold.otf
+share/fonts/public-sans/PublicSans-SemiBold.ttf
+share/fonts/public-sans/PublicSans-SemiBoldItalic.otf
+share/fonts/public-sans/PublicSans-SemiBoldItalic.ttf
+share/fonts/public-sans/PublicSans-Thin.otf
+share/fonts/public-sans/PublicSans-Thin.ttf
+share/fonts/public-sans/PublicSans-ThinItalic.otf
+share/fonts/public-sans/PublicSans-ThinItalic.ttf
+share/fonts/public-sans/PublicSans[wght].ttf
blob - /dev/null
blob + 8c4b434ee72ce6a35729bb45ac8f0e8abded68a2 (mode 644)
--- /dev/null
+++ fonts/public-sans/pkg/PLIST-web
@@ -0,0 +1,20 @@
+fonts/
+fonts/public-sans/
+fonts/public-sans/PublicSans-Black.woff2
+fonts/public-sans/PublicSans-BlackItalic.woff2
+fonts/public-sans/PublicSans-Bold.woff2
+fonts/public-sans/PublicSans-BoldItalic.woff2
+fonts/public-sans/PublicSans-ExtraBold.woff2
+fonts/public-sans/PublicSans-ExtraBoldItalic.woff2
+fonts/public-sans/PublicSans-ExtraLight.woff2
+fonts/public-sans/PublicSans-ExtraLightItalic.woff2
+fonts/public-sans/PublicSans-Italic.woff2
+fonts/public-sans/PublicSans-Light.woff2
+fonts/public-sans/PublicSans-LightItalic.woff2
+fonts/public-sans/PublicSans-Medium.woff2
+fonts/public-sans/PublicSans-MediumItalic.woff2
+fonts/public-sans/PublicSans-Regular.woff2
+fonts/public-sans/PublicSans-SemiBold.woff2
+fonts/public-sans/PublicSans-SemiBoldItalic.woff2
+fonts/public-sans/PublicSans-Thin.woff2
+fonts/public-sans/PublicSans-ThinItalic.woff2