perl-net/perl-net.patch

Tue, 29 Mar 2011 20:04:34 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 29 Mar 2011 20:04:34 +0200
changeset 334
4a34d7a82eab
child 372
442a711da911
permissions
-rw-r--r--

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.

michael@99 1 Index: Net-Packet-3.26/Makefile.PL
michael@99 2 --- Net-Packet-3.26/Makefile.PL.orig 2006-12-16 16:26:26 +0100
michael@99 3 +++ Net-Packet-3.26/Makefile.PL 2008-01-01 22:05:18 +0100
michael@99 4 @@ -14,7 +14,6 @@
michael@99 5 Net::Libdnet => 0,
michael@99 6 Time::HiRes => 0,
michael@99 7 Net::IPv6Addr => 0,
michael@99 8 - Socket6 => 0,
michael@99 9 Bit::Vector => 0,
michael@99 10 },
michael@99 11 ABSTRACT_FROM => 'lib/Net/Packet.pm',
michael@99 12 Index: Net-Patricia-1.014/libpatricia/patricia.c
michael@99 13 --- Net-Patricia-1.014/libpatricia/patricia.c.orig 2005-12-07 21:55:39 +0100
michael@99 14 +++ Net-Patricia-1.014/libpatricia/patricia.c 2008-01-01 22:05:18 +0100
michael@99 15 @@ -38,24 +38,24 @@
michael@99 16 /* prefix_tochar
michael@99 17 * convert prefix information to bytes
michael@99 18 */
michael@99 19 -u_char *
michael@99 20 +unsigned char *
michael@99 21 prefix_tochar (prefix_t * prefix)
michael@99 22 {
michael@99 23 if (prefix == NULL)
michael@99 24 return (NULL);
michael@99 25
michael@99 26 - return ((u_char *) & prefix->add.sin);
michael@99 27 + return ((unsigned char *) & prefix->add.sin);
michael@99 28 }
michael@99 29
michael@99 30 int
michael@99 31 -comp_with_mask (void *addr, void *dest, u_int mask)
michael@99 32 +comp_with_mask (void *addr, void *dest, unsigned int mask)
michael@99 33 {
michael@99 34
michael@99 35 if ( /* mask/8 == 0 || */ memcmp (addr, dest, mask / 8) == 0) {
michael@99 36 int n = mask / 8;
michael@99 37 int m = ((-1) << (8 - (mask % 8)));
michael@99 38
michael@99 39 - if (mask % 8 == 0 || (((u_char *)addr)[n] & m) == (((u_char *)dest)[n] & m))
michael@99 40 + if (mask % 8 == 0 || (((unsigned char *)addr)[n] & m) == (((unsigned char *)dest)[n] & m))
michael@99 41 return (1);
michael@99 42 }
michael@99 43 return (0);
michael@99 44 @@ -70,7 +70,7 @@
michael@99 45 int
michael@99 46 inet_pton (int af, const char *src, void *dst)
michael@99 47 {
michael@99 48 - u_long result;
michael@99 49 + unsigned long result;
michael@99 50
michael@99 51 if (af == AF_INET) {
michael@99 52 result = inet_addr(src);
michael@99 53 @@ -104,7 +104,7 @@
michael@99 54 {
michael@99 55 if (af == AF_INET) {
michael@99 56 int i, c, val;
michael@99 57 - u_char xp[4] = {0, 0, 0, 0};
michael@99 58 + unsigned char xp[4] = {0, 0, 0, 0};
michael@99 59
michael@99 60 for (i = 0; ; i++) {
michael@99 61 c = *src++;
michael@99 62 @@ -153,7 +153,7 @@
michael@99 63
michael@99 64 struct buffer {
michael@99 65 char buffs[16][48+5];
michael@99 66 - u_int i;
michael@99 67 + unsigned int i;
michael@99 68 } *buffp;
michael@99 69
michael@99 70 # if 0
michael@99 71 @@ -172,7 +172,7 @@
michael@99 72 buff = buffp->buffs[buffp->i++%16];
michael@99 73 }
michael@99 74 if (prefix->family == AF_INET) {
michael@99 75 - u_char *a;
michael@99 76 + unsigned char *a;
michael@99 77 assert (prefix->bitlen <= 32);
michael@99 78 a = prefix_touchar (prefix);
michael@99 79 if (with_len) {
michael@99 80 @@ -272,7 +272,7 @@
michael@99 81 prefix_t *
michael@99 82 ascii2prefix (int family, char *string)
michael@99 83 {
michael@99 84 - u_long bitlen, maxbitlen = 0;
michael@99 85 + unsigned long bitlen, maxbitlen = 0;
michael@99 86 char *cp;
michael@99 87 struct in_addr sin;
michael@99 88 #ifdef HAVE_IPV6
michael@99 89 @@ -491,8 +491,8 @@
michael@99 90 patricia_search_exact (patricia_tree_t *patricia, prefix_t *prefix)
michael@99 91 {
michael@99 92 patricia_node_t *node;
michael@99 93 - u_char *addr;
michael@99 94 - u_int bitlen;
michael@99 95 + unsigned char *addr;
michael@99 96 + unsigned int bitlen;
michael@99 97
michael@99 98 assert (patricia);
michael@99 99 assert (prefix);
michael@99 100 @@ -563,8 +563,8 @@
michael@99 101 {
michael@99 102 patricia_node_t *node;
michael@99 103 patricia_node_t *stack[PATRICIA_MAXBITS + 1];
michael@99 104 - u_char *addr;
michael@99 105 - u_int bitlen;
michael@99 106 + unsigned char *addr;
michael@99 107 + unsigned int bitlen;
michael@99 108 int cnt = 0;
michael@99 109
michael@99 110 assert (patricia);
michael@99 111 @@ -662,8 +662,8 @@
michael@99 112 patricia_lookup (patricia_tree_t *patricia, prefix_t *prefix)
michael@99 113 {
michael@99 114 patricia_node_t *node, *new_node, *parent, *glue;
michael@99 115 - u_char *addr, *test_addr;
michael@99 116 - u_int bitlen, check_bit, differ_bit;
michael@99 117 + unsigned char *addr, *test_addr;
michael@99 118 + unsigned int bitlen, check_bit, differ_bit;
michael@99 119 int i, j, r;
michael@99 120
michael@99 121 assert (patricia);
michael@99 122 Index: Net-Patricia-1.014/libpatricia/patricia.h
michael@99 123 --- Net-Patricia-1.014/libpatricia/patricia.h.orig 2005-12-07 21:54:52 +0100
michael@99 124 +++ Net-Patricia-1.014/libpatricia/patricia.h 2008-01-01 22:05:18 +0100
michael@99 125 @@ -15,10 +15,10 @@
michael@99 126 #ifndef _PATRICIA_H
michael@99 127 #define _PATRICIA_H
michael@99 128
michael@99 129 -/* typedef unsigned int u_int; */
michael@99 130 +/* typedef unsigned int unsigned int; */
michael@99 131 typedef void (*void_fn_t)();
michael@99 132 /* { from defs.h */
michael@99 133 -#define prefix_touchar(prefix) ((u_char *)&(prefix)->add.sin)
michael@99 134 +#define prefix_touchar(prefix) ((unsigned char *)&(prefix)->add.sin)
michael@99 135 #define MAXLINE 1024
michael@99 136 #define BIT_TEST(f, b) ((f) & (b))
michael@99 137 /* } */
michael@99 138 @@ -40,15 +40,15 @@
michael@99 139 /* { from mrt.h */
michael@99 140
michael@99 141 typedef struct _prefix4_t {
michael@99 142 - u_short family; /* AF_INET | AF_INET6 */
michael@99 143 - u_short bitlen; /* same as mask? */
michael@99 144 + unsigned short family; /* AF_INET | AF_INET6 */
michael@99 145 + unsigned short bitlen; /* same as mask? */
michael@99 146 int ref_count; /* reference count */
michael@99 147 struct in_addr sin;
michael@99 148 } prefix4_t;
michael@99 149
michael@99 150 typedef struct _prefix_t {
michael@99 151 - u_short family; /* AF_INET | AF_INET6 */
michael@99 152 - u_short bitlen; /* same as mask? */
michael@99 153 + unsigned short family; /* AF_INET | AF_INET6 */
michael@99 154 + unsigned short bitlen; /* same as mask? */
michael@99 155 int ref_count; /* reference count */
michael@99 156 union {
michael@99 157 struct in_addr sin;
michael@99 158 @@ -61,7 +61,7 @@
michael@99 159 /* } */
michael@99 160
michael@99 161 typedef struct _patricia_node_t {
michael@99 162 - u_int bit; /* flag if this node used */
michael@99 163 + unsigned int bit; /* flag if this node used */
michael@99 164 prefix_t *prefix; /* who we are in patricia tree */
michael@99 165 struct _patricia_node_t *l, *r; /* left and right children */
michael@99 166 struct _patricia_node_t *parent;/* may be used */
michael@99 167 @@ -71,7 +71,7 @@
michael@99 168
michael@99 169 typedef struct _patricia_tree_t {
michael@99 170 patricia_node_t *head;
michael@99 171 - u_int maxbits; /* for IP, 32 bit addresses */
michael@99 172 + unsigned int maxbits; /* for IP, 32 bit addresses */
michael@99 173 int num_active_node; /* for debug purpose */
michael@99 174 } patricia_tree_t;
michael@99 175
michael@99 176 Index: Net-Pcap-0.16/Makefile.PL
michael@99 177 --- Net-Pcap-0.16/Makefile.PL.orig 2007-12-24 00:06:15 +0100
michael@99 178 +++ Net-Pcap-0.16/Makefile.PL 2008-01-01 22:08:20 +0100
michael@99 179 @@ -23,7 +23,8 @@
michael@99 180 }
michael@99 181 else {
michael@99 182 $options{CCFLAGS} = '-Wall -Wwrite-strings' if $Config{ccname} eq 'gcc' and $] >= 5.006;
michael@99 183 - $options{LIBS} = '-lpcap';
michael@99 184 + $options{INC} = '-I@l_prefix@/include';
michael@99 185 + $options{LIBS} = '-L@l_prefix@/lib -lpcap';
michael@99 186 }
michael@99 187
michael@99 188 for my $arg (@ARGV) {
michael@99 189 Index: Net-Pcap-0.16/Pcap.xs
michael@99 190 --- Net-Pcap-0.16/Pcap.xs.orig 2008-01-01 05:22:22 +0100
michael@99 191 +++ Net-Pcap-0.16/Pcap.xs 2008-01-01 22:05:18 +0100
michael@99 192 @@ -33,7 +33,7 @@
michael@99 193 #define NEED_sv_2pv_nolen 1
michael@99 194 #include "ppport.h"
michael@99 195
michael@99 196 -#include <pcap.h>
michael@99 197 +#include "pcap.h"
michael@99 198
michael@99 199 #ifdef _CYGWIN
michael@99 200 #include <Win32-Extensions.h>

mercurial