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 2007-09-16 14:24:17 +0200
3 +++ Configure 2007-10-17 12:14:14 +0200
4 @@ -6,7 +6,6 @@
5 ##
7 require 5.000;
8 -use strict;
10 # see INSTALL for instructions.
12 @@ -34,6 +33,7 @@
13 # (Default: KRB5_DIR/include)
14 # --with-krb5-flavor Declare what flavor of Kerberos 5 is used. Currently
15 # supported values are "MIT" and "Heimdal". A value is required.
16 +# --with-cc compiler to use for $CC (useful if cc is a disguised gcc)
17 #
18 # --test-sanity Make a number of sanity checks on the data in this file.
19 # This is a debugging tool for OpenSSL developers.
20 @@ -113,6 +113,7 @@
21 #$bits2="THIRTY_TWO_BIT ";
22 my $bits1="THIRTY_TWO_BIT ";
23 my $bits2="SIXTY_FOUR_BIT ";
24 +my $ccarg;
26 my $x86_elf_asm="x86cpuid-elf.o:bn86-elf.o co86-elf.o:dx86-elf.o yx86-elf.o:ax86-elf.o:bx86-elf.o:mx86-elf.o:sx86-elf.o s512sse2-elf.o:cx86-elf.o:rx86-elf.o:rm86-elf.o:r586-elf.o";
27 my $x86_coff_asm="x86cpuid-cof.o:bn86-cof.o co86-cof.o:dx86-cof.o yx86-cof.o:ax86-cof.o:bx86-cof.o:mx86-cof.o:sx86-cof.o s512sse2-cof.o:cx86-cof.o:rx86-cof.o:rm86-cof.o:r586-cof.o";
28 @@ -402,8 +403,8 @@
30 #### IBM's AIX.
31 "aix3-cc", "cc:-O -DB_ENDIAN -qmaxmem=16384::(unknown):AIX::BN_LLONG RC4_CHAR:::",
32 -"aix-gcc", "gcc:-O -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
33 -"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X64",
34 +"aix-gcc", "gcc:-O -DB_ENDIAN::-D_THREAD_SAFE:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared:::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::",
35 +"aix64-gcc","gcc:-maix64 -O -DB_ENDIAN::-D_THREAD_SAFE:AIX::SIXTY_FOUR_BIT_LONG RC4_CHAR::aix_ppc64.o::::::::::dlfcn:aix-shared::-maix64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::",
36 # Below targets assume AIX 5. Idea is to effectively disregard $OBJECT_MODE
37 # at build time. $OBJECT_MODE is respected at ./config stage!
38 "aix-cc", "cc:-q32 -O -DB_ENDIAN -qmaxmem=16384 -qro -qroconst::-qthreaded:AIX::BN_LLONG RC4_CHAR::aix_ppc32.o::::::::::dlfcn:aix-shared::-q32:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)::-X 32",
39 @@ -697,6 +698,10 @@
40 {
41 exit(&test_sanity());
42 }
43 + elsif (/^--with-cc=(.*)$/)
44 + {
45 + $ccarg=$1
46 + }
47 elsif (/^reconfigure/ || /^reconf/)
48 {
49 if (open(IN,"<$Makefile"))
50 @@ -949,7 +954,7 @@
51 print "IsMK1MF=$IsMK1MF\n";
53 my @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
54 -my $cc = $fields[$idx_cc];
55 +my $cc = $ccarg ? $ccarg : $fields[$idx_cc];
56 my $cflags = $fields[$idx_cflags];
57 my $unistd = $fields[$idx_unistd];
58 my $thread_cflag = $fields[$idx_thread_cflag];
59 Index: config
60 --- config.orig 2007-08-01 13:21:35 +0200
61 +++ config 2007-10-17 12:13:48 +0200
62 @@ -401,9 +401,9 @@
64 # figure out if gcc is available and if so we use it otherwise
65 # we fallback to whatever cc does on the system
66 -GCCVER=`(gcc -dumpversion) 2>/dev/null`
67 +GCCVER=`(gcc -dumpversion 2>/dev/null && exit; cc --version 2>/dev/null | grep GCC >/dev/null && cc -dumpversion )`
68 if [ "$GCCVER" != "" ]; then
69 - CC=gcc
70 + CC=cc; gcc -dumpversion >/dev/null 2>&1 && CC=gcc
71 # then strip off whatever prefix egcs prepends the number with...
72 # Hopefully, this will work for any future prefixes as well.
73 GCCVER=`echo $GCCVER | LC_ALL=C sed 's/^[a-zA-Z]*\-//'`
74 @@ -412,8 +412,10 @@
75 # major and minor version numbers.
76 # peak single digit before and after first dot, e.g. 2.95.1 gives 29
77 GCCVER=`echo $GCCVER | sed 's/\([0-9]\)\.\([0-9]\).*/\1\2/'`
78 + SUFFIX=gcc
79 else
80 CC=cc
81 + SUFFIX=cc
82 fi
83 GCCVER=${GCCVER:-0}
84 if [ "$SYSTEM" = "HP-UX" ];then
85 @@ -422,7 +424,7 @@
86 if [ $GCCVER -ge 30 ]; then
87 # PA64 support only came in with gcc 3.0.x.
88 # We check if the preprocessor symbol __LP64__ is defined...
89 - if echo "__LP64__" | gcc -v -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null; then
90 + if echo "__LP64__" | $CC -v -E -x c - 2>/dev/null | grep "^__LP64__" 2>&1 > /dev/null; then
91 : # __LP64__ has slipped through, it therefore is not defined
92 else
93 GCC_BITS="64"
94 @@ -433,13 +435,14 @@
95 if [ $GCCVER -ge 30 ]; then
96 # 64-bit ABI isn't officially supported in gcc 3.0, but it appears
97 # to be working, at the very least 'make test' passes...
98 - if gcc -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then
99 + if $CC -v -E -x c /dev/null 2>&1 | grep __arch64__ > /dev/null; then
100 GCC_ARCH="-m64"
101 else
102 GCC_ARCH="-m32"
103 fi
104 fi
105 # check for WorkShop C, expected output is "cc: blah-blah C x.x"
106 + if [ $GCCVER -eq 0 ]; then
107 CCVER=`(cc -V 2>&1) 2>/dev/null | \
108 egrep -e '^cc: .* C [0-9]\.[0-9]' | \
109 sed 's/.* C \([0-9]\)\.\([0-9]\).*/\1\2/'`
110 @@ -452,6 +455,7 @@
111 sleep 5
112 fi
113 fi
114 + fi
115 fi
117 if [ "${SYSTEM}-${MACHINE}" = "Linux-alpha" ]; then
118 @@ -469,6 +473,7 @@
120 if [ "${SYSTEM}" = "AIX" ]; then # favor vendor cc over gcc
121 (cc) 2>&1 | grep -iv "not found" > /dev/null && CC=cc
122 + (gcc) 2>&1 | grep -iv "not found" > /dev/null && CC=gcc
123 fi
125 CCVER=${CCVER:-0}
126 @@ -488,7 +493,7 @@
127 if [ $CPU -ge 4000 ]; then
128 options="$options -mips2"
129 fi
130 - OUT="irix-$CC"
131 + OUT="irix-$SUFFIX"
132 ;;
133 mips3-sgi-irix)
134 #CPU=`(hinv -t cpu) 2>/dev/null | head -1 | sed 's/^CPU:[^R]*R\([0-9]*\).*/\1/'`
135 @@ -498,11 +503,11 @@
136 #else
137 # options="$options -mips3"
138 #fi
139 - OUT="irix-mips3-$CC"
140 + OUT="irix-mips3-$SUFFIX"
141 ;;
142 mips4-sgi-irix64)
143 echo "WARNING! If you wish to build 64-bit library, then you have to"
144 - echo " invoke './Configure irix64-mips4-$CC' *manually*."
145 + echo " invoke './Configure irix64-mips4-$SUFFIX' *manually*."
146 if [ "$TEST" = "false" -a -t 1 ]; then
147 echo " You have about 5 seconds to press Ctrl-C to abort."
148 (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
149 @@ -514,7 +519,7 @@
150 #else
151 # options="$options -mips3"
152 #fi
153 - OUT="irix-mips3-$CC"
154 + OUT="irix-mips3-$SUFFIX"
155 ;;
156 ppc-apple-rhapsody) OUT="rhapsody-ppc-cc" ;;
157 ppc-apple-darwin*) OUT="darwin-ppc-cc" ;;
158 @@ -522,10 +527,10 @@
159 alpha-*-linux2)
160 ISA=`awk '/cpu model/{print$4;exit(0);}' /proc/cpuinfo`
161 case ${ISA:-generic} in
162 - *[678]) OUT="linux-alpha+bwx-$CC" ;;
163 - *) OUT="linux-alpha-$CC" ;;
164 + *[678]) OUT="linux-alpha+bwx-$SUFFIX" ;;
165 + *) OUT="linux-alpha-$SUFFIX" ;;
166 esac
167 - if [ "$CC" = "gcc" ]; then
168 + if [ $GCCVER -gt 0 ]; then
169 case ${ISA:-generic} in
170 EV5|EV45) options="$options -mcpu=ev5";;
171 EV56|PCA56) options="$options -mcpu=ev56";;
172 @@ -592,7 +597,7 @@
173 s390x-*-linux2) OUT="linux-generic64"; options="$options -DB_ENDIAN" ;;
174 x86_64-*-linux?) OUT="linux-x86_64" ;;
175 *86-*-linux2) OUT="linux-elf"
176 - if [ "$GCCVER" -gt 28 ]; then
177 + if [ $GCCVER -gt 28 ]; then
178 if grep '^model.*Pentium' /proc/cpuinfo >/dev/null ; then
179 options="$options -march=pentium"
180 fi
181 @@ -606,17 +611,17 @@
182 *-*-linux1) OUT="linux-aout" ;;
183 *-*-linux2) OUT="linux-generic32" ;;
184 sun4[uv]*-*-solaris2)
185 - OUT="solaris-sparcv9-$CC"
186 + OUT="solaris-sparcv9-$SUFFIX"
187 ISA64=`(isalist) 2>/dev/null | grep sparcv9`
188 if [ "$ISA64" != "" ]; then
189 - if [ "$CC" = "cc" -a $CCVER -ge 50 ]; then
190 + if [ $GCCVER -eq 0 -a $CCVER -ge 50 ]; then
191 echo "WARNING! If you wish to build 64-bit library, then you have to"
192 echo " invoke './Configure solaris64-sparcv9-cc' *manually*."
193 if [ "$TEST" = "false" -a -t 1 ]; then
194 echo " You have about 5 seconds to press Ctrl-C to abort."
195 (trap "stty `stty -g`" 2 0; stty -icanon min 0 time 50; read waste) <&1
196 fi
197 - elif [ "$CC" = "gcc" -a "$GCC_ARCH" = "-m64" ]; then
198 + elif [ $GCCVER -gt 0 -a "$GCC_ARCH" = "-m64" ]; then
199 # $GCC_ARCH denotes default ABI chosen by compiler driver
200 # (first one found on the $PATH). I assume that user
201 # expects certain consistency with the rest of his builds
202 @@ -639,21 +644,21 @@
203 fi
204 fi
205 ;;
206 - sun4m-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
207 - sun4d-*-solaris2) OUT="solaris-sparcv8-$CC" ;;
208 - sun4*-*-solaris2) OUT="solaris-sparcv7-$CC" ;;
209 + sun4m-*-solaris2) OUT="solaris-sparcv8-$SUFFIX" ;;
210 + sun4d-*-solaris2) OUT="solaris-sparcv8-$SUFFIX" ;;
211 + sun4*-*-solaris2) OUT="solaris-sparcv7-$SUFFIX" ;;
212 *86*-*-solaris2)
213 ISA64=`(isalist) 2>/dev/null | grep amd64`
214 - if [ "$ISA64" != "" ]; then
215 - OUT="solaris64-x86_64-$CC"
216 + if [ "$ISA64" != "" -a $GCCVER -gt 0 -a "$GCC_ARCH" = "-m64" ]; then
217 + OUT="solaris64-x86_64-$SUFFIX"
218 else
219 - OUT="solaris-x86-$CC"
220 + OUT="solaris-x86-$SUFFIX"
221 if [ `uname -r | sed -e 's/5\.//'` -lt 10 ]; then
222 options="$options no-sse2"
223 fi
224 fi
225 ;;
226 - *-*-sunos4) OUT="sunos-$CC" ;;
227 + *-*-sunos4) OUT="sunos-$SUFFIX" ;;
229 *86*-*-bsdi4) OUT="BSD-x86-elf"; options="$options no-sse2 -ldl" ;;
230 alpha*-*-*bsd*) OUT="BSD-generic64"; options="$options -DL_ENDIAN" ;;
231 @@ -677,7 +682,7 @@
232 *-*-osf) OUT="osf1-alpha-cc" ;;
233 *-*-tru64) OUT="tru64-alpha-cc" ;;
234 *-*-[Uu]nix[Ww]are7)
235 - if [ "$CC" = "gcc" ]; then
236 + if [ $GCCVER -gt 0 ]; then
237 OUT="unixware-7-gcc" ; options="$options no-sse2"
238 else
239 OUT="unixware-7" ; options="$options no-sse2 -D__i386__"
240 @@ -688,12 +693,12 @@
241 *-*-vos)
242 options="$options no-threads no-shared no-asm no-dso"
243 EXE=".pm"
244 - OUT="vos-$CC" ;;
245 + OUT="vos-$SUFFIX" ;;
246 BS2000-siemens-sysv4) OUT="BS2000-OSD" ;;
247 RM*-siemens-sysv4) OUT="ReliantUNIX" ;;
248 *-siemens-sysv4) OUT="SINIX" ;;
249 *-hpux1*)
250 - if [ $CC = "gcc" -a $GCC_BITS = "64" ]; then
251 + if [ $GCCVER -gt 0 -a $GCC_BITS = "64" ]; then
252 OUT="hpux64-parisc2-gcc"
253 fi
254 KERNEL_BITS=`(getconf KERNEL_BITS) 2>/dev/null`
255 @@ -711,8 +716,8 @@
256 fi
257 OUT="hpux64-ia64-cc"
258 elif [ $CPU_VERSION -ge 532 ]; then # PA-RISC 2.x CPU
259 - OUT=${OUT:-"hpux-parisc2-${CC}"}
260 - if [ $KERNEL_BITS -eq 64 -a "$CC" = "cc" ]; then
261 + OUT=${OUT:-"hpux-parisc2-${SUFFIX}"}
262 + if [ $KERNEL_BITS -eq 64 -a $GCCVER -eq 0 ]; then
263 echo "WARNING! If you wish to build 64-bit library then you have to"
264 echo " invoke './Configure hpux64-parisc2-cc' *manually*."
265 if [ "$TEST" = "false" -a -t 1 ]; then
266 @@ -721,19 +726,19 @@
267 fi
268 fi
269 elif [ $CPU_VERSION -ge 528 ]; then # PA-RISC 1.1+ CPU
270 - OUT="hpux-parisc-${CC}"
271 + OUT="hpux-parisc-${SUFFIX}"
272 elif [ $CPU_VERSION -ge 523 ]; then # PA-RISC 1.0 CPU
273 - OUT="hpux-parisc-${CC}"
274 + OUT="hpux-parisc-${SUFFIX}"
275 else # Motorola(?) CPU
276 - OUT="hpux-$CC"
277 + OUT="hpux-$SUFFIX"
278 fi
279 options="$options -D_REENTRANT" ;;
280 - *-hpux) OUT="hpux-parisc-$CC" ;;
281 + *-hpux) OUT="hpux-parisc-$SUFFIX" ;;
282 *-aix)
283 KERNEL_BITS=`(getconf KERNEL_BITMODE) 2>/dev/null`
284 KERNEL_BITS=${KERNEL_BITS:-32}
285 OBJECT_MODE=${OBJECT_MODE:-32}
286 - if [ "$CC" = "gcc" ]; then
287 + if [ $GCCVER -gt 0 ]; then
288 OUT="aix-gcc"
289 elif [ $OBJECT_MODE -eq 64 ]; then
290 echo 'Your $OBJECT_MODE was found to be set to 64'
291 @@ -828,7 +833,7 @@
292 #fi
294 if [ -z "$OUT" ]; then
295 - OUT="$CC"
296 + OUT="$SUFFIX"
297 fi
299 if [ ".$PERL" = . ] ; then
300 @@ -860,9 +865,9 @@
301 # compiler for the platform ... in which case we add it on
302 # the end ... otherwise we leave it off
304 -$PERL ./Configure LIST | grep "$OUT-$CC" > /dev/null
305 +$PERL ./Configure LIST | grep "$OUT-$SUFFIX" > /dev/null
306 if [ $? = "0" ]; then
307 - OUT="$OUT-$CC"
308 + OUT="$OUT-$SUFFIX"
309 fi
311 OUT="$PREFIX$OUT"
312 @@ -872,9 +877,9 @@
313 echo Configuring for $OUT
315 if [ "$TEST" = "true" ]; then
316 - echo $PERL ./Configure $OUT $options
317 + echo $PERL ./Configure $OUT --with-cc=$CC $options
318 else
319 - $PERL ./Configure $OUT $options
320 + $PERL ./Configure $OUT --with-cc=$CC $options
321 fi
322 else
323 echo "This system ($OUT) is not supported. See file INSTALL for details."
324 Index: crypto/objects/obj_dat.pl
325 --- crypto/objects/obj_dat.pl.orig 2005-08-29 01:20:47 +0200
326 +++ crypto/objects/obj_dat.pl 2007-10-17 12:13:48 +0200
327 @@ -1,9 +1,5 @@
328 #!/usr/local/bin/perl
330 -# fixes bug in floating point emulation on sparc64 when
331 -# this script produces off-by-one output on sparc64
332 -use integer;
333 -
334 sub obj_cmp
335 {
336 local(@a,@b,$_,$r);
337 Index: util/mklink.pl
338 --- util/mklink.pl.orig 2006-02-09 13:28:30 +0100
339 +++ util/mklink.pl 2007-10-17 12:13:48 +0200
340 @@ -15,13 +15,12 @@
341 # Apart from this, this script should be able to handle even the most
342 # pathological cases.
344 -use Cwd;
345 -
346 my $from = shift;
347 my @files = @ARGV;
349 my @from_path = split(/[\\\/]/, $from);
350 -my $pwd = getcwd();
351 +my $pwd = `pwd`;
352 +$pwd =~ s/\n$//s;
353 chomp($pwd);
354 my @pwd_path = split(/[\\\/]/, $pwd);