commit:     de0a5a2897c83cfc6522a84a571d758ef3dc8ecb
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 23 00:27:28 2020 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Thu Apr 23 00:27:28 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de0a5a28

media-fonts/noto-emoji: Install pre-built font by default

As suggested in bug #717654 install prebuilt font by default, even still
allowing to optionally built it with supplied images as they contain more
updated images and, sometimes, more emojis.

Also be more verbose while building

Closes: https://bugs.gentoo.org/717654
Thanks-to: Kent Fredric
Package-Manager: Portage-2.3.96, Repoman-2.3.22
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>

 .../noto-emoji/files/noto-emoji-pngquant.patch     | 11 +++
 .../noto-emoji/files/noto-emoji-zopflipng.patch    | 11 +++
 media-fonts/noto-emoji/metadata.xml                |  3 +
 .../noto-emoji/noto-emoji-20200317-r1.ebuild       | 96 ++++++++++++++++++++++
 4 files changed, 121 insertions(+)

diff --git a/media-fonts/noto-emoji/files/noto-emoji-pngquant.patch 
b/media-fonts/noto-emoji/files/noto-emoji-pngquant.patch
new file mode 100644
index 00000000000..8a152bea23d
--- /dev/null
+++ b/media-fonts/noto-emoji/files/noto-emoji-pngquant.patch
@@ -0,0 +1,11 @@
+--- a/Makefile~        2020-04-22 23:04:44.000000000 +0200
++++ b/Makefile 2020-04-22 23:06:42.069275340 +0200
+@@ -20,7 +20,7 @@
+ 
+ PNGQUANT = pngquant
+ PYTHON = python3
+-PNGQUANTFLAGS = --speed 1 --skip-if-larger --quality 85-95 --force
++PNGQUANTFLAGS = --speed 1 --skip-if-larger --quality 85-95 --force -v
+ BODY_DIMENSIONS = 136x128
+ IMOPS := -size $(BODY_DIMENSIONS) canvas:none -compose copy -gravity center
+ 

diff --git a/media-fonts/noto-emoji/files/noto-emoji-zopflipng.patch 
b/media-fonts/noto-emoji/files/noto-emoji-zopflipng.patch
new file mode 100644
index 00000000000..0cb272994aa
--- /dev/null
+++ b/media-fonts/noto-emoji/files/noto-emoji-zopflipng.patch
@@ -0,0 +1,11 @@
+--- a/Makefile~        2020-04-22 23:07:33.000000000 +0200
++++ b/Makefile 2020-04-22 23:11:46.356767595 +0200
+@@ -194,7 +194,7 @@
+ ifdef MISSING_ZOPFLI
+       @$(OPTIPNG) -quiet -o7 -clobber -force -out "$@" "$<"
+ else
+-      @$(ZOPFLIPNG) -y "$<" "$@" 1> /dev/null 2>&1
++      @$(ZOPFLIPNG) -y "$<" "$@" 2>&1
+ endif
+ 
+ 

diff --git a/media-fonts/noto-emoji/metadata.xml 
b/media-fonts/noto-emoji/metadata.xml
index 3da97a9953c..18a049a172d 100644
--- a/media-fonts/noto-emoji/metadata.xml
+++ b/media-fonts/noto-emoji/metadata.xml
@@ -5,4 +5,7 @@
                <email>[email protected]</email>
                <name>Pacho Ramos</name>
        </maintainer>
+<use>
+       <flag name="buildfont">Build Noto Emoji font with supplied 
images.</flag>
+</use>
 </pkgmetadata>

diff --git a/media-fonts/noto-emoji/noto-emoji-20200317-r1.ebuild 
b/media-fonts/noto-emoji/noto-emoji-20200317-r1.ebuild
new file mode 100644
index 00000000000..15394e1f453
--- /dev/null
+++ b/media-fonts/noto-emoji/noto-emoji-20200317-r1.ebuild
@@ -0,0 +1,96 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python3_{6,7,8} )
+
+inherit font python-any-r1
+
+DESCRIPTION="Google Noto Emoji fonts"
+HOMEPAGE="https://www.google.com/get/noto/ 
https://github.com/googlefonts/noto-emoji";
+
+COMMIT="ac1703e9d7feebbf5443a986e08332b1e1c5afcf"
+SRC_URI="https://github.com/googlefonts/noto-emoji/archive/${COMMIT}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="Apache-2.0 OFL-1.1"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="buildfont"
+
+DEPEND="buildfont? (
+               ${PYTHON_DEPS}
+               app-arch/zopfli
+               $(python_gen_any_dep '
+                       dev-python/fonttools[${PYTHON_USEDEP}]
+                       dev-python/nototools[${PYTHON_USEDEP}]
+               ')
+               media-gfx/pngquant
+               x11-libs/cairo
+               || ( media-gfx/imagemagick[png] media-gfx/graphicsmagick[png] )
+       )
+"
+RDEPEND=""
+
+RESTRICT="binchecks strip"
+
+S="${WORKDIR}/${PN}-${COMMIT}"
+
+python_check_deps() {
+       has_version "dev-python/fonttools[${PYTHON_USEDEP}]" && \
+        has_version "dev-python/nototools[${PYTHON_USEDEP}]"
+}
+
+src_prepare() {
+       default
+
+       if use buildfont; then
+               # From Fedora
+               eapply "${FILESDIR}/${PN}-build-all-flags.patch"
+
+               # https://github.com/googlei18n/noto-emoji/issues/240
+               eapply "${FILESDIR}/${PN}-20180823-build-path.patch"
+
+               # Be more verbose, bug #717654
+               eapply "${FILESDIR}"/${PN}-pngquant.patch
+               eapply "${FILESDIR}"/${PN}-zopflipng.patch
+
+               # Based on Fedora patch to allow graphicsmagick usage
+               if has_version media-gfx/graphicsmagick; then
+                       eapply "${FILESDIR}/${PN}-20190328-use-gm.patch"
+               fi
+       fi
+}
+
+src_compile() {
+       if ! use buildfont; then
+               einfo "Installing pre-built fonts provided by upstream."
+               einfo "They could be not fully updated or miss some items."
+               einfo "To build fonts based on latest images enable 'buildfont'"
+               einfo "USE (that will require more time and resources too)."
+       else
+               einfo "Building fonts..."
+               default
+       fi
+}
+
+src_install() {
+       if ! use buildfont; then
+               FONT_S="${S}/fonts"
+       else
+               mv -i fonts/NotoEmoji-Regular.ttf "${S}" || die
+               # Built font and Regular font
+               FONT_S="${S}"
+
+               # Don't lose fancy emoji icons
+               insinto /usr/share/icons/"${PN}"/128x128/emotes/
+               doins png/128/*.png
+
+               insinto /usr/share/icons/"${PN}"/scalable/emotes/
+               doins svg/*.svg
+       fi
+
+       FONT_SUFFIX="ttf"
+       font_src_install
+
+       dodoc README.md
+}

Reply via email to