[weasel-commit] Source: freetype=2.3.9-2

  • From: rbuilder@xxxxxxxxx
  • To: weasel-commit@xxxxxxxxxxxxx
  • Date: Thu, 07 Jan 2010 12:44:28 -0500

================================
freetype:source=2.3.9-2 (previous: 2.3.9-1)
cvc rdiff freetype -1 /weasel.rpath.org@wgl:3-devel/2.3.9-2
================================
2.3.9-2 Filip Brcic (brcha@xxxxxxx) Thu Jan  7 12:44:21 2010
    fixed recipe + added metadata

freetype.recipe: changed
Index: freetype.recipe
====================================================================
contents(size sha1)
inode(mtime)
--- freetype.recipe /weasel.rpath.org@wgl:3-devel/2.3.9-1
+++ freetype.recipe /weasel.rpath.org@wgl:3-devel/2.3.9-2
@@ -1,101 +1,85 @@
 #
-# Copyright (c) 2004-2008 rPath, Inc.
-# This file is distributed under the terms of the MIT License.
-# A copy is available at http://www.rpath.com/permanent/mit-license.html
+# Copyright (c) 2010 Filip Brcic <brcha@xxxxxxx>
+# Distributed under the terms of the GNU General Public License v3
 #
 
-loadSuperClass('rpmpackage')
-class Freetype(RPMPackageRecipe, AutoPackageRecipe):
+class Freetype(AutoPackageRecipe):
     name = 'freetype'
     version = '2.3.9'
 
-    buildRequires = [ 'libX11:devel', 'zlib:devel' ]
+    buildRequires = [
+        'libX11:devel', 'libXau:devel', 'libXdmcp:devel',
+        'libxcb:devel', 'zlib:devel'
+        ]
 
-    rpmRelease = '4.fc12'
-    rpmPatches = [
-        # Enable otvalid and gxvalid modules
-        'freetype-2.2.1-enable-valid.patch',
-        # Fix multilib conflicts
-        'freetype-multilib.patch',
-    ]
+    shortDesc  = 'A high-quality and portable font engine'
+    longDesc   = """
+FreeType 2 is a software font engine that is designed to be small,
+efficient, highly customizable, and portable while capable of
+producing high-quality output (glyph images). It can be used in
+graphics libraries, display servers, font conversion tools, text image
+generation tools, and many other products as well.
+"""
+    url        = 'http://www.freetype.org/'
+    licenses   = [ 'FTL', 'GPL-2' ]
+    categories = [ 'Media/Libraries' ]
 
-    if Arch.x86_64:
-        buildRequires.extend(['multiarch_wrapper:runtime'])
+    def enableOption(r, opt):
+        r.Run('sed -i -e "/#define %s/a #define %s" 
include/freetype/config/ftoption.h'
+              % (opt, opt))
 
-    # If you have a license from Apple, you can turn this on and rebuild
-    with_bytecode_interp = True
-    with_subpixel_rendering = True
-
-    if with_bytecode_interp:
-        rpmPatches.append('freetype-2.1.10-enable-ft2-bci.patch')
-    if with_subpixel_rendering:
-        rpmPatches.append('freetype-2.3.0-enable-spr.patch')
+    def disableOption(r, opt):
+        r.Run('sed -i -e "/#define %s/ { s:^:/*:; s:$:*/: }" 
include/freetype/config/ftoption.h'
+              % opt)
 
     def unpack(r):
+        r.addArchive('mirror://sourceforge/freetype/')
+        
r.addArchive('mirror://sourceforge/freetype/ft2demos-%(version)s.tar.bz2')
+        
r.addArchive('mirror://sourceforge/freetype/%(name)s-doc-%(version)s.tar.bz2')
 
-        r.macros.site = 'mirror://sourceforge/%(name)s'
+        r.enableOption('FT_CONFIG_OPTION_SUBPIXEL_RENDERING')
+        r.enableOption('TT_CONFIG_OPTION_BYTECODE_INTERPRETER')
+        r.disableOption('TT_CONFIG_OPTION_UNPATENTED_HINTING')
+        r.enableOption('FT_CONFIG_OPTION_INCREMENTAL')
+        r.disableOption('FT_CONFIG_OPTION_OLD_INTERNALS')
 
-        r.addArchive('%(site)s/')
-        r.addArchive('%(site)s/freetype-doc-%(version)s.tar.bz2')
-        r.addArchive('%(site)s/ft2demos-%(version)s.tar.bz2', dir=r.theMainDir)
-        r.addSource('ftconfig-multilib.h')
+        r.addPatch('freetype-2.3.2-enable-valid.patch')
+        r.addPatch('freetype-2.3.9-CVE-2009-0946.patch')
 
-        for patch in r.rpmPatches:
-            r.addPatch(patch, rpm=r.srpm)
+        r.Replace('\.\./freetype2$', '../freetype-%(version)s',
+                  '../ft2demos-%(version)s/Makefile')
 
-        # Add -lm when linking X demos
-        r.addPatch('ft2demos-2.1.9-mathlib.patch',
-                   dir='ft2demos-%(version)s', rpm=r.srpm)
-
-        # https://bugs.freedesktop.org/show_bug.cgi?id=6841
-        
r.addPatch('https://bugs.freedesktop.org/attachment.cgi?id=6893&action=view')
-
-        if Arch.x86_64:
-            # First build 32bit libs
-            macros32 = r.macros.copy()
-            macros32.cc = '"gcc -m32"'
-            macros32.cxx = '"g++ -m32"'
-            macros32.libdir = '%(prefix)s/lib'
-            r.Configure(objDir='build32', overrideMacros=macros32)
-            r.Make(dir='build32', overrideMacros=macros32)
-            r.MakeInstall(dir='build32', overrideMacros=macros32)
-            r.Move('%(bindir)s/freetype-config', 
'%(bindir)s/freetype-config-32')
-            r.ComponentSpec('devel', '%(bindir)s/freetype-config-32')
-            r.Move('%(includedir)s/freetype2/freetype/config/ftconfig.h',
-                   '%(includedir)s/freetype2/freetype/config/ftconfig-32.h')
-            r.NormalizePkgConfig(exceptions='.*')
+        r.macros.cflags += ' -fno-strict-aliasing'
 
     def make(r):
-
         r.Make()
-
-        # Make demos
-        r.Make('TOP_DIR=".."', dir='ft2demos-%(version)s')
+        r.Make(dir='../ft2demos-%(version)s')
 
     def makeinstall(r):
-
         r.MakeInstall()
 
-        # Install demos
-        demos = (
-            # X11
-            'ftgamma', 'ftmulti', 'ftstring', 'fttimer', 'ftview',
-            # Console
-            'ftbench', 'ftchkwd', 'ftdump', 'ftlint', 'ftmemchk', 'ftvalid',
-        )
-        for ftdemo in demos:
-            r.Run('builds/unix/libtool --mode=install install -m 755 '
-                    'ft2demos-%(version)s/bin/'+ftdemo+' 
%(destdir)s/%(bindir)s/')
+        r.Doc('docs/{CHANGES,CUSTOMIZE,DEBUG,*.txt,PATENTS,TODO}')
+        r.Doc('docs/*.html', dir='html')
+        r.Doc('docs/reference', dir='html')
+        r.Doc('docs/tutorial', dir='html')
+        r.Doc('docs/design', dir='html')
+        r.Doc('docs/glyphs', dir='html')
 
-        if Arch.x86_64:
-            r.Move('%(includedir)s/freetype2/freetype/config/ftconfig.h',
-                   '%(includedir)s/freetype2/freetype/config/ftconfig-64.h')
-            
-            r.Install('ftconfig-multilib.h',
-                      '%(includedir)s/freetype2/freetype/config/ftconfig.h',
-                      component='devellib')
+       # Install demos
+        r.Remove('../ft2demos-%(version)s/bin/README')
+       r.Run("""
+for ft2demo in ../ft2demos-%(version)s/bin/*
+do
+   ./builds/unix/libtool --mode=install $(type -P install) -m 755 ${ft2demo} \
+                         %(destdir)s/%(bindir)s
+done
+""")
 
-            r.Move('%(bindir)s/freetype-config', 
'%(bindir)s/freetype-config-64')
-            r.ComponentSpec('devel', '%(bindir)s/freetype-config-64')
-            r.Symlink('%(bindir)s/multiarch_wrapper', 
'%(bindir)s/freetype-config')
-            r.DanglingSymlinks('%(bindir)s/freetype-config')
+        # Install internal includes to be used by fontforge at some time
+        r.Run("""
+for h in $(find src/truetype include/freetype/internal -name '*.h')
+do
+   mkdir -p %(destdir)s/%(includedir)s/freetype2/internal4fontforge/$(dirname 
${h})
+   cp ${h} %(destdir)s/%(includedir)s/freetype2/internal4fontforge/$(dirname 
${h})/
+done
+""")


freetype-2.3.2-enable-valid.patch: new
--- /dev/null
+++ freetype-2.3.2-enable-valid.patch
@@ -0,0 +22 @@
+Enables gxvalid and otvalid modules for use with ftvalid.
+
+--- freetype-2.2.1/modules.cfg.orig    2006-07-07 21:01:09.000000000 -0400
++++ freetype-2.2.1/modules.cfg 2006-07-07 21:01:54.000000000 -0400
+@@ -110,7 +110,7 @@
+ AUX_MODULES += cache
+ 
+ # TrueType GX/AAT table validation.  Needs ftgxval.c below.
+-# AUX_MODULES += gxvalid
++AUX_MODULES += gxvalid
+ 
+ # Support for streams compressed with gzip (files with suffix .gz).
+ #
+@@ -124,7 +124,7 @@
+ 
+ # OpenType table validation.  Needs ftotval.c below.
+ #
+-# AUX_MODULES += otvalid
++AUX_MODULES += otvalid
+ 
+ # Auxiliary PostScript driver component to share common code.
+ #

freetype-2.3.9-CVE-2009-0946.patch: new
--- /dev/null
+++ freetype-2.3.9-CVE-2009-0946.patch
@@ -0,0 +136 @@
+http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-0946
+https://bugzilla.redhat.com/show_bug.cgi?id=491384
+https://bugs.gentoo.org/show_bug.cgi?id=263032
+
+--- freetype-2.3.9-orig/src/cff/cffload.c
++++ freetype-2.3.9/src/cff/cffload.c
+@@ -842,7 +842,20 @@
+             goto Exit;
+ 
+           for ( j = 1; j < num_glyphs; j++ )
+-            charset->sids[j] = FT_GET_USHORT();
++          {
++            FT_UShort sid = FT_GET_USHORT();
++
++
++            /* this constant is given in the CFF specification */
++            if ( sid < 65000 )
++              charset->sids[j] = sid;
++            else
++            {
++              FT_ERROR(( "cff_charset_load:"
++                         " invalid SID value %d set to zero\n", sid ));
++              charset->sids[j] = 0;
++            }
++          }
+ 
+           FT_FRAME_EXIT();
+         }
+@@ -875,6 +888,20 @@
+                 goto Exit;
+             }
+ 
++            /* check whether the range contains at least one valid glyph; */
++            /* the constant is given in the CFF specification             */
++            if ( glyph_sid >= 65000 ) {
++              FT_ERROR(( "cff_charset_load: invalid SID range\n" ));
++              error = CFF_Err_Invalid_File_Format;
++              goto Exit;
++            }
++
++            /* try to rescue some of the SIDs if `nleft' is too large */
++            if ( nleft > 65000 - 1 || glyph_sid >= 65000 - nleft ) {
++              FT_ERROR(( "cff_charset_load: invalid SID range trimmed\n" ));
++              nleft = 65000 - 1 - glyph_sid;
++            }
++
+             /* Fill in the range of sids -- `nleft + 1' glyphs. */
+             for ( i = 0; j < num_glyphs && i <= nleft; i++, j++, glyph_sid++ )
+               charset->sids[j] = glyph_sid;
+--- freetype-2.3.9-orig/src/lzw/ftzopen.c
++++ freetype-2.3.9/src/lzw/ftzopen.c
+@@ -332,6 +332,9 @@
+ 
+           while ( code >= 256U )
+           {
++            if ( !state->prefix )
++              goto Eof;
++
+             FTLZW_STACK_PUSH( state->suffix[code - 256] );
+             code = state->prefix[code - 256];
+           }
+--- freetype-2.3.9-orig/src/sfnt/ttcmap.c
++++ freetype-2.3.9/src/sfnt/ttcmap.c
+@@ -1635,7 +1635,7 @@
+       FT_INVALID_TOO_SHORT;
+ 
+     length = TT_NEXT_ULONG( p );
+-    if ( table + length > valid->limit || length < 8208 )
++    if ( length > (FT_UInt32)( valid->limit - table ) || length < 8192 + 16 )
+       FT_INVALID_TOO_SHORT;
+ 
+     is32       = table + 12;
+@@ -1863,7 +1863,8 @@
+     p      = table + 16;
+     count  = TT_NEXT_ULONG( p );
+ 
+-    if ( table + length > valid->limit || length < 20 + count * 2 )
++    if ( length > (FT_ULong)( valid->limit - table ) ||
++         length < 20 + count * 2                     )
+       FT_INVALID_TOO_SHORT;
+ 
+     /* check glyph indices */
+@@ -2048,7 +2049,8 @@
+     p          = table + 12;
+     num_groups = TT_NEXT_ULONG( p );
+ 
+-    if ( table + length > valid->limit || length < 16 + 12 * num_groups )
++    if ( length > (FT_ULong)( valid->limit - table ) ||
++         length < 16 + 12 * num_groups               )
+       FT_INVALID_TOO_SHORT;
+ 
+     /* check groups, they must be in increasing order */
+@@ -2429,7 +2431,8 @@
+     FT_ULong  num_selectors = TT_NEXT_ULONG( p );
+ 
+ 
+-    if ( table + length > valid->limit || length < 10 + 11 * num_selectors )
++    if ( length > (FT_ULong)( valid->limit - table ) ||
++         length < 10 + 11 * num_selectors            )
+       FT_INVALID_TOO_SHORT;
+ 
+     /* check selectors, they must be in increasing order */
+@@ -2491,7 +2494,7 @@
+           FT_ULong  i, lastUni = 0;
+ 
+ 
+-          if ( ndp + numMappings * 4 > valid->limit )
++          if ( numMappings * 4 > (FT_ULong)( valid->limit - ndp ) )
+             FT_INVALID_TOO_SHORT;
+ 
+           for ( i = 0; i < numMappings; ++i )
+--- freetype-2.3.9-orig/src/smooth/ftsmooth.c
++++ freetype-2.3.9/src/smooth/ftsmooth.c
+@@ -153,7 +153,7 @@
+       slot->internal->flags &= ~FT_GLYPH_OWN_BITMAP;
+     }
+ 
+-    /* allocate new one, depends on pixel format */
++    /* allocate new one */
+     pitch = width;
+     if ( hmul )
+     {
+@@ -194,6 +194,13 @@
+ 
+ #endif
+ 
++    if ( pitch > 0xFFFF || height > 0xFFFF )
++    {
++      FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n",
++                 width, height ));
++      return Smooth_Err_Raster_Overflow;
++    }
++
+     bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
+     bitmap->num_grays  = 256;
+     bitmap->width      = width;

freetype-multilib.patch: removed
freetype-2.1.10-enable-ft2-bci.patch: removed
freetype-2.3.0-enable-spr.patch: removed
ftconfig-multilib.h: removed
freetype-2.2.1-enable-valid.patch: removed
attachment.cgi?id=6893&action=view: removed
ft2demos-2.1.9-mathlib.patch: removed

Committed by: brcha

Other related posts: