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: configure
2 --- configure.orig 2006-06-21 22:32:38.000000000 +0200
3 +++ configure 2006-10-20 15:30:45.862899000 +0200
4 @@ -5259,11 +5259,7 @@
5 echo "$as_me:$LINENO: result: $ac_cv_lbl_have_" >&5
6 echo "${ECHO_T}$ac_cv_lbl_have_" >&6
7 if test $ac_cv_lbl_have_ = no ; then
8 -
9 -cat >>confdefs.h <<\_ACEOF
10 -#define
11 -_ACEOF
12 -
13 + :
14 fi
16 rm -f os-proto.h
17 Index: Makefile.in
18 --- Makefile.in.orig 2000-06-15 02:39:55.000000000 +0200
19 +++ Makefile.in 2006-10-20 17:41:03.246914000 +0200
20 @@ -31,7 +31,7 @@
21 # Pathname of directory to install the man page
22 MANDEST = @mandir@
23 # Pathname of directory to install database file
24 -ARPDIR = $(prefix)/arpwatch
25 +ARPDIR = @localstatedir@
27 # VPATH
28 srcdir = @srcdir@
29 @@ -42,16 +42,17 @@
30 #
32 CC = @CC@
33 +CFLAGS = @CFLAGS@
34 +CPPFLAGS = @CPPFLAGS@
35 +
36 PROG = arpwatch
37 CCOPT = @V_CCOPT@
38 INCLS = -I. @V_INCLS@
39 DEFS = -DDEBUG @DEFS@ -DARPDIR=\"$(ARPDIR)\" -DPATH_SENDMAIL=\"$(SENDMAIL)\"
41 -# Standard CFLAGS
42 -CFLAGS = $(CCOPT) $(DEFS) $(INCLS)
43 -
44 # Standard LIBS
45 LIBS = @LIBS@
46 +LDFLAGS = @LDFLAGS@
47 # Standard LIBS without libpcap.a
48 SLIBS = @LBL_LIBS@
50 @@ -63,7 +64,7 @@
51 # problem if you don't own the file but can write to the directory.
52 .c.o:
53 @rm -f $@
54 - $(CC) $(CFLAGS) -c $(srcdir)/$*.c
55 + $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -c $(srcdir)/$*.c
57 CSRC = db.c dns.c ec.c file.c intoa.c machdep.c util.c report.c setsignal.c
58 WSRC = arpwatch.c
59 @@ -95,11 +96,11 @@
61 arpwatch: $(WOBJ) @V_PCAPDEP@
62 @rm -f $@
63 - $(CC) $(CFLAGS) -o $@ $(WOBJ) $(LIBS)
64 + $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ $(WOBJ) $(LDFLAGS) $(LIBS)
66 arpsnmp: $(SOBJ)
67 @rm -f $@
68 - $(CC) $(CFLAGS) -o $@ $(SOBJ) $(SLIBS)
69 + $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ $(SOBJ) $(LDFLAGS) $(SLIBS)
71 version.o: version.c
72 version.c: $(srcdir)/VERSION
73 @@ -107,18 +108,22 @@
74 sed -e 's/.*/char version[] = "&";/' $(srcdir)/VERSION > $@
76 zap: zap.o intoa.o
77 - $(CC) $(CFLAGS) -o $@ zap.o intoa.o -lutil
78 + $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) -o $@ zap.o intoa.o $(LDFLAGS) -lutil
80 install: force
81 - $(INSTALL) -m 555 -o bin -g bin arpwatch $(DESTDIR)$(BINDEST)
82 - $(INSTALL) -m 555 -o bin -g bin arpsnmp $(DESTDIR)$(BINDEST)
83 + $(INSTALL) -s -m 555 arpwatch $(DESTDIR)$(BINDEST)
84 + $(INSTALL) -s -m 555 arpsnmp $(DESTDIR)$(BINDEST)
86 install-man: force
87 - $(INSTALL) -m 444 -o bin -g bin $(srcdir)/arpwatch.8 \
88 + $(INSTALL) -m 644 $(srcdir)/arpwatch.8 \
89 $(DESTDIR)$(MANDEST)/man8
90 - $(INSTALL) -m 444 -o bin -g bin $(srcdir)/arpsnmp.8 \
91 + $(INSTALL) -m 644 $(srcdir)/arpsnmp.8 \
92 $(DESTDIR)$(MANDEST)/man8
94 +install-data: force
95 + $(INSTALL) -m 444 $(srcdir)/ethercodes.dat \
96 + $(DESTDIR)$(ARPDIR)
97 +
98 lint: $(GENSRC) force
99 lint -hbxn $(SRC) | \
100 grep -v 'struct/union .* never defined' | \
101 Index: arpwatch.8
102 --- arpwatch.8.orig 2006-10-20 16:13:53.268590000 +0200
103 +++ arpwatch.8 2006-10-20 16:15:01.537612000 +0200
104 @@ -152,9 +152,8 @@
105 .na
106 .nh
107 .nf
108 -/usr/operator/arpwatch - default directory
109 -arp.dat - ethernet/ip address database
110 -ethercodes.dat - vendor ethernet block list
111 +@l_prefix@/var/arpwatch/arp.dat - ethernet/ip address database
112 +@l_prefix@/var/arpwatch/ethercodes.dat - vendor ethernet block list
113 .ad
114 .hy
115 .fi
116 Index: arpsnmp.8
117 --- arpsnmp.8.orig 2006-10-20 16:14:50.412624000 +0200
118 +++ arpsnmp.8 2006-10-20 16:14:59.301665000 +0200
119 @@ -69,9 +69,8 @@
120 .na
121 .nh
122 .nf
123 -/usr/operator/arpwatch - default directory
124 -arp.dat - ethernet/ip address database
125 -ethercodes.dat - vendor ethernet block list
126 +@l_prefix@/var/arpwatch/arp.dat - ethernet/ip address database
127 +@l_prefix@/var/arpwatch/ethercodes.dat - vendor ethernet block list
128 .ad
129 .hy
130 .fi
131 Index: arpwatch.h
132 --- arpwatch.h.orig 2000-10-01 01:40:55.000000000 +0200
133 +++ arpwatch.h 2006-10-21 07:41:55.629111000 +0200
134 @@ -8,6 +8,20 @@
135 #define BCOPY(a, b, n) memmove((char *)b, (char *)a, n)
136 #define MEMSET(s, c, n) memset((char *)s, c, n)
138 +/* Repair unportable usage of u_int*_t declarations */
139 +#ifndef u_int64_t
140 +#define u_int64_t unsigned long long
141 +#endif
142 +#ifndef u_int32_t
143 +#define u_int32_t unsigned int
144 +#endif
145 +#ifndef u_int16_t
146 +#define u_int16_t unsigned short
147 +#endif
148 +#ifndef u_int6_t
149 +#define u_int8_t unsigned char
150 +#endif
151 +
152 char *intoa(u_int32_t);
154 #ifndef HAVE_BCOPY
155 Index: arpwatch.c
156 --- arpwatch.c.orig 2004-01-22 23:18:20.000000000 +0100
157 +++ arpwatch.c 2006-10-20 19:28:25.417689000 +0200
158 @@ -234,8 +234,11 @@
159 if (pid < 0) {
160 syslog(LOG_ERR, "main fork(): %m");
161 exit(1);
162 - } else if (pid != 0)
163 + } else if (pid != 0) {
164 + printf("%d\n", pid);
165 + fflush(stdout);
166 exit(0);
167 + }
168 (void)close(fileno(stdin));
169 (void)close(fileno(stdout));
170 (void)close(fileno(stderr));
171 @@ -321,7 +324,6 @@
173 (void)setsignal(SIGINT, die);
174 (void)setsignal(SIGTERM, die);
175 - (void)setsignal(SIGHUP, die);
176 if (rfilename == NULL) {
177 (void)setsignal(SIGQUIT, checkpoint);
178 (void)setsignal(SIGALRM, checkpoint);
179 Index: dns.c
180 --- dns.c.orig 2006-10-20 19:06:40.704886000 +0200
181 +++ dns.c 2006-10-20 19:20:09.611322000 +0200
182 @@ -137,7 +137,7 @@
183 return (0);
184 }
186 -/* Return the cannonical name of the host */
187 +/* Return the canonical name of the host (NULL if not found) */
188 char *
189 gethname(u_int32_t a)
190 {
191 @@ -150,18 +150,18 @@
192 hp = gethostbyaddr((char *)&a, sizeof(a), AF_INET);
193 _res.options = options;
194 if (hp == NULL)
195 - return (intoa(a));
196 + return NULL;
197 return (hp->h_name);
198 }
200 -/* Return the simple name of the host */
201 +/* Return the simple name of the host (NULL if not found) */
202 char *
203 getsname(register u_int32_t a)
204 {
205 register char *s, *cp;
207 s = gethname(a);
208 - if (!isdigit((int)*s)) {
209 + if (s != NULL) {
210 cp = strchr(s, '.');
211 if (cp != NULL)
212 *cp = '\0';