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: makedefs
2 --- makedefs.orig 2008-01-15 21:20:24 +0100
3 +++ makedefs 2008-01-24 12:31:48 +0100
4 @@ -132,6 +132,10 @@
5 ;;
6 FreeBSD.7*) SYSTYPE=FREEBSD7
7 ;;
8 + FreeBSD.7*) SYSTYPE=FREEBSD7
9 + ;;
10 + FreeBSD.8*) SYSTYPE=FREEBSD8
11 + ;;
12 OpenBSD.2*) SYSTYPE=OPENBSD2
13 ;;
14 OpenBSD.3*) SYSTYPE=OPENBSD3
15 Index: src/util/file_limit.c
16 --- src/util/file_limit.c.orig 2003-10-22 20:48:36 +0200
17 +++ src/util/file_limit.c 2008-01-24 12:31:48 +0100
18 @@ -80,12 +80,21 @@
19 void set_file_limit(off_t limit)
20 {
21 #ifdef USE_ULIMIT
22 +#ifdef USE_SOFTLIMITONLY
23 +#error "USE_ULIMIT and USE_SOFTLIMITONLY are mutual exclusive"
24 +#endif
25 if (ulimit(UL_SETFSIZE, limit / ULIMIT_BLOCK_SIZE) < 0)
26 msg_fatal("ulimit: %m");
27 #else
28 struct rlimit rlim;
30 +#ifdef USE_SOFTLIMITONLY
31 + if (getrlimit(RLIMIT_FSIZE, &rlim) < 0)
32 + rlim.rlim_max = RLIM_INFINITY;
33 + rlim.rlim_cur = limit;
34 +#else
35 rlim.rlim_cur = rlim.rlim_max = limit;
36 +#endif
37 if (setrlimit(RLIMIT_FSIZE, &rlim) < 0)
38 msg_fatal("setrlimit: %m");
39 #ifdef SIGXFSZ
40 Index: src/util/msg_syslog.c
41 --- src/util/msg_syslog.c.orig 2006-06-15 20:07:16 +0200
42 +++ src/util/msg_syslog.c 2008-01-24 12:31:48 +0100
43 @@ -50,6 +50,11 @@
44 #include <syslog.h>
45 #include <string.h>
46 #include <time.h>
47 +#ifdef USE_SOFTLIMITONLY
48 +#include <sys/time.h>
49 +#include <sys/resource.h>
50 +#include <signal.h>
51 +#endif
53 /* Application-specific. */
55 @@ -144,6 +149,9 @@
57 static void msg_syslog_print(int level, const char *text)
58 {
59 +#ifdef USE_SOFTLIMITONLY
60 + struct rlimit save, rlim;
61 +#endif
62 static int log_level[] = {
63 LOG_INFO, LOG_WARNING, LOG_ERR, LOG_CRIT, LOG_CRIT,
64 };
65 @@ -154,6 +162,15 @@
66 if (level < 0 || level >= (int) (sizeof(log_level) / sizeof(log_level[0])))
67 msg_panic("msg_syslog_print: invalid severity level: %d", level);
69 +#ifdef USE_SOFTLIMITONLY
70 + if (getrlimit(RLIMIT_FSIZE, &save) < 0) {
71 + save.rlim_cur = RLIM_INFINITY;
72 + save.rlim_max = RLIM_INFINITY;
73 + }
74 + rlim.rlim_cur = save.rlim_max;
75 + rlim.rlim_max = save.rlim_max;
76 + (void)setrlimit(RLIMIT_FSIZE, &rlim);
77 +#endif
78 if (level == MSG_INFO) {
79 syslog(syslog_facility | log_level[level], "%.*s",
80 (int) MSG_SYSLOG_RECLEN, text);
81 @@ -161,6 +178,9 @@
82 syslog(syslog_facility | log_level[level], "%s: %.*s",
83 severity_name[level], (int) MSG_SYSLOG_RECLEN, text);
84 }
85 +#ifdef USE_SOFTLIMITONLY
86 + (void)setrlimit(RLIMIT_FSIZE, &save);
87 +#endif
88 }
90 /* msg_syslog_init - initialize */
91 Index: src/util/sys_defs.h
92 --- src/util/sys_defs.h.orig 2008-01-15 01:51:44 +0100
93 +++ src/util/sys_defs.h 2008-01-24 12:32:41 +0100
94 @@ -24,7 +24,7 @@
95 * 4.4BSD and close derivatives.
96 */
97 #if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \
98 - || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) \
99 + || defined(FREEBSD5) || defined(FREEBSD6) || defined(FREEBSD7) || defined(FREEBSD8) \
100 || defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \
101 || defined(OPENBSD2) || defined(OPENBSD3) || defined(OPENBSD4) \
102 || defined(NETBSD1) || defined(NETBSD2) || defined(NETBSD3) \
103 Index: src/smtp/smtp_reuse.c
104 --- src/smtp/smtp_reuse.c.orig 2008-12-04 01:06:42.000000000 +0100
105 +++ src/smtp/smtp_reuse.c 2009-04-06 20:38:18.974597344 +0200
106 @@ -216,7 +216,9 @@
107 /*
108 * Avoid poor performance when TCP MSS > VSTREAM_BUFSIZE.
109 */
110 +#if 0
111 vstream_tweak_sock(session->stream);
112 +#endif
114 /*
115 * Update the list of used cached addresses.