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.
michael@325 | 1 | Index: Makefile.in |
michael@325 | 2 | --- Makefile.in.orig 2010-09-10 06:23:07.000000000 +0200 |
michael@325 | 3 | +++ Makefile.in 2010-10-09 09:56:09.000000000 +0200 |
michael@325 | 4 | @@ -18,7 +18,7 @@ |
michael@325 | 5 | INCLUDESUBDIR=system |
michael@325 | 6 | INCLUDESUBDIRHEADERS= aix.h bsd.h bsdi3.h bsdi4.h bsdi.h cygwin.h \ |
michael@325 | 7 | darwin.h darwin7.h darwin8.h darwin9.h darwin10.h dragonfly.h dynix.h \ |
michael@325 | 8 | - freebsd2.h freebsd3.h freebsd4.h freebsd5.h freebsd6.h freebsd.h \ |
michael@325 | 9 | + freebsd2.h freebsd3.h freebsd4.h freebsd5.h freebsd6.h freebsd7.h freebsd8.h freebsd9.h freebsd.h \ |
michael@325 | 10 | generic.h \ |
michael@325 | 11 | hpux.h irix.h linux.h mingw32.h mips.h netbsd.h openbsd.h osf5.h \ |
michael@325 | 12 | solaris2.3.h solaris2.4.h solaris2.5.h solaris2.6.h \ |
michael@325 | 13 | Index: agent/auto_nlist.c |
michael@325 | 14 | --- agent/auto_nlist.c.orig 2010-07-29 16:58:47.000000000 +0200 |
michael@325 | 15 | +++ agent/auto_nlist.c 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 16 | @@ -53,6 +53,7 @@ |
michael@325 | 17 | } |
michael@325 | 18 | if (*ptr == 0) { |
michael@325 | 19 | *ptr = (struct autonlist *) malloc(sizeof(struct autonlist)); |
michael@325 | 20 | + memset(*ptr, 0, sizeof(struct autonlist)); |
michael@325 | 21 | it = *ptr; |
michael@325 | 22 | it->left = 0; |
michael@325 | 23 | it->right = 0; |
michael@325 | 24 | Index: agent/mibgroup/mibII/tcp.c |
michael@325 | 25 | --- agent/mibgroup/mibII/tcp.c.orig 2010-08-13 17:04:33.000000000 +0200 |
michael@325 | 26 | +++ agent/mibgroup/mibII/tcp.c 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 27 | @@ -87,7 +87,7 @@ |
michael@325 | 28 | * But only define it under FreeBSD, since it |
michael@325 | 29 | * breaks other systems (notable AIX) |
michael@325 | 30 | */ |
michael@325 | 31 | -#ifdef freebsd4 |
michael@325 | 32 | +#if defined (freebsd4) || defined (__NetBSD__) |
michael@325 | 33 | int hz = 1000; |
michael@325 | 34 | #endif |
michael@325 | 35 | |
michael@325 | 36 | Index: agent/mibgroup/mibII/tcpTable.c |
michael@325 | 37 | --- agent/mibgroup/mibII/tcpTable.c.orig 2010-06-16 15:13:25.000000000 +0200 |
michael@325 | 38 | +++ agent/mibgroup/mibII/tcpTable.c 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 39 | @@ -104,6 +104,11 @@ |
michael@325 | 40 | #define TCPTABLE_REMOTEPORT pcb.inp_fport |
michael@325 | 41 | #define TCPTABLE_IS_LINKED_LIST |
michael@325 | 42 | |
michael@325 | 43 | +#if defined(__FreeBSD__) |
michael@325 | 44 | +#undef INP_NEXT_SYMBOL |
michael@325 | 45 | +#define INP_NEXT_SYMBOL inp_next |
michael@325 | 46 | +#endif |
michael@325 | 47 | + |
michael@325 | 48 | #endif /* linux */ |
michael@325 | 49 | #endif /* WIN32 cygwin */ |
michael@325 | 50 | #endif /* solaris2 */ |
michael@325 | 51 | @@ -867,12 +872,17 @@ |
michael@325 | 52 | nnew = SNMP_MALLOC_TYPEDEF(netsnmp_inpcb); |
michael@325 | 53 | if (!nnew) |
michael@325 | 54 | break; |
michael@325 | 55 | +#if defined(__FreeBSD__) |
michael@325 | 56 | + memcpy(&(nnew->pcb), &(((struct xinpcb *) xig)->xi_inp), |
michael@325 | 57 | + sizeof(struct inpcb)); |
michael@325 | 58 | +#else |
michael@325 | 59 | nnew->state = StateMap[((NS_ELEM *) xig)->xt_tp.t_state]; |
michael@325 | 60 | if (nnew->state == 5 /* established */ || |
michael@325 | 61 | nnew->state == 8 /* closeWait */ ) |
michael@325 | 62 | tcp_estab++; |
michael@325 | 63 | memcpy(&(nnew->pcb), &(((NS_ELEM *) xig)->xt_inp), |
michael@325 | 64 | sizeof(struct inpcb)); |
michael@325 | 65 | +#endif |
michael@325 | 66 | |
michael@325 | 67 | nnew->inp_next = tcp_head; |
michael@325 | 68 | tcp_head = nnew; |
michael@325 | 69 | Index: agent/mibgroup/ucd-snmp/diskio.c |
michael@325 | 70 | --- agent/mibgroup/ucd-snmp/diskio.c.orig 2010-08-13 17:04:33.000000000 +0200 |
michael@325 | 71 | +++ agent/mibgroup/ucd-snmp/diskio.c 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 72 | @@ -618,6 +618,20 @@ |
michael@325 | 73 | case DISKIO_DEVICE: |
michael@325 | 74 | *var_len = strlen(stat->dinfo->devices[indx].device_name); |
michael@325 | 75 | return (u_char *) stat->dinfo->devices[indx].device_name; |
michael@325 | 76 | +#if defined(freebsd5) && (__FreeBSD_version >= 500107) |
michael@325 | 77 | + case DISKIO_NREAD: |
michael@325 | 78 | + long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ]; |
michael@325 | 79 | + return (u_char *) & long_ret; |
michael@325 | 80 | + case DISKIO_NWRITTEN: |
michael@325 | 81 | + long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_WRITE]; |
michael@325 | 82 | + return (u_char *) & long_ret; |
michael@325 | 83 | + case DISKIO_READS: |
michael@325 | 84 | + long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_READ]; |
michael@325 | 85 | + return (u_char *) & long_ret; |
michael@325 | 86 | + case DISKIO_WRITES: |
michael@325 | 87 | + long_ret = (signed long) stat->dinfo->devices[indx].operations[DEVSTAT_WRITE]; |
michael@325 | 88 | + return (u_char *) & long_ret; |
michael@325 | 89 | +#else |
michael@325 | 90 | case DISKIO_NREAD: |
michael@325 | 91 | #if defined(freebsd5) && __FreeBSD_version >= 500107 |
michael@325 | 92 | long_ret = (signed long) stat->dinfo->devices[indx].bytes[DEVSTAT_READ]; |
michael@325 | 93 | @@ -675,6 +689,7 @@ |
michael@325 | 94 | case DISKIO_LA15: |
michael@325 | 95 | long_ret = devloads[indx].la15; |
michael@325 | 96 | return (u_char *) & long_ret; |
michael@325 | 97 | +#endif |
michael@325 | 98 | |
michael@325 | 99 | default: |
michael@325 | 100 | ERROR_MSG("diskio.c: don't know how to handle this request."); |
michael@325 | 101 | Index: agent/mibgroup/ucd-snmp/memory_solaris2.c |
michael@325 | 102 | --- agent/mibgroup/ucd-snmp/memory_solaris2.c.orig 2008-10-21 23:10:43.000000000 +0200 |
michael@325 | 103 | +++ agent/mibgroup/ucd-snmp/memory_solaris2.c 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 104 | @@ -1,3 +1,4 @@ |
michael@325 | 105 | +#undef _FILE_OFFSET_BITS /* swapctl doesn't support 64bit off_t */ |
michael@325 | 106 | #include <net-snmp/net-snmp-config.h> /* local SNMP configuration details */ |
michael@325 | 107 | #if HAVE_STRING_H |
michael@325 | 108 | #include <string.h> |
michael@325 | 109 | Index: agent/mibgroup/ucd-snmp/proc.c |
michael@325 | 110 | --- agent/mibgroup/ucd-snmp/proc.c.orig 2010-07-29 16:58:47.000000000 +0200 |
michael@325 | 111 | +++ agent/mibgroup/ucd-snmp/proc.c 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 112 | @@ -1,3 +1,6 @@ |
michael@325 | 113 | +#ifdef solaris2 |
michael@325 | 114 | +#undef _FILE_OFFSET_BITS /* solaris procfs doesn't support 64bit off_t */ |
michael@325 | 115 | +#endif |
michael@325 | 116 | #include <net-snmp/net-snmp-config.h> |
michael@325 | 117 | |
michael@325 | 118 | #ifdef solaris2 |
michael@325 | 119 | Index: agent/mibgroup/util_funcs.c |
michael@325 | 120 | --- agent/mibgroup/util_funcs.c.orig 2010-05-16 20:12:40.000000000 +0200 |
michael@325 | 121 | +++ agent/mibgroup/util_funcs.c 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 122 | @@ -457,6 +457,9 @@ |
michael@325 | 123 | int fd[2][2], i, cnt; |
michael@325 | 124 | char ctmp[STRMAX], *cptr1, *cptr2, argvs[STRMAX], **argv, |
michael@325 | 125 | **aptr; |
michael@325 | 126 | + |
michael@325 | 127 | + *pid = -1; /* open_persist_pipe ignores return code but checks *pid */ |
michael@325 | 128 | + |
michael@325 | 129 | /* |
michael@325 | 130 | * Setup our pipes |
michael@325 | 131 | */ |
michael@325 | 132 | Index: agent/snmpd.c |
michael@325 | 133 | --- agent/snmpd.c.orig 2010-08-17 20:31:31.000000000 +0200 |
michael@325 | 134 | +++ agent/snmpd.c 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 135 | @@ -429,7 +429,7 @@ |
michael@325 | 136 | int uid = 0, gid = 0; |
michael@325 | 137 | int agent_mode = -1; |
michael@325 | 138 | char *cptr, **argvptr; |
michael@325 | 139 | - char *pid_file = NULL; |
michael@325 | 140 | + char *pid_file = "@l_prefix@/var/snmp/snmpd.pid"; |
michael@325 | 141 | char option_compatability[] = "-Le"; |
michael@325 | 142 | #if HAVE_GETPID |
michael@325 | 143 | int fd; |
michael@325 | 144 | Index: apps/snmptrapd.c |
michael@325 | 145 | --- apps/snmptrapd.c.orig 2010-08-13 20:50:07.000000000 +0200 |
michael@325 | 146 | +++ apps/snmptrapd.c 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 147 | @@ -652,6 +652,7 @@ |
michael@325 | 148 | */ |
michael@325 | 149 | #if HAVE_GETPID |
michael@325 | 150 | strcat(options, "p:"); |
michael@325 | 151 | + parse_config_pidFile(NULL, "@l_prefix@/var/snmp/snmptrapd.pid"); |
michael@325 | 152 | #endif |
michael@325 | 153 | |
michael@325 | 154 | #ifdef WIN32 |
michael@325 | 155 | Index: include/net-snmp/library/system.h |
michael@325 | 156 | --- include/net-snmp/library/system.h.orig 2010-03-25 16:06:26.000000000 +0100 |
michael@325 | 157 | +++ include/net-snmp/library/system.h 2010-10-09 09:56:40.000000000 +0200 |
michael@325 | 158 | @@ -141,7 +141,8 @@ |
michael@325 | 159 | #endif |
michael@325 | 160 | #ifndef HAVE_SETENV |
michael@325 | 161 | NETSNMP_IMPORT |
michael@325 | 162 | - int setenv(const char *, const char *, int); |
michael@325 | 163 | + int __netsnmp_setenv(const char *, const char *, int); |
michael@325 | 164 | +# define setenv(a,b,c) __netsnmp_setenv(a,b,c) |
michael@325 | 165 | #endif |
michael@325 | 166 | |
michael@325 | 167 | NETSNMP_IMPORT |
michael@325 | 168 | Index: include/net-snmp/system/freebsd8.h |
michael@325 | 169 | --- include/net-snmp/system/freebsd8.h.orig 2010-02-14 20:29:08.000000000 +0100 |
michael@325 | 170 | +++ include/net-snmp/system/freebsd8.h 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 171 | @@ -1,3 +1,6 @@ |
michael@325 | 172 | +/* freebsd8 is a superset of freebsd7 */ |
michael@325 | 173 | +#include "freebsd7.h" |
michael@325 | 174 | +#define freebsd7 freebsd7 |
michael@325 | 175 | /* freebsd8 is a superset of freebsd4 */ |
michael@325 | 176 | #include "freebsd4.h" |
michael@325 | 177 | #define freebsd4 freebsd4 |
michael@325 | 178 | Index: include/net-snmp/system/freebsd9.h |
michael@325 | 179 | --- include/net-snmp/system/freebsd9.h.orig 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 180 | +++ include/net-snmp/system/freebsd9.h 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 181 | @@ -0,0 +1,3 @@ |
michael@325 | 182 | +/* freebsd9 is a superset of freebsd8 */ |
michael@325 | 183 | +#include "freebsd8.h" |
michael@325 | 184 | +#define freebsd8 freebsd8 |
michael@325 | 185 | Index: snmplib/system.c |
michael@325 | 186 | --- snmplib/system.c.orig 2010-07-29 16:58:47.000000000 +0200 |
michael@325 | 187 | +++ snmplib/system.c 2010-10-09 09:08:23.000000000 +0200 |
michael@325 | 188 | @@ -837,7 +837,7 @@ |
michael@325 | 189 | |
michael@325 | 190 | #ifndef HAVE_SETENV |
michael@325 | 191 | int |
michael@325 | 192 | -setenv(const char *name, const char *value, int overwrite) |
michael@325 | 193 | +__netsnmp_setenv(const char *name, const char *value, int overwrite) |
michael@325 | 194 | { |
michael@325 | 195 | char *cp; |
michael@325 | 196 | int ret; |