View | Details | Raw Unified | Return to bug 100520
Collapse All | Expand All

(-)/work/src/ports/ttmkfdir/Makefile (-7 / +6 lines)
Lines 6-30 Link Here
6
#
6
#
7
7
8
PORTNAME=	ttmkfdir
8
PORTNAME=	ttmkfdir
9
PORTVERSION=	20021109
9
PORTVERSION=	3.0.9
10
PORTREVISION=	1
10
PORTREVISION=	0
11
PORTEPOCH=	1
11
CATEGORIES=	x11-fonts x11
12
CATEGORIES=	x11-fonts x11
12
MASTER_SITES=	http://people.redhat.com/yshao/
13
MASTER_SITES=	http://mbsd.msk.ru/dist/
13
DISTNAME=	${PORTNAME}2
14
14
15
MAINTAINER=	ports@FreeBSD.org
15
MAINTAINER=	ssedov@mbsd.msk.ru
16
COMMENT=	Create fonts.scale file for use with TrueType font server
16
COMMENT=	Create fonts.scale file for use with TrueType font server
17
17
18
LIB_DEPENDS=	freetype.9:${PORTSDIR}/print/freetype2
18
LIB_DEPENDS=	freetype.9:${PORTSDIR}/print/freetype2
19
19
20
USE_AUTOTOOLS=	libtool:15:env
21
PLIST_FILES=	bin/ttmkfdir
20
PLIST_FILES=	bin/ttmkfdir
22
USE_BZIP2=	yes
21
USE_BZIP2=	yes
23
USE_GMAKE=	yes
22
USE_GMAKE=	yes
24
USE_GETOPT_LONG=yes
23
USE_GETOPT_LONG=yes
25
USE_X_PREFIX=	yes
24
USE_X_PREFIX=	yes
26
25
27
MAKE_ENV=	LDFLAGS="${LDFLAGS}" CXX="${CXX}"
26
MAKE_ENV=	LDFLAGS="${LDFLAGS}" CXXFLAGS="${CFLAGS}" CXX="${CXX}"
28
27
29
do-install:
28
do-install:
30
	${INSTALL_PROGRAM} ${WRKSRC}/ttmkfdir ${PREFIX}/bin
29
	${INSTALL_PROGRAM} ${WRKSRC}/ttmkfdir ${PREFIX}/bin
(-)/work/src/ports/ttmkfdir/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
MD5 (ttmkfdir2.tar.bz2) = 61efb004b19befdb5335ef058323002c
1
MD5 (ttmkfdir-3.0.9.tar.bz2) = 7fbf13e432aa519669899b13d00673f3
2
SHA256 (ttmkfdir2.tar.bz2) = dffa28ad5326ed6903146f7631facb42a0871fc7301785e44f3811bccbc84faa
2
SHA256 (ttmkfdir-3.0.9.tar.bz2) = c65f8e2ba5522c896df2eb7256852bf0a5855109deec0f874379474ef76c1c1c
3
SIZE (ttmkfdir2.tar.bz2) = 16650
3
SIZE (ttmkfdir-3.0.9.tar.bz2) = 20160
(-)/work/src/ports/ttmkfdir/files/patch-Makefile (-15 / +33 lines)
Lines 1-23 Link Here
1
--- Makefile.orig	Thu Mar 14 14:03:49 2002
1
--- Makefile.orig	Mon Dec  9 19:07:14 2002
2
+++ Makefile	Sun Jan 22 20:15:17 2006
2
+++ Makefile	Wed Jul 19 11:35:12 2006
3
@@ -1,10 +1,7 @@
3
@@ -16,7 +16,6 @@
4
-FREETYPE_BASE=/usr/include/freetype2
4
 RELEASE=$(shell rpm -q --qf "%{release}\n" --specfile $(NAME).spec | head -1)
5
-FREETYPE_INCL=-I$(FREETYPE_BASE)/.
5
 
6
-FREETYPE_LIB=/usr/lib/libfreetype.so
6
 CVSTAG = r$(subst .,_,$(VERSION))
7
-
7
-CVSROOT = $(shell cat CVS/Root)
8
 
9
 # Autodetec the proper command used to build RPM packages
10
 RPMBUILD=$(shell [ -x /usr/bin/rpmbuild ] && echo rpmbuild || echo rpm)
11
@@ -24,11 +23,8 @@
12
 FREETYPE_INCL=$(shell freetype-config --cflags)
13
 FREETYPE_LIB=$(shell freetype-config --libs)
14
 
15
-OPTFLAGS=
8
-DEBUG=-ggdb
16
-DEBUG=-ggdb
9
-CXX=g++
17
-CXX=g++
10
-CXXFLAGS=-Wall -pedantic $(FREETYPE_INCL) $(DEBUG)
18
-CXXFLAGS=-Wall -pedantic $(FREETYPE_INCL) $(DEBUG) $(OPTFLAGS)
11
+FREETYPE_INCL=`freetype-config --cflags`
12
+FREETYPE_LIB=`freetype-config --libs`
13
 
14
-LDFLAGS=$(FREETYPE_LIB) $(DEBUG)
19
-LDFLAGS=$(FREETYPE_LIB) $(DEBUG)
15
+CXXFLAGS+=$(FREETYPE_INCL)
20
+CXXFLAGS+=-Wall $(FREETYPE_INCL)
16
+
21
+LDFLAGS+=$(FREETYPE_LIB) -lz
17
+LDFLAGS+=$(FREETYPE_LIB)
22
 
23
 DESTDIR=
24
 PREFIX=/usr
25
@@ -39,13 +35,13 @@
26
 all: ttmkfdir
27
 
28
 .cpp.o:
29
-	libtool --mode=compile $(CXX) $(CXXFLAGS) -o $@ -c $^
30
+	$(CXX) $(CXXFLAGS) -o $@ -c $^
31
 
32
 ttmkfdir: ttmkfdir.o directory.o commandline.o ttf.o encoding.o parser.o builtin.o
33
-	libtool --mode=link $(CXX) -o $@ $^ $(LDFLAGS)
34
+	$(CXX) -o $@ $^ $(LDFLAGS)
18
 
35
 
19
@@ -21,3 +18,3 @@
20
 parser.cpp: encoding.l
36
 parser.cpp: encoding.l
21
-	    flex -i -8 -o$@ $<
37
-	    flex -i -8 -o$@ $<
22
+	    lex -i -8 -o$@ $<
38
+	    lex -i -8 -o$@ $<
23
 
39
 
40
 install:
41
 	mkdir -p $(DESTDIR)$(BINDIR)
(-)/work/src/ports/ttmkfdir/files/patch-builtin.cpp (+11 lines)
Line 0 Link Here
1
--- builtin.cpp.orig	Mon Jan 13 04:11:10 2003
2
+++ builtin.cpp	Wed Jul 19 11:27:41 2006
3
@@ -600,7 +600,7 @@
4
 	0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff
5
     };
6
 
7
-};
8
+}
9
 
10
 Encoding::BuiltinEncoding_t Encoding::builtin_encodings[] = {
11
     {256,191,32,{TT_PLATFORM_MICROSOFT,TT_MS_ID_UNICODE_CS,iso8859_1},{"iso8859-1",}},
(-)/work/src/ports/ttmkfdir/files/patch-directory.cpp (+46 lines)
Line 0 Link Here
1
--- directory.cpp.orig	Mon Dec  9 11:29:11 2002
2
+++ directory.cpp	Wed Jul 19 11:41:32 2006
3
@@ -1,7 +1,9 @@
4
 #include <cctype>
5
 #include <dirent.h>
6
+#include <sys/types.h>
7
 #include <sys/stat.h>
8
 #include <unistd.h>
9
+#include <fcntl.h>
10
 
11
 #include "directory.h"
12
 
13
@@ -37,19 +39,24 @@
14
 bool
15
 ttfdirectory::select (const char *name) const
16
 {
17
-    int len;
18
+    int fd;
19
+    unsigned int n;
20
     struct stat buf;
21
+    char sigdata[8];
22
+    char TTsig[] = "\000\001\000\000\000", OTsig[] = "OTTO";
23
 
24
     /* must be a regular file */
25
     if (::stat (name, &buf) || !(S_ISREG (buf.st_mode))) {
26
 	return false;
27
     }
28
-    
29
-    /* we make the decision by the extension of the file name */
30
-    return (((len = strlen (name)) > 4) &&
31
-	    (name[len - 4] == '.') &&
32
-	    (std::toupper(name[len - 3]) == 'T') &&
33
-	    (std::toupper(name[len - 2]) == 'T') &&
34
-	    ((std::toupper(name[len - 1]) == 'F') ||
35
-	     (std::toupper(name[len - 1]) == 'C')));
36
+
37
+    fd = ::open(name, O_RDONLY);
38
+    if (fd < 0) return false;
39
+    n = read(fd, sigdata, sizeof(sigdata));
40
+    close(fd);
41
+    if (n < sizeof(sigdata))
42
+       return false;
43
+                                                                               
44
+    return (!memcmp(sigdata, TTsig, 5)
45
+           || !memcmp(sigdata, OTsig, 4));
46
 }
(-)/work/src/ports/ttmkfdir/files/patch-encoding.cpp (-3 / +71 lines)
Lines 1-11 Link Here
1
--- encoding.cpp.orig	Tue Mar 12 15:40:09 2002
1
--- encoding.cpp.orig	Wed Jul 19 11:30:05 2006
2
+++ encoding.cpp	Sun Mar 21 22:33:00 2004
2
+++ encoding.cpp	Wed Jul 19 11:30:28 2006
3
@@ -2,7 +2,7 @@
3
@@ -2,7 +2,9 @@
4
 #include <cstdio>
4
 #include <cstdio>
5
 #include <cstdlib>
5
 #include <cstdlib>
6
 #include <cstring>
6
 #include <cstring>
7
-#include "freetype/freetype.h"
7
-#include "freetype/freetype.h"
8
+#include <unistd.h>                                                            
9
+#include <zlib.h>
8
+#include <ft2build.h>
10
+#include <ft2build.h>
9
 
11
 
10
 #include "ttmkfdir.h"
12
 #include "ttmkfdir.h"
11
 #include "encoding.h"
13
 #include "encoding.h"
14
@@ -32,9 +34,16 @@
15
     NextFile (FILE *f, char *name)
16
     {
17
 	char file_name [1024];
18
-	char command[1024];
19
+	char line_buf [1024];
20
+	char tmp_file_name[] = "/tmp/ttmkfdir_XXXXXX";
21
+	char inbuf[300000];
22
+	FILE *od;
23
+	gzFile fd;
24
+	int rvalue, tmpfd;
25
 
26
-	if (fscanf (f, "%*s %[^\n]\n", file_name) == 1) {
27
+	if (fgets (line_buf, sizeof(line_buf), f) != NULL) {
28
+
29
+	    sscanf (line_buf, "%*s %[^\n]\n", file_name);
30
 
31
 	    if (file_name[0] == '/') {
32
 		name[0] = 0;
33
@@ -44,9 +53,25 @@
34
 	
35
 	    strcat (name, file_name);
36
 
37
-	    sprintf (command, "exec %s < %s", (toupper(name[strlen (name) - 1]) == 'Z')
38
-		     ? "gzip -d" : "cat", name);
39
-	    return popen (command, "r");
40
+	    bzero(inbuf, sizeof(inbuf));
41
+
42
+	    fd = gzopen (name,"rb");
43
+	    rvalue = gzread (fd, inbuf, sizeof(inbuf));
44
+
45
+	    tmpfd = mkstemp (tmp_file_name);
46
+	    if (tmpfd == -1) {
47
+		return 0;
48
+	    }
49
+
50
+	    od = fdopen (tmpfd,"w");
51
+	    fputs (inbuf, od);
52
+	    fflush (od);
53
+	    fclose (od);
54
+
55
+	    od = fopen (tmp_file_name,"r");
56
+	    unlink (tmp_file_name);
57
+	    return od;
58
+
59
 	}
60
 
61
 	return 0;
62
@@ -75,7 +100,7 @@
63
 	yyrestart (input);
64
 	yylex (name, *this);
65
 
66
-	pclose (input);
67
+	fclose (input);
68
     }
69
 
70
     fclose (f);
71
@@ -97,7 +122,7 @@
72
 
73
     NumericMapping *m = new NumericMapping (size, b->mapdata.platform, b->mapdata.encoding);
74
 
75
-    for (int i = 0; i < size; i++)
76
+    for (unsigned int i = 0; i < size; i++)
77
 	(*m)[i] = b->mapdata.mappingtable[i];
78
 
79
     AddMapping (m);
(-)/work/src/ports/ttmkfdir/files/patch-encoding.l (+44 lines)
Line 0 Link Here
1
--- encoding.l.orig	Wed Jul 19 11:39:18 2006
2
+++ encoding.l	Wed Jul 19 11:39:22 2006
3
@@ -8,7 +8,7 @@
4
 #include "ttmkfdir.h"    
5
 #include "encoding.h"    
6
 
7
-#define DEFAULT_SIZE 0x100 /* 8 bit encoding */
8
+#define DEFAULT_SIZE 0xFFFF /* 8 bit encoding */
9
 #define YY_DECL int yylex (char *current_file, Encodings_t &dest)
10
 
11
 static unsigned int line_number = 1;
12
@@ -43,6 +43,7 @@
13
 STARTENCODING{WHITESPACES}{STRING} {
14
     cur_enc = new Encoding;
15
     cur_enc->names.push_back (strip_first (yytext));
16
+    cur_enc->size = DEFAULT_SIZE;
17
     BEGIN(INSIDE_ENC_BLOCK);
18
 }
19
 
20
@@ -97,6 +98,7 @@
21
 <INSIDE_MAP_BLOCK>UNDEFINE{WHITESPACES}{NUMBER}({WHITESPACES}{NUMBER})? {
22
     char *startptr = strip_first (yytext);
23
     char *endptr;
24
+    long msize = cur_map->size();
25
 
26
     int i1 = std::strtol (startptr, &endptr, 0);
27
     startptr = endptr;
28
@@ -108,13 +110,14 @@
29
     }
30
     
31
     /* now mark all the unassigned codes */
32
-    for (long i = i1; i <= i2; i++) {
33
+    for (long i = i1; i <= i2 && i < msize; i++) {
34
 	(*cur_map)[i] = -1;
35
     }
36
 }
37
 
38
 <INSIDE_MAP_BLOCK>{NUMBER}({WHITESPACES}{NUMBER}){0,2} {
39
-    int numbers[3], i = 0, start_range, end_range, target, res;
40
+    int numbers[3], target, res;
41
+    unsigned int i = 0, start_range, end_range;
42
     char *startptr;
43
     char *endptr = yytext;
44
 
(-)/work/src/ports/ttmkfdir/files/patch-ttf.cpp (+46 lines)
Line 0 Link Here
1
--- ttf.cpp.orig	Wed Jul 19 11:13:20 2006
2
+++ ttf.cpp	Wed Jul 19 11:22:41 2006
3
@@ -51,20 +51,27 @@
4
 bool
5
 Face::MappingPresent (int cmapidx, NumericMapping *m, int enc_size, int start_code, bool enc_comp)
6
 {
7
-    int idx, missing = 0;
8
+    int idx;
9
+    unsigned int missing = 0, bail_at, msize;
10
+
11
     FT_Set_Charmap (face, face->charmaps[cmapidx]);
12
 
13
-    for (unsigned int i = start_code; i < m->size (); i++) {
14
+    msize = m->size();
15
+    if (enc_size <= 256) {
16
+       bail_at = int (cmdline::instance()->option ("max-missing"));
17
+    } else {
18
+       bail_at = ((int (cmdline::instance()->option ("max-missing-percentage"))
19
+& enc_comp)*enc_size)/100;
20
+    }
21
+
22
+    for (unsigned int i = start_code; i < msize && missing < bail_at; i++) {
23
 	if ((*m)[i] < 0) 
24
 	    continue;
25
 	if ((idx = FT_Get_Char_Index (face, (*m)[i])) == 0)
26
 	    missing++;
27
     }
28
-    if (enc_size <= 256) {
29
-        return (missing <= int (cmdline::instance()->option ("max-missing")));
30
-    } else {
31
-        return ((100 * missing/enc_size) <= int (cmdline::instance()->option ("max-missing-percentage")) & enc_comp);
32
-    }
33
+
34
+    return missing < bail_at;
35
 }
36
 
37
 Face::Face (const std::string &filename)
38
@@ -239,7 +246,7 @@
39
 	for (i = 0; i < n; i++) {
40
 	    if ((fterror = FT_Get_Sfnt_Name (face, i, &NamePtr)) != FT_Err_Ok) {
41
                     std::cout << "Warning: Can't SFNT name : " << FileName << "(" << fterror << ")" << std::endl;
42
-	            return;
43
+	            return NULL;
44
             };
45
             platform = NamePtr.platform_id;
46
             encoding = NamePtr.encoding_id;
(-)/work/src/ports/ttmkfdir/files/patch-ttf.h (-5 / +15 lines)
Lines 1-6 Link Here
1
--- ttf.h.orig	Wed Mar 13 19:16:38 2002
1
--- ttf.h.orig	Wed Jul 19 11:36:47 2006
2
+++ ttf.h	Sun Mar 21 22:30:16 2004
2
+++ ttf.h	Wed Jul 19 11:36:50 2006
3
@@ -3,15 +3,18 @@
3
@@ -3,16 +3,19 @@
4
 #define TTF_H__
4
 #define TTF_H__
5
 
5
 
6
 #include <string>
6
 #include <string>
Lines 20-27 Link Here
20
 
20
 
21
 #include "util.h"
21
 #include "util.h"
22
 #include "encoding.h"
22
 #include "encoding.h"
23
+
24
+using namespace std;
25
 
23
 
24
+using namespace std;
25
+
26
 namespace ttf {
26
 namespace ttf {
27
 
28
     class Face {
29
@@ -49,7 +52,7 @@
30
 	TT_Postscript	    *post;
31
 	std::string	    FileName;
32
     };
33
-};
34
+}
35
 
36
 #endif /* TTF_H__ */
27
 
37
 
(-)/work/src/ports/ttmkfdir/files/patch-util.h (+10 lines)
Line 0 Link Here
1
--- util.h.orig	Mon Dec  9 11:29:11 2002
2
+++ util.h	Wed Jul 19 11:27:37 2006
3
@@ -17,6 +17,6 @@
4
 	Singleton (void) {};
5
 	~Singleton (void) {};
6
     };
7
-}; 
8
+}
9
 
10
 #endif // TTMKFDIRUTIL_H__

Return to bug 100520