Skip to contentSkip to conversation

package/googlefontdirectory: change to google repo

RFC PATCH New Bartosz Bilas 2 participants 2 messages Jan 17, 2019 – Feb 6, 2019

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 package/googlefontdirectory: change to google repo

As because the current repository doesn't support new fonts we need to change it to the new one official google github repository which contains a lot of new available fonts.

Note: There are some things to improve like license files because in the new repository every directory with font contains separate license file however I have no idea how to do it in proper way.

---
 .../googlefontdirectory.hash                  |  2 +-
 .../googlefontdirectory.mk                    | 23 +++++++++++--------
 2 files changed, 15 insertions(+), 10 deletions(-)
package/googlefontdirectory/googlefontdirectory.hash +1 -1
index 6b15b2b8b7..e77ee3d7cb 100644
@@ -1,2 +1,2 @@
 # Locally calculated
-sha256 8a7d04feef21fdfc09d90cd3e2c0c05dcb2fdd4e15f971e8ceaf4d90c1c123cd googlewebfonts.tgz
+sha256 ec2ddbeee673cce1b0796e3b20fbff5fd836ce9ba6d88deed8b59154fa255f06  googlefontdirectory-94dff3eaa9301b6640cccc63c56d6ff33d82882c.tar.gz
package/googlefontdirectory/googlefontdirectory.mk +14 -9
index c34de3b0fe..3a78b0588b 100644
@@ -4,20 +4,25 @@
 #
 ################################################################################
 
-GOOGLEFONTDIRECTORY_SITE = \
-	https://s3.amazonaws.com/joemaller_google_webfonts
-GOOGLEFONTDIRECTORY_SOURCE = googlewebfonts.tgz
-GOOGLEFONTDIRECTORY_LICENSE = OFL-1.1
+GOOGLEFONTDIRECTORY_VERSION = 94dff3eaa9301b6640cccc63c56d6ff33d82882c
+GOOGLEFONTDIRECTORY_SITE = $(call github,google,fonts,$(GOOGLEFONTDIRECTORY_VERSION))
+GOOGLEFONTDIRECTORY_LICENSE = OFL-1.1 (ofl) Apache-2.0 (apache) UFL-1.0 (ufl)
+GOOGLEFONTDIRECTORY_LICENSE_FILES = LICENCE OFL
+GOOGLEFONTDIRECTORY_DIRECTORIES_LIST = apache ofl ufl
 
 GOOGLEFONTDIRECTORY_FONTS = \
 	$(call qstrip,$(BR2_PACKAGE_GOOGLEFONTDIRECTORY_FONTS))
 
 define GOOGLEFONTDIRECTORY_INSTALL_TARGET_CMDS
-	for i in $(GOOGLEFONTDIRECTORY_FONTS); \
-	do \
-		$(INSTALL) -d $(TARGET_DIR)/usr/share/fonts/$$i && \
-		$(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/fonts/$$i $(@D)/$$i/*.ttf || exit 1; \
-	done
+	$(foreach d,$(GOOGLEFONTDIRECTORY_DIRECTORIES_LIST),\
+		for i in $(GOOGLEFONTDIRECTORY_FONTS); \
+		do \
+			if font -d $(@D)/$(d)/$$i ; then \
+				$(INSTALL) -d $(TARGET_DIR)/usr/share/fonts/$$i && \
+				$(INSTALL) -m 0644 -t $(TARGET_DIR)/usr/share/fonts/$$i $(@D)/$(d)/$$i/*.ttf ; \
+			fi  \
+		done
+	)
 endef
 
 $(eval $(generic-package))
Signature · 1 line
2.20.1
#1 lore raw

RFC PATCH 1/1 package/googlefontdirectory: change to google repo

Hello,

Quoted 9 lines · On Thu, 17 Jan 2019 22:14:22 +0100 Bartosz Bilas <[email protected]>…

As because the current repository doesn't support new fonts we need to change it to the new one official google github repository which contains a lot of new available fonts.

Note: There are some things to improve like license files because in the new repository every directory with font contains separate license file however I have no idea how to do it in proper way.

Quoted 5 lines
---
 .../googlefontdirectory.hash                  |  2 +-
 .../googlefontdirectory.mk                    | 23 +++++++++++--------
 2 files changed, 15 insertions(+), 10 deletions(-)

So, I've applied, but after doing a fair number of changes.

First, I've changed the semantic of the BR2_PACKAGE_GOOGLEFONTDIRECTORY_FONTS so that the value it contains look like ufl/ubuntu, ofl/marvel, etc. rather than just the font name.

Thanks to that, the installation logic could be simplified, and I could come up with a solution for the LICENSE and LICENSE_FILES variables. The solution looks like this:

+ifneq ($(filter apache/%,$(GOOGLEFONTDIRECTORY_FONTS)),)
+GOOGLEFONTDIRECTORY_LICENSE += Apache-2.0
+GOOGLEFONTDIRECTORY_LICENSE_FILES += $(addsuffix /LICENSE.txt,$(filter apache/%,$(GOOGLEFONTDIRECTORY_FONTS))) +endif
+
+ifneq ($(filter ofl/%,$(GOOGLEFONTDIRECTORY_FONTS)),)
+GOOGLEFONTDIRECTORY_LICENSE += OFL-1.1
+GOOGLEFONTDIRECTORY_LICENSE_FILES += $(addsuffix /OFL.txt,$(filter ofl/%,$(GOOGLEFONTDIRECTORY_FONTS))) +endif
+
+ifneq ($(filter ufl/%,$(GOOGLEFONTDIRECTORY_FONTS)),)
+GOOGLEFONTDIRECTORY_LICENSE += UFL-1.1
+GOOGLEFONTDIRECTORY_LICENSE_FILES += $(addsuffix /LICENCE.txt,$(filter ufl/%,$(GOOGLEFONTDIRECTORY_FONTS))) +endif
+
+GOOGLEFONTDIRECTORY_LICENSE := $(subst $(space),$(comma)$(space),$(GOOGLEFONTDIRECTORY_LICENSE))

It's a bit tricky, but it works :-)

I've also changed the .hash file to contain the hashes of all the license files.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com