1 |
commit: ae62b66d2857c70d7c0437438f30f63555edb073 |
2 |
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Oct 7 18:36:23 2015 +0000 |
4 |
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 7 18:43:47 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ae62b66d |
7 |
|
8 |
media-libs/freetype: add upstream fix for bad shifts w/some bad fonts |
9 |
|
10 |
.../freetype/files/freetype-2.6.1-bad-shift.patch | 50 +++++++ |
11 |
media-libs/freetype/freetype-2.6.1-r1.ebuild | 163 +++++++++++++++++++++ |
12 |
2 files changed, 213 insertions(+) |
13 |
|
14 |
diff --git a/media-libs/freetype/files/freetype-2.6.1-bad-shift.patch b/media-libs/freetype/files/freetype-2.6.1-bad-shift.patch |
15 |
new file mode 100644 |
16 |
index 0000000..c361baf |
17 |
--- /dev/null |
18 |
+++ b/media-libs/freetype/files/freetype-2.6.1-bad-shift.patch |
19 |
@@ -0,0 +1,50 @@ |
20 |
+taken from upstream |
21 |
+ |
22 |
+http://savannah.nongnu.org/bugs/?func=detailitem&item_id=46118 |
23 |
+ |
24 |
+From 30fe5e762e062612fdf4b56b50d813525a5aa311 Mon Sep 17 00:00:00 2001 |
25 |
+From: Werner Lemberg <wl@×××.org> |
26 |
+Date: Sun, 4 Oct 2015 13:08:08 +0200 |
27 |
+Subject: [PATCH] [base] Replace left shifts with multiplication (#46118). |
28 |
+ |
29 |
+* src/base/ftglyph.c (ft_bitmap_glyph_bbox, FT_Get_Glyph): Do it. |
30 |
+--- |
31 |
+ ChangeLog | 6 ++++++ |
32 |
+ src/base/ftglyph.c | 14 +++++++------- |
33 |
+ 2 files changed, 13 insertions(+), 7 deletions(-) |
34 |
+ |
35 |
+diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c |
36 |
+index cb7fc37..2778743 100644 |
37 |
+--- a/src/base/ftglyph.c |
38 |
++++ b/src/base/ftglyph.c |
39 |
+@@ -125,10 +125,10 @@ |
40 |
+ FT_BitmapGlyph glyph = (FT_BitmapGlyph)bitmap_glyph; |
41 |
+ |
42 |
+ |
43 |
+- cbox->xMin = glyph->left << 6; |
44 |
+- cbox->xMax = cbox->xMin + (FT_Pos)( glyph->bitmap.width << 6 ); |
45 |
+- cbox->yMax = glyph->top << 6; |
46 |
+- cbox->yMin = cbox->yMax - (FT_Pos)( glyph->bitmap.rows << 6 ); |
47 |
++ cbox->xMin = glyph->left * 64; |
48 |
++ cbox->xMax = cbox->xMin + (FT_Pos)( glyph->bitmap.width * 64 ); |
49 |
++ cbox->yMax = glyph->top * 64; |
50 |
++ cbox->yMin = cbox->yMax - (FT_Pos)( glyph->bitmap.rows * 64 ); |
51 |
+ } |
52 |
+ |
53 |
+ |
54 |
+@@ -403,9 +403,9 @@ |
55 |
+ if ( error ) |
56 |
+ goto Exit; |
57 |
+ |
58 |
+- /* copy advance while converting it to 16.16 format */ |
59 |
+- glyph->advance.x = slot->advance.x << 10; |
60 |
+- glyph->advance.y = slot->advance.y << 10; |
61 |
++ /* copy advance while converting 26.6 to 16.16 format */ |
62 |
++ glyph->advance.x = slot->advance.x * 1024; |
63 |
++ glyph->advance.y = slot->advance.y * 1024; |
64 |
+ |
65 |
+ /* now import the image from the glyph slot */ |
66 |
+ error = clazz->glyph_init( glyph, slot ); |
67 |
+-- |
68 |
+2.5.2 |
69 |
+ |
70 |
|
71 |
diff --git a/media-libs/freetype/freetype-2.6.1-r1.ebuild b/media-libs/freetype/freetype-2.6.1-r1.ebuild |
72 |
new file mode 100644 |
73 |
index 0000000..de89f39 |
74 |
--- /dev/null |
75 |
+++ b/media-libs/freetype/freetype-2.6.1-r1.ebuild |
76 |
@@ -0,0 +1,163 @@ |
77 |
+# Copyright 1999-2015 Gentoo Foundation |
78 |
+# Distributed under the terms of the GNU General Public License v2 |
79 |
+# $Id$ |
80 |
+ |
81 |
+EAPI=5 |
82 |
+inherit autotools-multilib flag-o-matic multilib toolchain-funcs |
83 |
+ |
84 |
+INFINALITY_PATCH="03-infinality-2.6-2015.10.04.patch" |
85 |
+ |
86 |
+DESCRIPTION="A high-quality and portable font engine" |
87 |
+HOMEPAGE="http://www.freetype.org/" |
88 |
+SRC_URI="mirror://sourceforge/freetype/${P/_/}.tar.bz2 |
89 |
+ mirror://nongnu/freetype/${P/_/}.tar.bz2 |
90 |
+ utils? ( mirror://sourceforge/freetype/ft2demos-${PV}.tar.bz2 |
91 |
+ mirror://nongnu/freetype/ft2demos-${PV}.tar.bz2 ) |
92 |
+ doc? ( mirror://sourceforge/freetype/${PN}-doc-${PV}.tar.bz2 |
93 |
+ mirror://nongnu/freetype/${PN}-doc-${PV}.tar.bz2 ) |
94 |
+ infinality? ( https://dev.gentoo.org/~polynomial-c/${INFINALITY_PATCH}.xz )" |
95 |
+ |
96 |
+LICENSE="|| ( FTL GPL-2+ )" |
97 |
+SLOT="2" |
98 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~x86-interix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris ~x86-winnt" |
99 |
+IUSE="X +adobe-cff bindist bzip2 debug doc fontforge harfbuzz |
100 |
+ infinality png static-libs utils" |
101 |
+RESTRICT="!bindist? ( bindist )" # bug 541408 |
102 |
+ |
103 |
+CDEPEND=">=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] |
104 |
+ bzip2? ( >=app-arch/bzip2-1.0.6-r4[${MULTILIB_USEDEP}] ) |
105 |
+ harfbuzz? ( >=media-libs/harfbuzz-0.9.19[truetype,${MULTILIB_USEDEP}] ) |
106 |
+ png? ( >=media-libs/libpng-1.2.51:=[${MULTILIB_USEDEP}] ) |
107 |
+ utils? ( |
108 |
+ X? ( |
109 |
+ >=x11-libs/libX11-1.6.2[${MULTILIB_USEDEP}] |
110 |
+ >=x11-libs/libXau-1.0.7-r1[${MULTILIB_USEDEP}] |
111 |
+ >=x11-libs/libXdmcp-1.1.1-r1[${MULTILIB_USEDEP}] |
112 |
+ ) |
113 |
+ )" |
114 |
+DEPEND="${CDEPEND} |
115 |
+ virtual/pkgconfig" |
116 |
+RDEPEND="${CDEPEND} |
117 |
+ abi_x86_32? ( utils? ( !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)] ) )" |
118 |
+PDEPEND="infinality? ( media-libs/fontconfig-infinality )" |
119 |
+ |
120 |
+src_prepare() { |
121 |
+ enable_option() { |
122 |
+ sed -i -e "/#define $1/a #define $1" \ |
123 |
+ include/${PN}/config/ftoption.h \ |
124 |
+ || die "unable to enable option $1" |
125 |
+ } |
126 |
+ |
127 |
+ disable_option() { |
128 |
+ sed -i -e "/#define $1/ { s:^:/*:; s:$:*/: }" \ |
129 |
+ include/${PN}/config/ftoption.h \ |
130 |
+ || die "unable to disable option $1" |
131 |
+ } |
132 |
+ |
133 |
+ # This is the same as the 01 patch from infinality |
134 |
+ epatch "${FILESDIR}"/${PN}-2.3.2-enable-valid.patch |
135 |
+ |
136 |
+ if use infinality; then |
137 |
+ epatch "${WORKDIR}/${INFINALITY_PATCH}" |
138 |
+ |
139 |
+ # FT_CONFIG_OPTION_SUBPIXEL_RENDERING is already enabled in freetype-2.4.11 |
140 |
+ enable_option TT_CONFIG_OPTION_SUBPIXEL_HINTING |
141 |
+ fi |
142 |
+ |
143 |
+ if ! use bindist; then |
144 |
+ # See http://freetype.org/patents.html |
145 |
+ # ClearType is covered by several Microsoft patents in the US |
146 |
+ enable_option FT_CONFIG_OPTION_SUBPIXEL_RENDERING |
147 |
+ fi |
148 |
+ |
149 |
+ if ! use adobe-cff; then |
150 |
+ enable_option CFF_CONFIG_OPTION_OLD_ENGINE |
151 |
+ fi |
152 |
+ |
153 |
+ if use debug; then |
154 |
+ enable_option FT_DEBUG_LEVEL_TRACE |
155 |
+ enable_option FT_DEBUG_MEMORY |
156 |
+ fi |
157 |
+ |
158 |
+ epatch "${FILESDIR}"/${PN}-2.4.11-sizeof-types.patch # 459966 |
159 |
+ epatch "${FILESDIR}"/${PN}-2.6.1-bad-shift.patch |
160 |
+ |
161 |
+ if use utils; then |
162 |
+ cd "${WORKDIR}/ft2demos-${PV}" || die |
163 |
+ # Disable tests needing X11 when USE="-X". (bug #177597) |
164 |
+ if ! use X; then |
165 |
+ sed -i -e "/EXES\ +=\ ftdiff/ s:^:#:" Makefile || die |
166 |
+ fi |
167 |
+ cd "${S}" || die |
168 |
+ fi |
169 |
+ |
170 |
+ # we need non-/bin/sh to run configure |
171 |
+ if [[ -n ${CONFIG_SHELL} ]] ; then |
172 |
+ sed -i -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" \ |
173 |
+ "${S}"/builds/unix/configure || die |
174 |
+ fi |
175 |
+ |
176 |
+ autotools-utils_src_prepare |
177 |
+} |
178 |
+ |
179 |
+multilib_src_configure() { |
180 |
+ append-flags -fno-strict-aliasing |
181 |
+ type -P gmake &> /dev/null && export GNUMAKE=gmake |
182 |
+ |
183 |
+ local myeconfargs=( |
184 |
+ --enable-biarch-config |
185 |
+ $(use_with bzip2) |
186 |
+ $(use_with harfbuzz) |
187 |
+ $(use_with png) |
188 |
+ |
189 |
+ # avoid using libpng-config |
190 |
+ LIBPNG_CFLAGS="$($(tc-getPKG_CONFIG) --cflags libpng)" |
191 |
+ LIBPNG_LDFLAGS="$($(tc-getPKG_CONFIG) --libs libpng)" |
192 |
+ ) |
193 |
+ |
194 |
+ autotools-utils_src_configure |
195 |
+} |
196 |
+ |
197 |
+multilib_src_compile() { |
198 |
+ default |
199 |
+ |
200 |
+ if multilib_is_native_abi && use utils; then |
201 |
+ einfo "Building utils" |
202 |
+ # fix for Prefix, bug #339334 |
203 |
+ emake \ |
204 |
+ X11_PATH="${EPREFIX}/usr/$(get_libdir)" \ |
205 |
+ FT2DEMOS=1 TOP_DIR_2="${WORKDIR}/ft2demos-${PV}" |
206 |
+ fi |
207 |
+} |
208 |
+ |
209 |
+multilib_src_install() { |
210 |
+ default |
211 |
+ |
212 |
+ if multilib_is_native_abi && use utils; then |
213 |
+ einfo "Installing utils" |
214 |
+ rm "${WORKDIR}"/ft2demos-${PV}/bin/README || die |
215 |
+ local ft2demo |
216 |
+ for ft2demo in ../ft2demos-${PV}/bin/*; do |
217 |
+ ./libtool --mode=install $(type -P install) -m 755 "$ft2demo" \ |
218 |
+ "${ED}"/usr/bin || die |
219 |
+ done |
220 |
+ fi |
221 |
+} |
222 |
+ |
223 |
+multilib_src_install_all() { |
224 |
+ if use fontforge; then |
225 |
+ # Probably fontforge needs less but this way makes things simplier... |
226 |
+ einfo "Installing internal headers required for fontforge" |
227 |
+ local header |
228 |
+ find src/truetype include/internal -name '*.h' | \ |
229 |
+ while read header; do |
230 |
+ mkdir -p "${ED}/usr/include/freetype2/internal4fontforge/$(dirname ${header})" || die |
231 |
+ cp ${header} "${ED}/usr/include/freetype2/internal4fontforge/$(dirname ${header})" || die |
232 |
+ done |
233 |
+ fi |
234 |
+ |
235 |
+ dodoc docs/{CHANGES,CUSTOMIZE,DEBUG,INSTALL.UNIX,*.txt,PROBLEMS,TODO} |
236 |
+ use doc && dohtml -r docs/* |
237 |
+ |
238 |
+ prune_libtool_files --all |
239 |
+} |