Tue, 29 Mar 2011 20:04:34 +0200
Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.
The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.
It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.
1 Index: Net-Packet-3.26/Makefile.PL
2 --- Net-Packet-3.26/Makefile.PL.orig 2006-12-16 16:26:26 +0100
3 +++ Net-Packet-3.26/Makefile.PL 2008-01-01 22:05:18 +0100
4 @@ -14,7 +14,6 @@
5 Net::Libdnet => 0,
6 Time::HiRes => 0,
7 Net::IPv6Addr => 0,
8 - Socket6 => 0,
9 Bit::Vector => 0,
10 },
11 ABSTRACT_FROM => 'lib/Net/Packet.pm',
12 Index: Net-Patricia-1.014/libpatricia/patricia.c
13 --- Net-Patricia-1.014/libpatricia/patricia.c.orig 2005-12-07 21:55:39 +0100
14 +++ Net-Patricia-1.014/libpatricia/patricia.c 2008-01-01 22:05:18 +0100
15 @@ -38,24 +38,24 @@
16 /* prefix_tochar
17 * convert prefix information to bytes
18 */
19 -u_char *
20 +unsigned char *
21 prefix_tochar (prefix_t * prefix)
22 {
23 if (prefix == NULL)
24 return (NULL);
26 - return ((u_char *) & prefix->add.sin);
27 + return ((unsigned char *) & prefix->add.sin);
28 }
30 int
31 -comp_with_mask (void *addr, void *dest, u_int mask)
32 +comp_with_mask (void *addr, void *dest, unsigned int mask)
33 {
35 if ( /* mask/8 == 0 || */ memcmp (addr, dest, mask / 8) == 0) {
36 int n = mask / 8;
37 int m = ((-1) << (8 - (mask % 8)));
39 - if (mask % 8 == 0 || (((u_char *)addr)[n] & m) == (((u_char *)dest)[n] & m))
40 + if (mask % 8 == 0 || (((unsigned char *)addr)[n] & m) == (((unsigned char *)dest)[n] & m))
41 return (1);
42 }
43 return (0);
44 @@ -70,7 +70,7 @@
45 int
46 inet_pton (int af, const char *src, void *dst)
47 {
48 - u_long result;
49 + unsigned long result;
51 if (af == AF_INET) {
52 result = inet_addr(src);
53 @@ -104,7 +104,7 @@
54 {
55 if (af == AF_INET) {
56 int i, c, val;
57 - u_char xp[4] = {0, 0, 0, 0};
58 + unsigned char xp[4] = {0, 0, 0, 0};
60 for (i = 0; ; i++) {
61 c = *src++;
62 @@ -153,7 +153,7 @@
64 struct buffer {
65 char buffs[16][48+5];
66 - u_int i;
67 + unsigned int i;
68 } *buffp;
70 # if 0
71 @@ -172,7 +172,7 @@
72 buff = buffp->buffs[buffp->i++%16];
73 }
74 if (prefix->family == AF_INET) {
75 - u_char *a;
76 + unsigned char *a;
77 assert (prefix->bitlen <= 32);
78 a = prefix_touchar (prefix);
79 if (with_len) {
80 @@ -272,7 +272,7 @@
81 prefix_t *
82 ascii2prefix (int family, char *string)
83 {
84 - u_long bitlen, maxbitlen = 0;
85 + unsigned long bitlen, maxbitlen = 0;
86 char *cp;
87 struct in_addr sin;
88 #ifdef HAVE_IPV6
89 @@ -491,8 +491,8 @@
90 patricia_search_exact (patricia_tree_t *patricia, prefix_t *prefix)
91 {
92 patricia_node_t *node;
93 - u_char *addr;
94 - u_int bitlen;
95 + unsigned char *addr;
96 + unsigned int bitlen;
98 assert (patricia);
99 assert (prefix);
100 @@ -563,8 +563,8 @@
101 {
102 patricia_node_t *node;
103 patricia_node_t *stack[PATRICIA_MAXBITS + 1];
104 - u_char *addr;
105 - u_int bitlen;
106 + unsigned char *addr;
107 + unsigned int bitlen;
108 int cnt = 0;
110 assert (patricia);
111 @@ -662,8 +662,8 @@
112 patricia_lookup (patricia_tree_t *patricia, prefix_t *prefix)
113 {
114 patricia_node_t *node, *new_node, *parent, *glue;
115 - u_char *addr, *test_addr;
116 - u_int bitlen, check_bit, differ_bit;
117 + unsigned char *addr, *test_addr;
118 + unsigned int bitlen, check_bit, differ_bit;
119 int i, j, r;
121 assert (patricia);
122 Index: Net-Patricia-1.014/libpatricia/patricia.h
123 --- Net-Patricia-1.014/libpatricia/patricia.h.orig 2005-12-07 21:54:52 +0100
124 +++ Net-Patricia-1.014/libpatricia/patricia.h 2008-01-01 22:05:18 +0100
125 @@ -15,10 +15,10 @@
126 #ifndef _PATRICIA_H
127 #define _PATRICIA_H
129 -/* typedef unsigned int u_int; */
130 +/* typedef unsigned int unsigned int; */
131 typedef void (*void_fn_t)();
132 /* { from defs.h */
133 -#define prefix_touchar(prefix) ((u_char *)&(prefix)->add.sin)
134 +#define prefix_touchar(prefix) ((unsigned char *)&(prefix)->add.sin)
135 #define MAXLINE 1024
136 #define BIT_TEST(f, b) ((f) & (b))
137 /* } */
138 @@ -40,15 +40,15 @@
139 /* { from mrt.h */
141 typedef struct _prefix4_t {
142 - u_short family; /* AF_INET | AF_INET6 */
143 - u_short bitlen; /* same as mask? */
144 + unsigned short family; /* AF_INET | AF_INET6 */
145 + unsigned short bitlen; /* same as mask? */
146 int ref_count; /* reference count */
147 struct in_addr sin;
148 } prefix4_t;
150 typedef struct _prefix_t {
151 - u_short family; /* AF_INET | AF_INET6 */
152 - u_short bitlen; /* same as mask? */
153 + unsigned short family; /* AF_INET | AF_INET6 */
154 + unsigned short bitlen; /* same as mask? */
155 int ref_count; /* reference count */
156 union {
157 struct in_addr sin;
158 @@ -61,7 +61,7 @@
159 /* } */
161 typedef struct _patricia_node_t {
162 - u_int bit; /* flag if this node used */
163 + unsigned int bit; /* flag if this node used */
164 prefix_t *prefix; /* who we are in patricia tree */
165 struct _patricia_node_t *l, *r; /* left and right children */
166 struct _patricia_node_t *parent;/* may be used */
167 @@ -71,7 +71,7 @@
169 typedef struct _patricia_tree_t {
170 patricia_node_t *head;
171 - u_int maxbits; /* for IP, 32 bit addresses */
172 + unsigned int maxbits; /* for IP, 32 bit addresses */
173 int num_active_node; /* for debug purpose */
174 } patricia_tree_t;
176 Index: Net-Pcap-0.16/Makefile.PL
177 --- Net-Pcap-0.16/Makefile.PL.orig 2007-12-24 00:06:15 +0100
178 +++ Net-Pcap-0.16/Makefile.PL 2008-01-01 22:08:20 +0100
179 @@ -23,7 +23,8 @@
180 }
181 else {
182 $options{CCFLAGS} = '-Wall -Wwrite-strings' if $Config{ccname} eq 'gcc' and $] >= 5.006;
183 - $options{LIBS} = '-lpcap';
184 + $options{INC} = '-I@l_prefix@/include';
185 + $options{LIBS} = '-L@l_prefix@/lib -lpcap';
186 }
188 for my $arg (@ARGV) {
189 Index: Net-Pcap-0.16/Pcap.xs
190 --- Net-Pcap-0.16/Pcap.xs.orig 2008-01-01 05:22:22 +0100
191 +++ Net-Pcap-0.16/Pcap.xs 2008-01-01 22:05:18 +0100
192 @@ -33,7 +33,7 @@
193 #define NEED_sv_2pv_nolen 1
194 #include "ppport.h"
196 -#include <pcap.h>
197 +#include "pcap.h"
199 #ifdef _CYGWIN
200 #include <Win32-Extensions.h>