public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/guru:dev commit in: media-gfx/fontdiff/, media-gfx/fontdiff/files/
@ 2021-06-19  1:15 Alessandro Barbieri
  0 siblings, 0 replies; only message in thread
From: Alessandro Barbieri @ 2021-06-19  1:15 UTC (permalink / raw
  To: gentoo-commits

commit:     dd3025146de1c3dd04ed2b5797c0586c4e37cfc9
Author:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
AuthorDate: Sat Jun 19 00:51:03 2021 +0000
Commit:     Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com>
CommitDate: Sat Jun 19 00:51:03 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=dd302514

media-gfx/fontdiff: initial import

Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com>

 media-gfx/fontdiff/Manifest                        |  1 +
 .../files/fontdiff-0.2.3-no-bundled-libs.patch     | 28 +++++++++
 media-gfx/fontdiff/files/fontdiff-cairo114.diff    | 13 +++++
 media-gfx/fontdiff/files/fontdiff-hbicu.diff       | 53 +++++++++++++++++
 media-gfx/fontdiff/fontdiff-0.2.3.ebuild           | 68 ++++++++++++++++++++++
 media-gfx/fontdiff/metadata.xml                    |  5 ++
 6 files changed, 168 insertions(+)

diff --git a/media-gfx/fontdiff/Manifest b/media-gfx/fontdiff/Manifest
new file mode 100644
index 000000000..68031ebc2
--- /dev/null
+++ b/media-gfx/fontdiff/Manifest
@@ -0,0 +1 @@
+DIST fontdiff-0.2.3.tar.gz 23940699 BLAKE2B 3a14deae16e67ba5c897c9b0779a9a5e4f2f5a5c9bb4ad2dd2e605fbc854b6939196c387160b2ed5b950ce81cf80868aa17414113115058d16e2ffeca752ed97 SHA512 6fb04c1527f8dc73677b8cb5437760f72deabc4ab117e2c16f0bff36e6e5eb58b1e1ff5e45f54de03be0534f0ab55b447a32ce56d9d2750817643dff84e087ea

diff --git a/media-gfx/fontdiff/files/fontdiff-0.2.3-no-bundled-libs.patch b/media-gfx/fontdiff/files/fontdiff-0.2.3-no-bundled-libs.patch
new file mode 100644
index 000000000..7e5dad0be
--- /dev/null
+++ b/media-gfx/fontdiff/files/fontdiff-0.2.3-no-bundled-libs.patch
@@ -0,0 +1,28 @@
+--- a/src/fontdiff/fontdiff.gyp
++++ b/src/fontdiff/fontdiff.gyp
+@@ -20,9 +20,7 @@
+                 'main.cc',
+             ],
+             'dependencies': [
+-                'fontdiff_lib',
+-                '../third_party/freetype/freetype.gyp:freetype',
+-                '../third_party/icu/icu.gyp:icu_uc',
++                'fontdiff_lib'
+             ],
+             'conditions': [
+                 ['OS == "linux"', {
+@@ -67,14 +65,6 @@
+                 'FONTDIFF_VERSION=' + '<!(echo $FONTDIFF_VERSION)',
+             ],
+             'dependencies': [
+-                '../third_party/cairo/cairo.gyp:cairo',
+-                '../third_party/dtl/dtl.gyp:dtl',
+-                '../third_party/expat/expat.gyp:expat',
+-                '../third_party/freetype/freetype.gyp:freetype',
+-                '../third_party/harfbuzz/harfbuzz.gyp:harfbuzz',
+-                '../third_party/icu/icu.gyp:icu_i18n',
+-                '../third_party/icu/icu.gyp:icu_uc',
+-                '../third_party/icu/icu.gyp:icu_data',
+             ],
+             'conditions': [
+                 ['OS == "linux"', {

diff --git a/media-gfx/fontdiff/files/fontdiff-cairo114.diff b/media-gfx/fontdiff/files/fontdiff-cairo114.diff
new file mode 100644
index 000000000..9bad60d3b
--- /dev/null
+++ b/media-gfx/fontdiff/files/fontdiff-cairo114.diff
@@ -0,0 +1,13 @@
+--- a/src/fontdiff/diff_job.cc
++++ b/src/fontdiff/diff_job.cc
+@@ -77,8 +77,10 @@ void DiffJob::WritePDF(const std::string& filepath) {
+     creator.append(" ");
+     creator.append(version);
+   }
++  #if CAIRO_VERSION > 11499
+   cairo_pdf_surface_set_metadata(pdf_surface, CAIRO_PDF_METADATA_CREATOR,
+                                  creator.c_str());
++  #endif
+ 
+   cairo_t* pdf = cairo_create(pdf_surface);
+   for (const Page* page : pages_) {

diff --git a/media-gfx/fontdiff/files/fontdiff-hbicu.diff b/media-gfx/fontdiff/files/fontdiff-hbicu.diff
new file mode 100644
index 000000000..121d87fd8
--- /dev/null
+++ b/media-gfx/fontdiff/files/fontdiff-hbicu.diff
@@ -0,0 +1,53 @@
+--- a/src/fontdiff/diff_job.cc
++++ b/src/fontdiff/diff_job.cc
+@@ -132,7 +132,7 @@ void DiffJob::HandleEndElement() {
+   xmlElements_.pop_back();
+ }
+ 
+-void DiffJob::HandleCharData(const StringPiece& text) {
++void DiffJob::HandleCharData(const icu::StringPiece& text) {
+   const XMLElement& e = xmlElements_.back();
+   e.paragraph->AppendSpan(text, e.style);
+ }
+--- a/src/fontdiff/diff_job.h
++++ b/src/fontdiff/diff_job.h
+@@ -62,7 +62,7 @@ class DiffJob {
+     const std::string& name,
+     const std::map<std::string, std::string>& attr);
+   void HandleEndElement();
+-  void HandleCharData(const StringPiece& text);
++  void HandleCharData(const icu::StringPiece& text);
+ 
+   bool has_diffs_;
+   const FontCollection* beforeFonts_;
+--- a/src/fontdiff/paragraph.cc
++++ b/src/fontdiff/paragraph.cc
+@@ -300,7 +300,7 @@ void Paragraph::FindPotentialLineBreaks(int32_t start, int32_t limit,
+   if (breaker) {
+     breaker->setText(text_);
+     int32_t cur = breaker->following(start > 0 ? start - 1 : 0);
+-    while (cur != BreakIterator::DONE && cur < limit) {
++    while (cur != icu::BreakIterator::DONE && cur < limit) {
+       breaks->push_back(cur);
+       cur = breaker->next();
+     }
+--- a/src/fontdiff/shaped_text.cc
++++ b/src/fontdiff/shaped_text.cc
+@@ -21,7 +21,7 @@
+ #include <hb.h>
+ #include <hb-ft.h>
+ #include <hb-icu.h>
+-#include <unicode/unistr.h>
++#include <unicode/ustring.h>
+ 
+ #include "fontdiff/font.h"
+ #include "fontdiff/icu_helper.h"
+@@ -39,7 +39,7 @@ ShapedText::ShapedText(const UChar* text, int32_t start, int32_t limit,
+     hb_buffer_(hb_buffer_create()), ascender_(0), descender_(0) {
+   const int32_t length = limit - start;
+   hb_buffer_set_unicode_funcs(hb_buffer_, hb_icu_get_unicode_funcs());
+-  hb_buffer_add_utf16(hb_buffer_, text + start, length, 0, length);
++  hb_buffer_add_utf16(hb_buffer_, (uint16_t*)text + start, length, 0, length);
+   hb_buffer_set_cluster_level(hb_buffer_,
+                               HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS);
+   hb_segment_properties_t props;

diff --git a/media-gfx/fontdiff/fontdiff-0.2.3.ebuild b/media-gfx/fontdiff/fontdiff-0.2.3.ebuild
new file mode 100644
index 000000000..c01424df6
--- /dev/null
+++ b/media-gfx/fontdiff/fontdiff-0.2.3.ebuild
@@ -0,0 +1,68 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit toolchain-funcs
+
+SRC_URI="https://github.com/googlefonts/fontdiff/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz"
+KEYWORDS="~amd64"
+DESCRIPTION="A tool for finding visual differences between two font versions"
+HOMEPAGE="https://github.com/googlei18n/fontdiff"
+LICENSE="Apache-2.0"
+SLOT="0"
+
+RDEPEND="
+	app-i18n/unicode-data
+	app-i18n/unicode-emoji
+	dev-libs/expat
+	dev-libs/fribidi
+	dev-libs/icu:=
+	dev-util/ragel
+	>=media-libs/freetype-2.9:2
+	>=media-libs/harfbuzz-1.7.4[icu]
+	x11-libs/cairo
+	x11-libs/pixman
+"
+DEPEND="
+	${RDEPEND}
+	dev-cpp/dtl
+	dev-util/gyp
+"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-cairo114.diff"
+	"${FILESDIR}/${PN}-hbicu.diff"
+	"${FILESDIR}/${P}-no-bundled-libs.patch"
+)
+
+src_prepare() {
+	#no bundled libs
+	rm -r src/third_party || die
+	default
+}
+
+src_configure() {
+	gyp -f make --depth . "${S}/src/fontdiff/fontdiff.gyp" || die
+}
+
+src_compile() {
+	local _pc="$(tc-getPKG_CONFIG)"
+	local _d="cairo expat freetype2 harfbuzz-icu icu-uc"
+	local myargs=(
+		CXX=$(tc-getCXX)
+		CC=$(tc-getCC)
+		AR=$(tc-getAR)
+		LIBS="$(${_pc} --libs ${_d})"
+		CPPFLAGS="$(${_pc} --cflags ${_d})"
+		V=1
+	)
+
+	emake "${myargs[@]}"
+}
+
+src_install() {
+	dobin "${S}/out/Default/${PN}"
+	einstalldocs
+}

diff --git a/media-gfx/fontdiff/metadata.xml b/media-gfx/fontdiff/metadata.xml
new file mode 100644
index 000000000..6f49eba8f
--- /dev/null
+++ b/media-gfx/fontdiff/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<!-- maintainer-needed -->
+</pkgmetadata>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-19  1:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-19  1:15 [gentoo-commits] repo/proj/guru:dev commit in: media-gfx/fontdiff/, media-gfx/fontdiff/files/ Alessandro Barbieri

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox