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

(-)/usr/ports/devel/ccache/Makefile (-7 / +53 lines)
Lines 6-13 Link Here
6
#
6
#
7
7
8
PORTNAME=	ccache
8
PORTNAME=	ccache
9
PORTVERSION=	2.3
9
PORTVERSION=	2.4
10
PORTREVISION=	1
11
CATEGORIES=	devel
10
CATEGORIES=	devel
12
MASTER_SITES=	http://ccache.samba.org/ftp/ccache/
11
MASTER_SITES=	http://ccache.samba.org/ftp/ccache/
13
12
Lines 23-36 Link Here
23
PORTDOCS=	index.html \
22
PORTDOCS=	index.html \
24
		ccache-man.html
23
		ccache-man.html
25
24
25
.if !defined(WITHOUT_COMPILER_LINKS)
26
PKGMESSAGE=	${WRKDIR}/pkg-message
27
CCLINKDIR=	libexec/ccache/
28
.endif
29
30
.include <bsd.port.pre.mk>
31
32
.if !defined(WITHOUT_COMPILER_LINKS)
33
GNU_COMPILERS=		295 33 34 35
34
CCACHE_COMPILERS=	cc c++ ${GNU_COMPILERS:S|^|gcc|} ${GNU_COMPILERS:S|^|g++|}
35
.if ${ARCH}=="i386"
36
CCACHE_COMPILERS+=	icc icpc
37
.endif
38
.if defined(EXTRA_COMPILERS)
39
CCACHE_COMPILERS+=	${EXTRA_COMPILERS}
40
.endif
41
PLIST_FILES+=	${CCACHE_COMPILERS:S|^|${CCLINKDIR}|}
42
PLIST_DIRTS+=	${CCLINKDIR}
43
.endif
44
45
pre-everything::
46
.if !defined(WITHOUT_COMPILER_LINKS)
47
	@${ECHO_MSG} "===>  Ccache will install compiler links in ${PREFIX}/libexec/ccache"
48
	@${ECHO_MSG} "===>  Links that will be created are"
49
	@${ECHO_MSG} "===>  ${CCACHE_COMPILERS}"
50
	@${ECHO_MSG} "===>"
51
	@${ECHO_MSG} "===>  You may add more by EXTRA_COMPILERS=\"Ccompiler1 C++compiler1 etc..\""
52
	@${ECHO_MSG} "===>"
53
	@${ECHO_MSG} "===>  You can disable compiler links by defining"
54
	@${ECHO_MSG} "===>  WITHOUT_COMPILER_LINKS"
55
	@${ECHO_MSG} "===>"
56
.endif
57
58
post-extract:
59
.if !defined(WITHOUT_COMPILER_LINKS)
60
	@${SED} -e 's|%%CCACHE_COMPILERS%%|${CCACHE_COMPILERS}|; \
61
		s|%%PREFIX%%|${PREFIX}|; s|%%CCLINKDIR%%|${CCLINKDIR}|; \
62
		s|%%LOCALBASE%%|${LOCALBASE}|' \
63
		${FILESDIR}/pkg-message.in >${PKGMESSAGE}
64
.endif
26
do-install:
65
do-install:
27
	${INSTALL_PROGRAM} ${WRKSRC}/ccache ${PREFIX}/bin
66
	@${INSTALL_PROGRAM} ${WRKSRC}/ccache ${PREFIX}/bin
28
	${INSTALL_MAN} ${WRKSRC}/${MAN1} ${PREFIX}/man/man1
67
	@${INSTALL_MAN} ${WRKSRC}/${MAN1} ${PREFIX}/man/man1
68
.if !defined(WITHOUT_COMPILER_LINKS)
69
	@${MKDIR} ${PREFIX}/${CCLINKDIR}
70
.for link in ${CCACHE_COMPILERS}
71
	@${LN} -sf ${PREFIX}/bin/ccache ${PREFIX}/${CCLINKDIR}/${link}
72
.endfor
73
.endif
29
.if !defined(NOPORTDOCS)
74
.if !defined(NOPORTDOCS)
30
	${MKDIR} ${DOCSDIR}
75
	@${MKDIR} ${DOCSDIR}
31
.for i in ${PORTDOCS}
76
.for i in ${PORTDOCS}
32
	${INSTALL_DATA} ${WRKSRC}/web/${i} ${DOCSDIR}
77
	@${INSTALL_DATA} ${WRKSRC}/web/${i} ${DOCSDIR}
33
.endfor
78
.endfor
34
.endif
79
.endif
80
	@${CAT} ${PKGMESSAGE}
35
81
36
.include <bsd.port.mk>
82
.include <bsd.port.post.mk>
(-)/usr/ports/devel/ccache/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
MD5 (ccache-2.3.tar.gz) = 5e4afc0b170bf282d1813aeaf3d577d2
1
MD5 (ccache-2.4.tar.gz) = 73c1ed1e767c1752dd0f548ec1e66ce7
2
SIZE (ccache-2.3.tar.gz) = 84386
2
SIZE (ccache-2.4.tar.gz) = 86363
(-)/usr/ports/devel/ccache/files/patch-md4 (-58 / +72 lines)
Lines 1-41 Link Here
1
--- Makefile.in	Mon Apr 29 05:14:11 2002
1
--- ccache.h.orig	Wed Sep  8 21:30:40 2004
2
+++ Makefile.in	Fri May  3 14:48:08 2002
2
+++ ccache.h	Wed Sep  8 21:31:53 2004
3
@@ -11,7 +11,7 @@
3
@@ -65,14 +65,14 @@
4
 CFLAGS=@CFLAGS@ -I.
5
 
6
-OBJS= ccache.o mdfour.o hash.o execute.o util.o args.o stats.o \
7
+OBJS= ccache.o hash.o execute.o util.o args.o stats.o \
8
 	cleanup.o snprintf.o unify.o
9
-HEADERS = ccache.h mdfour.h
10
+HEADERS = ccache.h
11
 
12
 all: ccache
13
@@ -20,5 +20,5 @@
14
 
15
 ccache: $(OBJS) $(HEADERS)
16
-	$(CC) $(CFLAGS) -o $@ $(OBJS)
17
+	$(CC) $(CFLAGS) -o $@ $(OBJS) -lmd
18
 
4
 
19
 ccache.1: ccache.yo
20
--- ccache.h	Mon Apr 29 05:14:12 2002
21
+++ ccache.h	Fri May  3 14:47:05 2002
22
@@ -57,5 +57,5 @@
23
 typedef unsigned uint32;
5
 typedef unsigned uint32;
24
 
6
 
25
-#include "mdfour.h"
7
-#include "mdfour.h"
26
+#include <md4.h>
8
+#include <md4.h> 
27
 
9
 
28
 void hash_start(void);
10
 void hash_start(void);
29
@@ -64,5 +64,5 @@
11
 void hash_string(const char *s);
12
 void hash_int(int x);
30
 void hash_file(const char *fname);
13
 void hash_file(const char *fname);
31
 char *hash_result(void);
14
 char *hash_result(void);
32
-void hash_buffer(const char *s, int len);
15
-void hash_buffer(const char *s, int len);
33
+void hash_buffer(const unsigned char *s, unsigned int len);
16
+void hash_buffer(const unsigned char *s, unsigned int len);
34
 
17
 
35
 void cc_log(const char *format, ...);
18
 void cc_log(const char *format, ...);
36
--- hash.c	Mon Apr 29 05:14:12 2002
19
 void fatal(const char *msg);
37
+++ hash.c	Fri May  3 15:18:08 2002
20
--- hash.c.orig	Wed Sep  8 21:36:22 2004
38
@@ -21,15 +21,20 @@
21
+++ hash.c	Wed Sep  8 21:36:25 2004
22
@@ -20,17 +20,22 @@
23
 */
39
 
24
 
40
 #include "ccache.h"
25
 #include "ccache.h"
41
+#include <sys/types.h>
26
+#include <sys/types.h>
Lines 44-57 Link Here
44
 
29
 
45
-static struct mdfour md;
30
-static struct mdfour md;
46
+static MD4_CTX md;
31
+static MD4_CTX md;
47
+static off_t	totalN;
32
+static off_t   totalN;
48
 
33
 
49
-void hash_buffer(const char *s, int len)
34
-void hash_buffer(const char *s, int len)
50
+void hash_buffer(const unsigned char *s, unsigned int len)
35
+void hash_buffer(const unsigned char *s, unsigned int len)
51
 {
36
 {
52
-	mdfour_update(&md, (unsigned char *)s, len);
37
-	mdfour_update(&md, (unsigned char *)s, len);
53
+	totalN += len;
38
+       totalN += len;
54
+	MD4Update(&md, s, len);
39
+       MD4Update(&md, s, len);
55
 }
40
 }
56
 
41
 
57
 void hash_start(void)
42
 void hash_start(void)
Lines 60-100 Link Here
60
+	MD4Init(&md);
45
+	MD4Init(&md);
61
 }
46
 }
62
 
47
 
63
@@ -47,16 +52,27 @@
48
 void hash_string(const char *s)
49
@@ -46,35 +51,40 @@
50
 /* add contents of a file to the hash */
64
 void hash_file(const char *fname)
51
 void hash_file(const char *fname)
65
 {
52
 {
66
-	char buf[1024];
53
-	char buf[1024];
67
-	int fd, n;
54
-	int fd, n;
68
+	char *buf;
55
+       char *buf;
69
+	int fd;
56
+       int fd;
70
+	struct stat stats;
57
+       struct stat stats;
71
 
58
 
72
 	fd = open(fname, O_RDONLY);
59
 	fd = open(fname, O_RDONLY|O_BINARY);
73
 	if (fd == -1) {
60
 	if (fd == -1) {
74
 		cc_log("Failed to open %s\n", fname);
61
 		cc_log("Failed to open %s\n", fname);
75
-		fatal("hash_file");
62
-		fatal("hash_file");
76
+		fatal(__FUNCTION__);
63
+                fatal(__FUNCTION__);
77
 	}
64
 	}
78
-
65
 
79
-	while ((n = read(fd, buf, sizeof(buf))) > 0) {
66
-	while ((n = read(fd, buf, sizeof(buf))) > 0) {
80
-		hash_buffer(buf, n);
67
-		hash_buffer(buf, n);
81
+	if (fstat(fd, &stats) != 0) {
68
-	}
82
+		cc_log("Failed to fstat the opened %s (descriptor %d)\n",
69
+       if (fstat(fd, &stats) != 0) {
83
+			fname, fd);
70
+               cc_log("Failed to fstat the opened %s (descriptor %d)\n",
84
+		close(fd);
71
+                       fname, fd);
85
+		fatal(__FUNCTION__);
72
+               close(fd);
86
+	}
73
+               fatal(__FUNCTION__);
87
+	buf = mmap(NULL, stats.st_size, PROT_READ, MAP_PRIVATE, fd, 0); 
74
+       }
88
+	if (buf == MAP_FAILED) {
75
+       buf = mmap(NULL, stats.st_size, PROT_READ, MAP_PRIVATE, fd, 0); 
89
+		cc_log("Failed to mmap %s\n", fname);
76
+       if (buf == MAP_FAILED) {
90
+		close(fd);
77
+               cc_log("Failed to mmap %s\n", fname);
91
+		fatal(__FUNCTION__);
78
+               close(fd);
92
 	}
79
+               fatal(__FUNCTION__);
80
+        }       
93
+
81
+
94
+	hash_buffer(buf, stats.st_size);
82
+        hash_buffer(buf, stats.st_size);
95
 	close(fd);
83
 	close(fd);
96
 }
84
 }
97
@@ -65,15 +81,9 @@
85
 
86
 /* return the hash result as a static string */
98
 char *hash_result(void)
87
 char *hash_result(void)
99
 {
88
 {
100
-	unsigned char sum[16];
89
-	unsigned char sum[16];
Lines 103-120 Link Here
103
 
92
 
104
-	hash_buffer(NULL, 0);
93
-	hash_buffer(NULL, 0);
105
-	mdfour_result(&md, sum);
94
-	mdfour_result(&md, sum);
106
+	MD4End(&md, ret);
95
+        MD4End(&md, ret);
107
 	
96
 	
108
-	for (i=0;i<16;i++) {
97
-	for (i=0;i<16;i++) {
109
-		sprintf(&ret[i*2], "%02x", (unsigned)sum[i]);
98
-		sprintf(&ret[i*2], "%02x", (unsigned)sum[i]);
110
-	}
99
-	}
111
-	sprintf(&ret[i*2], "-%u", (unsigned)md.totalN);
100
-	sprintf(&ret[i*2], "-%u", (unsigned)md.totalN);
112
+	snprintf(ret + 32, sizeof ret - 32, "-%lu", (unsigned long)totalN);
101
-
113
 
102
+        snprintf(ret + 32, sizeof ret - 32, "-%lu", (unsigned long)totalN);
114
 	return ret;
103
 	return ret;
115
--- unify.c	Sun Mar 31 23:00:31 2002
104
 }
116
+++ unify.c	Fri May  3 15:53:13 2002
105
--- unify.c.orig	Wed Sep  8 21:36:41 2004
117
@@ -105,11 +105,10 @@
106
+++ unify.c	Wed Sep  8 21:37:20 2004
107
@@ -104,13 +104,12 @@
108
 			hash_buffer((char *)buf, len);
118
 			len = 0;
109
 			len = 0;
119
 		}
110
 		}
120
-		hash_buffer(NULL, 0);
111
-		hash_buffer(NULL, 0);
Lines 124-130 Link Here
124
 	buf[len++] = c;
115
 	buf[len++] = c;
125
-	if (len == 64) {
116
-	if (len == 64) {
126
-		hash_buffer((char *)buf, len);
117
-		hash_buffer((char *)buf, len);
127
+	if (len == sizeof buf) {
118
+       if (len == sizeof buf) {
128
+		hash_buffer((char *)buf, sizeof buf);
119
+                hash_buffer((char *)buf, sizeof buf);
129
 		len = 0;
120
 		len = 0;
130
 	}
121
 	}
122
 }
123
--- Makefile.in.orig	Mon Sep  6 09:04:22 2004
124
+++ Makefile.in	Wed Sep  8 21:41:00 2004
125
@@ -11,16 +11,16 @@
126
 CFLAGS=@CFLAGS@ -I.
127
 EXEEXT=@EXEEXT@
128
 
129
-OBJS= ccache.o mdfour.o hash.o execute.o util.o args.o stats.o \
130
+OBJS= ccache.o hash.o execute.o util.o args.o stats.o \
131
 	cleanup.o snprintf.o unify.o
132
-HEADERS = ccache.h mdfour.h
133
+HEADERS = ccache.h
134
 
135
 all: ccache$(EXEEXT)
136
 
137
 docs: ccache.1 web/ccache-man.html
138
 
139
 ccache$(EXEEXT): $(OBJS) $(HEADERS)
140
-	$(CC) $(CFLAGS) -o $@ $(OBJS)
141
+	$(CC) $(CFLAGS) -o $@ $(OBJS) -lmd
142
 
143
 ccache.1: ccache.yo
144
 	-yodl2man -o ccache.1 ccache.yo
(-)/usr/ports/devel/ccache/files/pkg-message.in (+20 lines)
Line 0 Link Here
1
Ccache has installed links for the following compilers
2
%%CCACHE_COMPILERS%%
3
in %%PREFIX%%/%%CCLINKDIR%%
4
5
To use ccache add the following to /etc/make.conf
6
7
.if !defined(NOCCACHE)
8
CC=%%PREFIX%%/%%CCLINKDIR%%cc
9
CXX=%%PREFIX%%/%%CCLINKDIR%%c++
10
.endif
11
12
If you have a problem building a port
13
define NOCCACHE and try again.
14
15
To use ccache with ports that use USE_GCC
16
add %%PREFIX%%/%%CCLINKDIR%% to your PATH
17
and make sure it is before %%LOCALBASE%%/bin
18
19
Please make sure you have the compiler installed
20
before you do this or it will not work!!

Return to bug 71717