Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
Re: font module: add MODFONT_DOCFILES
To:
"Anthony J. Bentley" <bentley@openbsd.org>
Cc:
ports@openbsd.org
Date:
Tue, 9 Jul 2024 12:33:27 +0100

Download raw body.

Thread
makes sense, ok

On 2024/07/09 04:22, Anthony J. Bentley wrote:
> Anthony J. Bentley writes:
> > The majority of font ports don't use the font module. One reason why
> > is that in a lot of cases, doing so doesn't make the makefile any
> > simpler.
> >
> > One area where this can be easily improved is with font documentation.
> > It's very common for fonts to come with doc files like readmes, font
> > showcases, and licenses. Several dozen of our font ports install these
> > to /usr/local/share/doc. Since the module doesn't help with this, the
> > ports all define custom do-install or post-install targets.
> >
> > This diff adds the variables MODFONT_DOCDIR (which defaults to
> > ${PREFIX}/share/doc/${MODFONT_FAMILY}) and MODFONT_DOCFILES (a user-
> > specified list of files relative to WRKSRC).
> >
> > This allows ports that use the font module and install docs to replace
> > their custom install targets with a single variable assignment. In this
> > diff I've gone ahead and eliminated most of the post-install targets in
> > ports using the font module. (I didn't start converting non-module fonts
> > yet; that will come after I've made further changes to the module.)
> >
> > ok?
> 
> Ping.
> 
> Index: infrastructure/mk/font.port.mk
> ===================================================================
> RCS file: /cvs/ports/infrastructure/mk/font.port.mk,v
> diff -u -p -r1.7 font.port.mk
> --- infrastructure/mk/font.port.mk	15 Apr 2024 16:08:14 -0000	1.7
> +++ infrastructure/mk/font.port.mk	15 Apr 2024 20:22:23 -0000
> @@ -12,8 +12,10 @@ PKGNAME ?=	${MODFONT_FAMILY}-${MODFONT_V
>  .  endif
>  
>  MODFONT_DIR ?=	${PREFIX}/share/fonts/${MODFONT_FAMILY}
> +MODFONT_DOCDIR ?=	${PREFIX}/share/doc/${MODFONT_FAMILY}
>  
>  MODFONT_TYPES ?=
> +MODFONT_DOCFILES ?=
>  
>  MODFONT_do-install = ${INSTALL_DATA_DIR} ${MODFONT_DIR};
>  
> @@ -23,6 +25,11 @@ MODFONT_do-install = ${INSTALL_DATA_DIR}
>  MODFONT_do-install += for t in otf ttf; do ${INSTALL_DATA} ${WRKSRC}/*.$$t ${MODFONT_DIR} && break; done
>  .else
>  MODFONT_do-install += for t in ${MODFONT_TYPES}; do ${INSTALL_DATA} ${WRKSRC}/*.$$t ${MODFONT_DIR}; done
> +.endif
> +
> +.if !empty(MODFONT_DOCFILES)
> +MODFONT_do-install += ; ${INSTALL_DATA_DIR} ${MODFONT_DOCDIR}
> +MODFONT_do-install += ; for t in ${MODFONT_DOCFILES}; do ${INSTALL_DATA} ${WRKSRC}/$$t ${MODFONT_DOCDIR}; done
>  .endif
>  
>  .  if !target(do-install)
> Index: fonts/abyssinica/Makefile
> ===================================================================
> RCS file: /cvs/ports/fonts/abyssinica/Makefile,v
> diff -u -p -r1.14 Makefile
> --- fonts/abyssinica/Makefile	15 Apr 2024 16:08:15 -0000	1.14
> +++ fonts/abyssinica/Makefile	15 Apr 2024 20:22:23 -0000
> @@ -19,10 +19,6 @@ SITES =			https://software.sil.org/downl
>  NO_BUILD =		Yes
>  NO_TEST =		Yes
>  
> -DOCDIR =		${PREFIX}/share/doc/abyssinica
> -
> -post-install:
> -	${INSTALL_DATA_DIR} ${DOCDIR}
> -	${INSTALL_DATA} ${WRKDIST}/{README.txt,OFL.txt} ${DOCDIR}
> +MODFONT_DOCFILES =	README.txt OFL.txt
>  
>  .include <bsd.port.mk>
> Index: fonts/alkalami/Makefile
> ===================================================================
> RCS file: /cvs/ports/fonts/alkalami/Makefile,v
> diff -u -p -r1.10 Makefile
> --- fonts/alkalami/Makefile	21 Sep 2023 15:28:01 -0000	1.10
> +++ fonts/alkalami/Makefile	15 Apr 2024 20:22:23 -0000
> @@ -1,5 +1,6 @@
>  COMMENT =		Unicode font for African Arabic script
>  V =			2.000
> +MODFONT_FAMILY =	alkalami
>  DISTNAME =		Alkalami-${V}
>  PKGNAME =		alkalami-${V}
>  CATEGORIES =		fonts
> @@ -18,12 +19,7 @@ MODULES =		font
>  NO_BUILD =		Yes
>  NO_TEST =		Yes
>  
> -FONTDIR =		${PREFIX}/share/fonts/alkalami
> -DOCDIR =		${PREFIX}/share/doc/alkalami
> -
> -do-install:
> -	${INSTALL_DATA_DIR} ${FONTDIR} ${DOCDIR}
> -	${INSTALL_DATA} ${WRKDIST}/*.ttf ${FONTDIR}
> -	${INSTALL_DATA} ${WRKDIST}/{FONTLOG.txt,README.txt} ${DOCDIR}
> +MODFONT_TYPES =		ttf
> +MODFONT_DOCFILES =	FONTLOG.txt README.txt
>  
>  .include <bsd.port.mk>
> Index: fonts/andika/Makefile
> ===================================================================
> RCS file: /cvs/ports/fonts/andika/Makefile,v
> diff -u -p -r1.12 Makefile
> --- fonts/andika/Makefile	15 Apr 2024 16:08:15 -0000	1.12
> +++ fonts/andika/Makefile	15 Apr 2024 20:22:23 -0000
> @@ -18,10 +18,6 @@ MODULES +=		font
>  NO_BUILD =		Yes
>  NO_TEST =		Yes
>  
> -DOCDIR =		${PREFIX}/share/doc/andika
> -
> -post-install:
> -	${INSTALL_DATA_DIR} ${DOCDIR}
> -	${INSTALL_DATA} ${WRKDIST}/*.txt ${DOCDIR}
> +MODFONT_DOCFILES =	*.txt
>  
>  .include <bsd.port.mk>
> Index: fonts/atkinson-hyperlegible/Makefile
> ===================================================================
> RCS file: /cvs/ports/fonts/atkinson-hyperlegible/Makefile,v
> diff -u -p -r1.5 Makefile
> --- fonts/atkinson-hyperlegible/Makefile	15 Apr 2024 16:08:15 -0000	1.5
> +++ fonts/atkinson-hyperlegible/Makefile	15 Apr 2024 20:22:24 -0000
> @@ -25,11 +25,10 @@ NO_BUILD =	Yes
>  NO_TEST =	Yes
>  
>  WRKSRC =	${WRKDIST}/Print\ Fonts
> -DOCDIR =	${PREFIX}/share/doc/${MODFONT_FAMILY}
>  
>  post-install:
> -	${INSTALL_DATA_DIR} ${DOCDIR}
> +	${INSTALL_DATA_DIR} ${MODFONT_DOCDIR}
>  	${INSTALL_DATA} ${FULLDISTDIR}/${DISTFILES.doc} \
> -		${DOCDIR}/Atkinson-Hyperlegible-Font-License.pdf
> +		${MODFONT_DOCDIR}/Atkinson-Hyperlegible-Font-License.pdf
>  
>  .include <bsd.port.mk>
> Index: fonts/charis/Makefile
> ===================================================================
> RCS file: /cvs/ports/fonts/charis/Makefile,v
> diff -u -p -r1.11 Makefile
> --- fonts/charis/Makefile	15 Apr 2024 16:08:15 -0000	1.11
> +++ fonts/charis/Makefile	15 Apr 2024 20:22:24 -0000
> @@ -19,10 +19,6 @@ MODULES =		font
>  NO_BUILD =		Yes
>  NO_TEST =		Yes
>  
> -DOCDIR =		${PREFIX}/share/doc/charis
> -
> -post-install:
> -	${INSTALL_DATA_DIR} ${DOCDIR}
> -	${INSTALL_DATA} ${WRKDIST}/*.txt ${DOCDIR}
> +MODFONT_DOCFILES =	*.txt
>  
>  .include <bsd.port.mk>
> Index: fonts/clearsans/Makefile
> ===================================================================
> RCS file: /cvs/ports/fonts/clearsans/Makefile,v
> diff -u -p -r1.7 Makefile
> --- fonts/clearsans/Makefile	15 Apr 2024 16:08:16 -0000	1.7
> +++ fonts/clearsans/Makefile	15 Apr 2024 20:22:24 -0000
> @@ -20,10 +20,7 @@ NO_TEST =		Yes
>  
>  WRKDIST =		${WRKDIR}
>  WRKSRC =		${WRKDIST}/TTF
> -DOCDIR =		${PREFIX}/share/doc/clearsans
>  
> -post-install:
> -	${INSTALL_DATA_DIR} ${DOCDIR}
> -	${INSTALL_DATA} ${WRKDIST}/*.txt ${DOCDIR}
> +MODFONT_DOCFILES =	../*.txt
>  
>  .include <bsd.port.mk>
> Index: fonts/doulos/Makefile
> ===================================================================
> RCS file: /cvs/ports/fonts/doulos/Makefile,v
> diff -u -p -r1.12 Makefile
> --- fonts/doulos/Makefile	15 Apr 2024 16:08:16 -0000	1.12
> +++ fonts/doulos/Makefile	15 Apr 2024 20:22:24 -0000
> @@ -20,10 +20,7 @@ NO_BUILD =		Yes
>  NO_TEST =		Yes
>  
>  WRKDIST =		${WRKDIR}/${DISTNAME}
> -DOCDIR =		${PREFIX}/share/doc/doulos
>  
> -post-install:
> -	${INSTALL_DATA_DIR} ${DOCDIR}
> -	${INSTALL_DATA} ${WRKDIST}/*.txt ${DOCDIR}
> +MODFONT_DOCFILES =	*.txt
>  
>  .include <bsd.port.mk>
> Index: fonts/gentium/Makefile
> ===================================================================
> RCS file: /cvs/ports/fonts/gentium/Makefile,v
> diff -u -p -r1.12 Makefile
> --- fonts/gentium/Makefile	15 Apr 2024 16:08:16 -0000	1.12
> +++ fonts/gentium/Makefile	15 Apr 2024 20:22:24 -0000
> @@ -19,10 +19,7 @@ NO_BUILD =		Yes
>  NO_TEST =		Yes
>  
>  WRKDIST =		${WRKDIR}/${DISTNAME}
> -DOCDIR =		${PREFIX}/share/doc/gentium
>  
> -post-install:
> -	${INSTALL_DATA_DIR} ${DOCDIR}
> -	${INSTALL_DATA} ${WRKDIST}/*.txt ${DOCDIR}
> +MODFONT_DOCFILES =	*.txt
>  
>  .include <bsd.port.mk>
> Index: fonts/ibm-plex/Makefile
> ===================================================================
> RCS file: /cvs/ports/fonts/ibm-plex/Makefile,v
> diff -u -p -r1.20 Makefile
> --- fonts/ibm-plex/Makefile	13 Apr 2024 14:15:44 -0000	1.20
> +++ fonts/ibm-plex/Makefile	15 Apr 2024 20:22:24 -0000
> @@ -1,5 +1,7 @@
>  COMMENT =		IBM's corporate type family
>  
> +MODFONT_FAMILY =	ibm-plex
> +
>  CATEGORIES =		fonts
>  V =			6.4.0
>  PKGNAME =		ibm-plex-$V
> @@ -22,7 +24,6 @@ NO_BUILD =		Yes
>  NO_TEST =		Yes
>  
>  FONTDIR =		${PREFIX}/share/fonts/ibm-plex
> -DOCDIR =		${PREFIX}/share/doc/ibm-plex
>  
>  do-install:
>  	${INSTALL_DATA_DIR} ${FONTDIR}
> @@ -32,9 +33,7 @@ do-install:
>  	# this package use hinted font following Noto fonts.
>  	${INSTALL_DATA} ${WRKDIST}/OpenType/IBM-Plex-Sans-JP/hinted/*.otf ${FONTDIR}
>  	${INSTALL_DATA} ${WRKDIST}/TrueType/IBM-Plex-Sans-JP/hinted/*.ttf ${FONTDIR}
> -
> -post-install:
> -	${INSTALL_DATA_DIR} ${DOCDIR}
> -	${INSTALL_DATA} ${WRKDIST}/OpenType/IBM-Plex-Sans/license.txt ${DOCDIR}
> +	${INSTALL_DATA_DIR} ${MODFONT_DOCDIR}
> +	${INSTALL_DATA} ${WRKDIST}/OpenType/IBM-Plex-Sans/license.txt ${MODFONT_DOCDIR}
>  
>  .include <bsd.port.mk>
> Index: fonts/sunscreen/Makefile
> ===================================================================
> RCS file: /cvs/ports/fonts/sunscreen/Makefile,v
> diff -u -p -r1.6 Makefile
> --- fonts/sunscreen/Makefile	15 Apr 2024 16:08:18 -0000	1.6
> +++ fonts/sunscreen/Makefile	15 Apr 2024 20:22:24 -0000
> @@ -20,10 +20,7 @@ NO_BUILD =		Yes
>  NO_TEST =		Yes
>  
>  WRKDIST =		${WRKDIR}/${DISTNAME}
> -DOCDIR =		${PREFIX}/share/doc/sunscreen
>  
> -post-install:
> -	${INSTALL_DATA_DIR} ${DOCDIR}
> -	${INSTALL_DATA} ${WRKDIST}/*.txt ${DOCDIR}
> +MODFONT_DOCFILES =	*.txt
>  
>  .include <bsd.port.mk>
>