Sunday, May 29, 2022

Re: [patch] Add font module in fonts/a* and fonts/b*

From b468aecbe6b0179207cec0fdca11da8d91c2bdc7 Mon Sep 17 00:00:00 2001
From: Juan Picca <juan.picca@jumapico.uy>
Date: Sun, 29 May 2022 00:39:25 -0300
Subject: [PATCH 01/10] font.port.mk: add rule to install doc files

---
infrastructure/mk/font.port.mk | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/infrastructure/mk/font.port.mk b/infrastructure/mk/font.port.mk
index 95d4be75f33..5b20bea9d2f 100644
--- a/infrastructure/mk/font.port.mk
+++ b/infrastructure/mk/font.port.mk
@@ -14,6 +14,7 @@ PKGNAME ?= ${TYPEFACE}-${VERSION}
. endif

FONTDIR ?= ${PREFIX}/share/fonts/${TYPEFACE}
+FONT_DOCDIR ?= ${PREFIX}/share/doc/${TYPEFACE}

FONTTYPES ?= ttf

@@ -25,5 +26,9 @@ MODFONT_do-install = ${INSTALL_DATA_DIR} ${FONTDIR}; \
. if !target(do-install)
do-install:
${MODFONT_do-install}
+. if defined(FONT_DOCFILES)
+ ${INSTALL_DATA_DIR} ${FONT_DOCDIR}; \
+ for f in ${FONT_DOCFILES}; do ${INSTALL_DATA} ${FONT_DISTDIR}/$$f ${FONT_DOCDIR}; done
+. endif
. endif
.endif
--
2.36.1

From 6e3bf90333f9600989c2f27e2738525a7465d398 Mon Sep 17 00:00:00 2001
From: Juan Picca <juan.picca@jumapico.uy>
Date: Sun, 29 May 2022 00:38:50 -0300
Subject: [PATCH 02/10] fonts/abyssinica: add FONT_DOCFILES

---
fonts/abyssinica/Makefile | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fonts/abyssinica/Makefile b/fonts/abyssinica/Makefile
index 22a8de17c1a..ce9ebf9fe1a 100644
--- a/fonts/abyssinica/Makefile
+++ b/fonts/abyssinica/Makefile
@@ -19,10 +19,6 @@ MASTER_SITES = https://software.sil.org/downloads/r/abyssinica/
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}
+FONT_DOCFILES = README.txt OFL.txt

.include <bsd.port.mk>
--
2.36.1

From 8fdef0958e2f82d5413c5d6c30662695262903c1 Mon Sep 17 00:00:00 2001
From: Juan Picca <juan.picca@jumapico.uy>
Date: Sat, 28 May 2022 23:30:01 -0300
Subject: [PATCH 03/10] fonts/alkalami: use FONT_DOCFILES

Replace the rule do-install with FONT_DOCFILES.
---
fonts/alkalami/Makefile | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/fonts/alkalami/Makefile b/fonts/alkalami/Makefile
index f6f143c5942..3463e979a3f 100644
--- a/fonts/alkalami/Makefile
+++ b/fonts/alkalami/Makefile
@@ -1,7 +1,8 @@
COMMENT = Unicode font for African Arabic script
+
+TYPEFACE = alkalami
V = 1.200
DISTNAME = Alkalami-${V}
-PKGNAME = alkalami-${V}
CATEGORIES = fonts

HOMEPAGE = https://software.sil.org/alkalami/
@@ -18,12 +19,6 @@ 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}
+FONT_DOCFILES = FONTLOG.txt README.txt

.include <bsd.port.mk>
--
2.36.1

From ffb05ff2e0c26c08ee32d5b496643ae1228dca0f Mon Sep 17 00:00:00 2001
From: Juan Picca <juan.picca@jumapico.uy>
Date: Sun, 29 May 2022 00:46:19 -0300
Subject: [PATCH 04/10] fonts/andika: use FONT_DOCFILES

---
fonts/andika/Makefile | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/fonts/andika/Makefile b/fonts/andika/Makefile
index 29ac4c73346..eb95a58e29b 100644
--- a/fonts/andika/Makefile
+++ b/fonts/andika/Makefile
@@ -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}
+FONT_DOCFILES = *.txt

.include <bsd.port.mk>
--
2.36.1

From edd45807d48dc50bb30440464d0473b4bdce2efc Mon Sep 17 00:00:00 2001
From: Juan Picca <juan.picca@jumapico.uy>
Date: Sun, 29 May 2022 00:00:05 -0300
Subject: [PATCH 05/10] fonts/annapurna: use font module

---
fonts/annapurna/Makefile | 15 ++++-----------
1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/fonts/annapurna/Makefile b/fonts/annapurna/Makefile
index a710c1d0f86..fed4084203e 100644
--- a/fonts/annapurna/Makefile
+++ b/fonts/annapurna/Makefile
@@ -1,34 +1,27 @@
COMMENT = Unicode-based font for Devanagari script

+TYPEFACE = annapurna
V = 1.204
DISTNAME = AnnapurnaSIL-$V
-PKGNAME = annapurna-$V
REVISION = 1
-
CATEGORIES = fonts

HOMEPAGE = https://software.sil.org/annapurna/
-
MAINTAINER = George Rosamond <george@nycbug.org>

# SIL OFL 1.1
PERMIT_PACKAGE = Yes

MASTER_SITES = https://software.sil.org/downloads/r/annapurna/
-
EXTRACT_SUFX = .zip

+MODULES = font
+
NO_BUILD = Yes
NO_TEST = Yes

PKG_ARCH = *

-FONTDIR = ${PREFIX}/share/fonts/annapurna
-DOCDIR = ${PREFIX}/share/doc/annapurna
-
-do-install:
- ${INSTALL_DATA_DIR} ${FONTDIR} ${DOCDIR} ${WEBFONTDIR}
- ${INSTALL_DATA} ${WRKDIST}/*.ttf ${FONTDIR}
- ${INSTALL_DATA} ${WRKDIST}/{*.txt,documentation/*.txt} ${DOCDIR}
+FONT_DOCFILES = *.txt documentation/*.txt

.include <bsd.port.mk>
--
2.36.1

From f7c4fd2e65ad4b63606f53a4171c0c2611c87bb0 Mon Sep 17 00:00:00 2001
From: Juan Picca <juan.picca@jumapico.uy>
Date: Sun, 29 May 2022 00:56:29 -0300
Subject: [PATCH 06/10] fonts/anonymous-pro: add module font

Replace hardcoded strings by variables generated for the typeface in the
font module.
---
fonts/anonymous-pro/Makefile | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/fonts/anonymous-pro/Makefile b/fonts/anonymous-pro/Makefile
index 042c260634b..d18682d2323 100644
--- a/fonts/anonymous-pro/Makefile
+++ b/fonts/anonymous-pro/Makefile
@@ -1,28 +1,30 @@
COMMENT = fixed width sans font designed especially for coders
-PKG_ARCH = *
-VERSION = 1.002
-PKGNAME = anonymous-pro-${VERSION}
-DISTNAME = AnonymousPro-${VERSION}
+
+TYPEFACE = anonymous-pro
+V = 1.002
+DISTNAME = AnonymousPro-${V}
REVISION = 4
-EXTRACT_SUFX = .zip
CATEGORIES = fonts x11
+PKG_ARCH = *

-MASTER_SITES = https://www.marksimonson.com/assets/content/fonts/
HOMEPAGE = https://www.marksimonson.com/fonts/view/anonymous-pro

+MASTER_SITES = https://www.marksimonson.com/assets/content/fonts/
+EXTRACT_SUFX = .zip
+
# SIL OFL 1.1
PERMIT_PACKAGE = Yes

NO_BUILD = Yes
NO_TEST = Yes
-FONTSDIR = ${PREFIX}/share/fonts/anonymous-pro

+MODULES = font
WRKDIST = ${WRKDIR}/${DISTNAME}.001

do-install:
- ${INSTALL_DATA_DIR} ${PREFIX}/share/doc/anonymous-pro
- ${INSTALL_DATA_DIR} ${FONTSDIR}
- cd ${WRKDIST} ; /bin/pax -rw '-s/ //g' *.ttf ${FONTSDIR}
- ${INSTALL_DATA} ${WRKDIST}/*.txt ${PREFIX}/share/doc/anonymous-pro
+ ${INSTALL_DATA_DIR} ${FONT_DOCDIR}
+ ${INSTALL_DATA_DIR} ${FONTDIR}
+ cd ${WRKDIST} ; /bin/pax -rw '-s/ //g' *.ttf ${FONTDIR}
+ ${INSTALL_DATA} ${WRKDIST}/*.txt ${FONT_DOCDIR}

.include <bsd.port.mk>
--
2.36.1

From d5f2acb40c7cc567a24a03999009e9399dd59ed1 Mon Sep 17 00:00:00 2001
From: Juan Picca <juan.picca@jumapico.uy>
Date: Sun, 29 May 2022 01:03:01 -0300
Subject: [PATCH 07/10] fonts/apl-fonts: use font module

---
fonts/apl-fonts/Makefile | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/fonts/apl-fonts/Makefile b/fonts/apl-fonts/Makefile
index d6e2ac8a668..c69be7c0260 100644
--- a/fonts/apl-fonts/Makefile
+++ b/fonts/apl-fonts/Makefile
@@ -1,5 +1,8 @@
-V = 1.0
COMMENT = Adrian Smith's standard APL fonts
+
+TYPEFACE = apl
+V = 1.0
+
PKGNAME = apl-fonts-${V}
DISTFILES = apl385-${V}{apl385}${EXTRACT_SUFX} \
apl333-${V}{apl333}${EXTRACT_SUFX}
@@ -18,11 +21,9 @@ NO_BUILD = Yes
NO_TEST = Yes
PKG_ARCH = *

-FONTSDIR = ${PREFIX}/share/fonts/apl
+MODULES = font

-do-install:
- ${INSTALL_DATA_DIR} ${FONTSDIR}
- ${INSTALL_DATA} ${WRKSRC}/Apl385.ttf ${FONTSDIR}
- ${INSTALL_DATA} ${WRKSRC}/APL333.ttf ${FONTSDIR}/Apl333.ttf
+pre-install:
+ mv ${WRKSRC}/APL333.ttf ${WRKSRC}/Apl333.ttf

.include <bsd.port.mk>
--
2.36.1

From 5082ea728281dd4240f2e72388618c01fa53ad0d Mon Sep 17 00:00:00 2001
From: Juan Picca <juan.picca@jumapico.uy>
Date: Sun, 29 May 2022 01:10:05 -0300
Subject: [PATCH 08/10] fonts/artwiz-aleczapka: add module font

Rewrite to use variables defined in the font module.
---
fonts/artwiz-aleczapka/Makefile | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/fonts/artwiz-aleczapka/Makefile b/fonts/artwiz-aleczapka/Makefile
index 6caa7b12536..33e8e2d2f3f 100755
--- a/fonts/artwiz-aleczapka/Makefile
+++ b/fonts/artwiz-aleczapka/Makefile
@@ -2,10 +2,9 @@ COMMENT-main= improved artwiz fonts
COMMENT-de= improved artwiz fonts (german pack)
COMMENT-se= improved artwiz fonts (swedish pack)

+TYPEFACE= artwiz-aleczapka
V= 1.3
-NAME= artwiz-aleczapka
-DISTNAME= ${NAME}-en-${V}
-PKGNAME = ${NAME}-${V}
+DISTNAME= ${TYPEFACE}-en-${V}
CATEGORIES= fonts x11
USE_X11 = Yes

@@ -25,11 +24,11 @@ NO_BUILD= Yes
NO_TEST= Yes
PKG_ARCH= *

-INST_DIR= ${PREFIX}/share/fonts/artwiz-aleczapka
+MODULES= font

DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \
- ${NAME}-de-${V}${EXTRACT_SUFX} \
- ${NAME}-se-${V}${EXTRACT_SUFX}
+ ${TYPEFACE}-de-${V}${EXTRACT_SUFX} \
+ ${TYPEFACE}-se-${V}${EXTRACT_SUFX}

MULTI_PACKAGES= -main -de -se

@@ -41,10 +40,10 @@ do-install:
egrep '\.pcf' ${WRKSRC}/fonts.dir | \
grep '\-artwiz-' | \
sed 's/\.pcf//g' > ${WRKSRC}/fonts.alias
- ${INSTALL_DATA_DIR} ${INST_DIR}
- ${INSTALL_DATA} ${WRKDIR}/${NAME}-en-${V}/*.pcf ${INST_DIR}
- ${INSTALL_DATA} ${WRKDIR}/${NAME}-de-${V}/*.de.pcf ${INST_DIR}
- ${INSTALL_DATA} ${WRKDIR}/${NAME}-se-${V}/*.se.pcf ${INST_DIR}
- ${INSTALL_DATA} ${WRKBUILD}/fonts.alias ${INST_DIR}/fonts.alias-artwiz
+ ${INSTALL_DATA_DIR} ${FONTDIR}
+ ${INSTALL_DATA} ${WRKDIR}/${TYPEFACE}-en-${V}/*.pcf ${FONTDIR}
+ ${INSTALL_DATA} ${WRKDIR}/${TYPEFACE}-de-${V}/*.de.pcf ${FONTDIR}
+ ${INSTALL_DATA} ${WRKDIR}/${TYPEFACE}-se-${V}/*.se.pcf ${FONTDIR}
+ ${INSTALL_DATA} ${WRKBUILD}/fonts.alias ${FONTDIR}/fonts.alias-artwiz

.include <bsd.port.mk>
--
2.36.1

From e4ce040b1e94f59eb3c9ec1748b8d44dde3db29b Mon Sep 17 00:00:00 2001
From: Juan Picca <juan.picca@jumapico.uy>
Date: Sun, 29 May 2022 01:33:07 -0300
Subject: [PATCH 09/10] fonts/b612-font: add module font

Remove do-install.
---
fonts/b612-font/Makefile | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/fonts/b612-font/Makefile b/fonts/b612-font/Makefile
index 66135d9d9f2..e78570f343e 100644
--- a/fonts/b612-font/Makefile
+++ b/fonts/b612-font/Makefile
@@ -5,7 +5,11 @@ COMMENT = highly legible font designed for aircraft cockpits
GH_ACCOUNT = polarsys
GH_PROJECT = b612
GH_TAGNAME = 1.008
+EXTRACT_SUFX = .tar.gz
+
PKGNAME = b612-font-${GH_TAGNAME}
+TYPEFACE = b612
+V = ${GH_TAGNAME}

CATEGORIES = fonts

@@ -19,9 +23,8 @@ PERMIT_PACKAGE = Yes
NO_BUILD = Yes
NO_TEST = Yes

-do-install:
- ${INSTALL_DATA_DIR} ${PREFIX}/share/fonts/b612
- ${INSTALL_DATA} ${WRKSRC}/fonts/ttf/*.ttf \
- ${PREFIX}/share/fonts/b612
+MODULES = font
+
+FONT_DISTSUBDIR = fonts/ttf

.include <bsd.port.mk>
--
2.36.1

From c8d0751fd98671b608b589b99098f3c3017ba538 Mon Sep 17 00:00:00 2001
From: Juan Picca <juan.picca@jumapico.uy>
Date: Sun, 29 May 2022 01:49:30 -0300
Subject: [PATCH 10/10] fonts/blockzone: replace post-install

* Replace post-install with FONT_DOCFILES
* Rename doc directory from `share/doc/blockzone/` to
`share/fonts/BlockZone/` due the directory name is generated from
the TYPEFACE variable.
---
fonts/blockzone/Makefile | 7 +------
fonts/blockzone/pkg/PLIST | 4 ++--
2 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/fonts/blockzone/Makefile b/fonts/blockzone/Makefile
index b8a88bb7fd8..9db470f9a61 100644
--- a/fonts/blockzone/Makefile
+++ b/fonts/blockzone/Makefile
@@ -1,7 +1,6 @@
COMMENT = pixel-perfect recreation of the original IBM VGA font

TYPEFACE = BlockZone
-
V = 1.004
DISTNAME = BlockZone-$V
REVISION = 4
@@ -20,10 +19,6 @@ MODULES = font
NO_BUILD = Yes
NO_TEST = Yes

-DOCDIR = ${PREFIX}/share/doc/blockzone
-
-post-install:
- ${INSTALL_DATA_DIR} ${DOCDIR}
- ${INSTALL_DATA} ${WRKSRC}/LICENSE ${DOCDIR}
+FONT_DOCFILES = LICENSE

.include <bsd.port.mk>
diff --git a/fonts/blockzone/pkg/PLIST b/fonts/blockzone/pkg/PLIST
index 6f636f92bef..ea963152e84 100644
--- a/fonts/blockzone/pkg/PLIST
+++ b/fonts/blockzone/pkg/PLIST
@@ -1,5 +1,5 @@
-share/doc/blockzone/
-share/doc/blockzone/LICENSE
+share/doc/BlockZone/
+share/doc/BlockZone/LICENSE
share/fonts/
@fontdir share/fonts/BlockZone/
share/fonts/BlockZone/BlockZone.ttf
--
2.36.1

Hi Stuart.

> btw there is also pkg_mgr if you want a way to browse things without
> fetching the ports tree..

Thanks for the tip.

> I don't really see a change which means changes (even if relatively
> minor) to 150 ports, carrying yet more quirks entries and decoupling
> package names from directory names, and requiring changes from
> users doing automation to install packages as particularly low-hanging..

Ok.
For now no more talk about changing the name of 150 packages :)


What about modifying the fonts to use the font module
(infrastructure/mk/font.port.mk)?

Also, in the case of the fonts ports that create a `doc` directory to
copy files using the `do-install` target a simplification in the
makefiles can be made with the following changes in `font.port.mk`:

1. Define the variable `FONT_DOCDIR ?= ${PREFIX}/share/doc/${TYPEFACE}`
(suggested name; DOCDIR is better?) in the font module.
2. If the variable `FONT_DOCFILES` (also a suggested name; or maybe
DOCFILES?) is defined, add to the `do-install` the installation of the
files under the `doc` directory:

```
@@ -25,5 +26,9 @@ MODFONT_do-install = ${INSTALL_DATA_DIR} ${FONTDIR}; \
. if !target(do-install)
do-install:
${MODFONT_do-install}
+. if defined(FONT_DOCFILES)
+ ${INSTALL_DATA_DIR} ${FONT_DOCDIR}; \
+ for f in ${FONT_DOCFILES}; do ${INSTALL_DATA} ${FONT_DISTDIR}/$$f ${FONT_DOCDIR}; done
+. endif
. endif
.endif
```

Improvements:

* The `doc` directory for the fonts is generated in the same way that
`FONTDIR`.
* In simple cases, the `do-install` target in the port can be replaced
with the definition of the variable `FONT_DOCFILES`.

To test the idea, I modified the Makefiles for ports fonts/a* and
fonts/b* - 9 ports -:

* abyssinica: removed DOCDIR, replaced post-install with FONT_DOCFILES
* alkalami: removed FONTDIR and DOCDIR, replaced do-install with FONT_DOCFILES
* andika: removed DOCDIR, replaced post-install with FONT_DOCFILES
* annapurna: removed FONTDIR and DOCDIR, replaced do-install with FONT_DOCFILES
* anonymous-pro: removed FONTSDIR, do-install executes the pax command.
The FONTDIR and FONT_DOCDIR variables (from the font module) where
used instead of FONTSDIR and a hardcoded doc directory.
* apl-fonts: removed FONTSDIR, do-install replaced with pre-install.
Here, do-install renames a file when copy to the FONTDIR directory.
* artwiz-aleczapka: replaced NAME with TYPEFACE, removed INST_DIR,
do-install executes grep, sed and the name of the source files are
changes in the package but INST_DIR is replaced with FONTDIR.
* b612-font: added EXTRACT_SUFX, removed do-install, added
FONT_DISTSUBDIR.
* blockzone: removed DOCDIR, replaced post-install with FONT_DOCFILES.
Here, the doc directory and font directory are different. Due that, I
choose to use the same name for the doc and font directory, modifying
the PLIST file.

In all the cases, the TYPEFACE and MODULES variables where added.

Thoughts:

* In the majority of the cases the directory for the docs or the font
is defined. Redundant if it can be defined in the font module.
* There is no uniform use of do-install and post-install.
* Half of the do-install/post-install targets can be replaced with
the definition of the FONT_DOCFILES variable.

In all cases, the name of the package is the same and only in blockzone
the content is differente (`share/doc/BlockZone` instead of
`share/doc/blockzone`).

Patches attached and the script used to compare the packages (uses
diffoscope).


Comments?

Regards,
JMPC

No comments:

Post a Comment