tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: generic fonts makefile fragment



Thanks for the review.

On Wed, Mar 06, 2019 at 12:39:14AM +0100, Roland Illig wrote:
> 
> > +TTF_FONTS_DIR=  ${PREFIX}/share/fonts/X11/TTF
> > +OTF_FONTS_DIR=  ${PREFIX}/share/fonts/X11/OTF
> 
> These two variables form part of the public API of the file, therefore
> they should be documented at the top of the file, in the section called
> "System-provided variables". See mk/fetch/bsd.fetch-vars.mk for a
> copy-and-paste template.

Adjusted, but I think it won't be changed very often, since it won't be
picked up automatically otherwise.

> Did you ever have to deal with font files whose name contains spaces or
> other special characters? It would be good if that infrastructure part
> could handle these files. To catch most of these special characters (or
> even all?), the following patterns may help:
> 
>     find ${WRKSRC} -name '*.ttf' \
>         -exec ${INSTALL_DATA} "{}" ${DESTDIR}${TTF_FONTS_DIR} ";"
>     find ${WRKSRC} -name '*.otf' \
>         -exec ${INSTALL_DATA} "{}" ${DESTDIR}${OTF_FONTS_DIR} ";"
> 

It seems nicer in general. the for loop feels clumsy.

> Did you think about prefixing the installation commands with ${RUN}?
> Most of the infrastructure files do this. In the installation phase
> though, these commands that directly and obviously install files may
> also omit the ${RUN}. Anyway, this should be a concious choice.
>

I think since the package would otherwise omit no messages, it's ok to
be noisy.

I am not sure about a regression test. I am adding it with the intention
of adjusting a few dozen packages to use it immediately.

If nothing is using it, we can remove it :-)


Updated diff,

Index: mk/fonts.mk
===================================================================
RCS file: mk/fonts.mk
diff -N mk/fonts.mk
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ mk/fonts.mk	6 Mar 2019 00:30:09 -0000
@@ -0,0 +1,27 @@
+# $NetBSD$
+#
+# Install .otf and .ttf font files.
+#
+# The following variables may be used to tweak the installation path:
+#
+# TTF_FONTS_DIR is the install directory for .ttf files
+#
+# OTF_FONTS_DIR is the install directory for .otf files
+
+NO_CONFIGURE?=	yes
+NO_BUILD?=	yes
+
+TTF_FONTS_DIR?=		${PREFIX}/share/fonts/X11/TTF
+OTF_FONTS_DIR?=		${PREFIX}/share/fonts/X11/OTF
+
+INSTALLATION_DIRS+=	${TTF_FONTS_DIR} ${OTF_FONTS_DIR}
+
+do-install: install-fonts
+
+install-fonts:
+	${STEP_MSG} "Installing all .otf and .ttf files from " ${WRKSRC}
+	find ${WRKSRC} -name '*.ttf' \
+	    -exec ${INSTALL_DATA} "{}" ${DESTDIR}${TTF_FONTS_DIR} ";"
+	find ${WRKSRC} -name '*.otf' \
+	    -exec ${INSTALL_DATA} "{}" ${DESTDIR}${OTF_FONTS_DIR} ";"
+



Home | Main Index | Thread Index | Old Index