commit:     b20f577be5280947b9cfcbf0021b4a4ec715e1b6
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 28 15:43:57 2021 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Wed Dec 29 15:41:21 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b20f577b

media-gfx/graphite2: python3_10, EAPI-8, cmake function, upstream fix

Closes: https://bugs.gentoo.org/830038
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...e2-1.3.14-fix-inaccurate-slice-range-calc.patch |  34 ++++++
 .../files/graphite2-1.3.14-no-libtool-file.patch   |  68 +++++++++++
 media-gfx/graphite2/graphite2-1.3.14-r2.ebuild     | 124 +++++++++++++++++++++
 3 files changed, 226 insertions(+)

diff --git 
a/media-gfx/graphite2/files/graphite2-1.3.14-fix-inaccurate-slice-range-calc.patch
 
b/media-gfx/graphite2/files/graphite2-1.3.14-fix-inaccurate-slice-range-calc.patch
new file mode 100644
index 000000000000..32e01535838f
--- /dev/null
+++ 
b/media-gfx/graphite2/files/graphite2-1.3.14-fix-inaccurate-slice-range-calc.patch
@@ -0,0 +1,34 @@
+From 5c181c316ee0399d720efe1e75be702f1ca95b66 Mon Sep 17 00:00:00 2001
+From: Martin Hosken <martin_hos...@sil.org>
+Date: Thu, 20 May 2021 13:53:29 +0700
+Subject: [PATCH] Fix inaccurate slice range calculation for bases with
+ diacritics
+
+---
+ src/Pass.cpp | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/src/Pass.cpp b/src/Pass.cpp
+index db31c22d..47ae2064 100644
+--- a/src/Pass.cpp
++++ b/src/Pass.cpp
+@@ -1056,12 +1056,17 @@ float Pass::resolveKern(Segment *seg, Slot *slotFix, 
GR_MAYBE_UNUSED Slot *start
+     ymin = min(by + bbb.bl.y, ymin);
+     for (nbor = slotFix->next(); nbor; nbor = nbor->next())
+     {
+-        if (nbor->isChildOf(base))
+-            continue;
+         if (!gc.check(nbor->gid()))
+             return 0.;
+         const Rect &bb = seg->theGlyphBBoxTemporary(nbor->gid());
+         SlotCollision *cNbor = seg->collisionInfo(nbor);
++        const float nby = nbor->origin().y + cNbor->shift().y;
++        if (nbor->isChildOf(base))
++        {
++            ymax = max(nby + bb.tr.y, ymax);
++            ymin = min(nby + bb.bl.y, ymin);
++            continue;
++        }
+         if ((bb.bl.y == 0.f && bb.tr.y == 0.f) || (cNbor->flags() & 
SlotCollision::COLL_ISSPACE))
+         {
+             if (m_kernColls == InWord)

diff --git a/media-gfx/graphite2/files/graphite2-1.3.14-no-libtool-file.patch 
b/media-gfx/graphite2/files/graphite2-1.3.14-no-libtool-file.patch
new file mode 100644
index 000000000000..2f1056be05d8
--- /dev/null
+++ b/media-gfx/graphite2/files/graphite2-1.3.14-no-libtool-file.patch
@@ -0,0 +1,68 @@
+From https://github.com/silnrsi/graphite/pull/65
+
+From 3edb88b55c0870989778c670d555aa159a2c3abc Mon Sep 17 00:00:00 2001
+From: Fabrice Fontaine <fontaine.fabr...@gmail.com>
+Date: Mon, 31 Aug 2020 20:56:43 +0200
+Subject: [PATCH] don't install a libtool file with static library
+
+Static library is supported since version 1.3.11 and
+https://github.com/silnrsi/graphite/commit/2f143c04da5caa43ddf4dba437b2f2bc26bf4238
+
+However, graphite2 is still installing libgraphite2.la which contains
+incorrect information (i.e. dlname set to libgraphite2.so and
+old_library set to ''):
+
+dlname='libgraphite2.so'
+
+library_names='libgraphite2.so.3.2.1 libgraphite2.so.3 libgraphite2.so'
+
+old_library=''
+
+dependency_libs=''
+
+This will result in the following build failure with any applications
+using this file such as harfbuzz:
+
+arm-linux-g++.br_real: error: 
/home/buildroot/autobuild/run/instance-3/output-1/host/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/lib/libgraphite2.so:
 No such file or directory
+make[5]: *** [main] Error 1
+
+Instead of trying to fix this libtool file, just disable it when
+building a static library as it is not needed
+
+Fixes:
+ - 
http://autobuild.buildroot.org/results/9ebe1d11e80755d59190ef2aae82bbba5cc45e44
+
+Signed-off-by: Fabrice Fontaine <fontaine.fabr...@gmail.com>
+
+* asturm 2021-12-28: We don't want those files at all.
+
+---
+ src/CMakeLists.txt | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index b6ac26bf..a7ace040 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -131,7 +131,9 @@ if  (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+         nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>)
+     endif ()
+     set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
+-    CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}")
++    if (0)
++        CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}")
++    endif()
+ endif()
+ 
+ if  (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+@@ -146,7 +148,9 @@ if  (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+     include(Graphite)
+     nolib_test(stdc++ $<TARGET_SONAME_FILE:graphite2>)
+     set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "")
+-    CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}")
++    if (0)
++        CREATE_LIBTOOL_FILE(graphite2 "/lib${LIB_SUFFIX}")
++    endif()
+ endif()
+ 
+ if  (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")

diff --git a/media-gfx/graphite2/graphite2-1.3.14-r2.ebuild 
b/media-gfx/graphite2/graphite2-1.3.14-r2.ebuild
new file mode 100644
index 000000000000..5fcd5521f24a
--- /dev/null
+++ b/media-gfx/graphite2/graphite2-1.3.14-r2.ebuild
@@ -0,0 +1,124 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+GENTOO_DEPEND_ON_PERL="no"
+PYTHON_COMPAT=( python3_{8..10} )
+inherit perl-module python-any-r1 cmake-multilib
+
+DESCRIPTION="Library providing rendering capabilities for complex non-Roman 
writing systems"
+HOMEPAGE="https://scripts.sil.org/cms/scripts/page.php?site_id=projects&item_id=graphite_home";
+SRC_URI="mirror://sourceforge/silgraphite/${PN}/${P}.tgz"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~s390 
~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris 
~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="perl test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="perl? ( dev-lang/perl:= )"
+DEPEND="${RDEPEND}
+       test? ( dev-libs/glib:2 )
+"
+BDEPEND="
+       perl? (
+               dev-lang/perl
+               dev-perl/Locale-Maketext-Lexicon
+               dev-perl/Module-Build
+       )
+       test? (
+               ${PYTHON_DEPS}
+               $(python_gen_any_dep 'dev-python/fonttools[${PYTHON_USEDEP}]')
+               media-libs/fontconfig
+               perl? ( virtual/perl-Test-Simple )
+       )
+"
+
+PATCHES=(
+       # downstream:
+       "${FILESDIR}/${PN}-1.3.5-includes-libs-perl.patch"
+       "${FILESDIR}/${PN}-1.35-fix-gcc-linking.patch"
+       "${FILESDIR}/${PN}-1.3.14-fix-cmake-files-libdir.patch"
+       "${FILESDIR}/${P}-no-libtool-file.patch"
+       # git master:
+       "${FILESDIR}/${P}-fix-inaccurate-slice-range-calc.patch"
+)
+
+pkg_setup() {
+       use perl && perl_set_version
+       use test && python-any-r1_pkg_setup
+}
+
+python_check_deps() {
+       has_version -b "dev-python/fonttools[${PYTHON_USEDEP}]"
+}
+
+src_prepare() {
+       cmake_src_prepare
+       use test || cmake_comment_add_subdirectory tests
+}
+
+multilib_src_configure() {
+       local mycmakeargs=(
+               # Renamed VM_MACHINE_TYPE to GRAPHITE2_VM_TYPE
+               -DGRAPHITE2_VM_TYPE=direct
+       )
+       # https://sourceforge.net/p/silgraphite/bugs/49/
+       [[ ${CHOST} == powerpc*-apple* ]] && mycmakeargs+=(
+               -DGRAPHITE2_NSEGCACHE:BOOL=ON
+       )
+
+       if use elibc_musl ; then
+               # bug #829690
+               if use ppc || use x86 ; then
+                       sed -e 's:${GRAPHITE_LINK_FLAGS}:-lssp_nonshared &:' \
+                               -i "${S}"/src/CMakeLists.txt || die
+               fi
+       fi
+
+       cmake_src_configure
+
+       # fix perl linking
+       if multilib_is_native_abi && use perl; then
+               # we rely on the fact that cmake_src_configure sets BUILD_DIR
+               sed -e "s:@BUILD_DIR@:\"${BUILD_DIR}/src\":" \
+                       -i "${S}"/contrib/perl/Build.PL || die
+       fi
+}
+
+src_compile() {
+       cmake-multilib_src_compile
+       if use perl; then
+               cd contrib/perl || die
+               perl-module_src_configure
+               perl-module_src_compile
+       fi
+}
+
+multilib_src_test() {
+       if multilib_is_native_abi; then
+               cmake_src_test
+       else
+               einfo "Cannot test since python is not multilib."
+       fi
+}
+
+src_test() {
+       cmake-multilib_src_test
+       if use perl; then
+               # Perl tests fail due to missing POD coverage...
+               perl_rm_files "contrib/perl/t/pod.t" 
"contrib/perl/t/pod-coverage.t"
+               cd contrib/perl || die
+               perl-module_src_test
+       fi
+}
+
+src_install() {
+       cmake-multilib_src_install
+       if use perl; then
+               cd contrib/perl || die
+               perl-module_src_install
+               perl_delete_localpod
+       fi
+}

Reply via email to