Bump version to gcc-4055.
[official-gcc.git] / build_gcc
blob61e7bb84f3d9c5878a9e7100cb24d32f049cc639
1 #!/bin/sh
2 # APPLE LOCAL file B&I
4 set -x
6 # -arch arguments are different than configure arguments. We need to
7 # translate them.
9 TRANSLATE_ARCH="sed -e s/ppc/powerpc/ -e s/i386/i686/"
11 # Build GCC the "Apple way".
12 # Parameters:
14 # The first parameter is a space-separated list of the architectures
15 # the compilers will run on. For instance, "ppc i386". If the
16 # current machine isn't in the list, it will (effectively) be added.
17 HOSTS=`echo $1 | $TRANSLATE_ARCH `
19 # The second parameter is a space-separated list of the architectures the
20 # compilers will generate code for. If the current machine isn't in
21 # the list, a compiler for it will get built anyway, but won't be
22 # installed.
23 TARGETS=`echo $2 | $TRANSLATE_ARCH`
25 # The GNU makefile target ('bootstrap' by default).
26 BOOTSTRAP=${BOOTSTRAP-bootstrap}
28 # The B&I build srcript (~rc/bin/buildit) accepts an '-othercflags'
29 # command-line flag, and captures the argument to that flag in
30 # $RC_NONARCH_CFLAGS (and mysteriously prepends '-pipe' thereto).
31 # We will allow this to override the default $CFLAGS and $CXXFLAGS.
33 CFLAGS=${RC_NONARCH_CFLAGS/-pipe/}
34 CFLAGS=${CFLAGS:-"-g -O2"}
36 # This isn't a parameter; it is the architecture of the current machine.
37 BUILD=`arch | $TRANSLATE_ARCH`
39 # The third parameter is the path to the compiler sources. There should
40 # be a shell script named 'configure' in this directory. This script
41 # makes a copy...
42 ORIG_SRC_DIR="$3"
44 # The fourth parameter is the location where the compiler will be installed,
45 # normally "/usr". You can move it once it's built, so this mostly controls
46 # the layout of $DEST_DIR.
47 DEST_ROOT="$4"
49 # The fifth parameter is the place where the compiler will be copied once
50 # it's built.
51 DEST_DIR="$5"
53 # The sixth parameter is a directory in which to place information (like
54 # unstripped executables and generated source files) helpful in debugging
55 # the resulting compiler.
56 SYM_DIR="$6"
58 # The current working directory is where the build will happen.
59 # It may already contain a partial result of an interrupted build,
60 # in which case this script will continue where it left off.
61 DIR=`pwd`
63 # This isn't a parameter; it's the version of the compiler that we're
64 # about to build. It's included in the names of various files and
65 # directories in the installed image.
66 VERS=`sed -n -e '/version_string/s/.*\"\([^ \"]*\)[ \"].*/\1/p' \
67 < $ORIG_SRC_DIR/gcc/version.c || exit 1`
69 # This isn't a parameter either, it's the major version of the compiler
70 # to be built. It's VERS but only up to the second '.' (if there is one).
71 MAJ_VERS=`echo $VERS | sed 's/\([0-9]*\.[0-9]*\)[.-].*/\1/'`
73 # Sniff to see if we can do ppc64 building.
74 DARWIN_VERS=8
75 if [ x"`file /usr/lib/crt1.o | grep 'architecture ppc64'`" == x ]; then
76 DARWIN_VERS=7
79 echo DARWIN_VERS = $DARWIN_VERS
81 ########################################
82 # Run the build.
84 # Create the source tree we'll actually use to build, deleting
85 # tcl since it doesn't actually build properly in a cross environment
86 # and we don't really need it.
87 SRC_DIR=$DIR/src
88 rm -rf $SRC_DIR || exit 1
89 mkdir $SRC_DIR || exit 1
90 ln -s $ORIG_SRC_DIR/* $SRC_DIR/ || exit 1
91 rm -rf $SRC_DIR/tcl $SRC_DIR/expect $SRC_DIR/dejagnu || exit 1
93 # These are the configure and build flags that are used.
94 CONFIGFLAGS="--disable-checking \
95 --prefix=$DEST_ROOT \
96 --mandir=\${prefix}/share/man \
97 --enable-languages=c,objc,c++,obj-c++ \
98 --program-transform-name=/^[cg][^+.-]*$/s/$/-$MAJ_VERS/ \
99 --with-gxx-include-dir=\${prefix}/include/gcc/darwin/$MAJ_VERS/c++ \
100 --build=$BUILD-apple-darwin$DARWIN_VERS"
102 # For 64-bit bringup
103 if [ "$VERS" == "3.5.0" ]; then
104 CONFIGFLAGS="$CONFIGFLAGS --enable-bringup --disable-shared --enable-static"
107 # Figure out how many make processes to run.
108 SYSCTL=`sysctl -n hw.activecpu`
110 # hw.activecpu only available in 10.2.6 and later
111 if [ -z "$SYSCTL" ]; then
112 SYSCTL=`sysctl -n hw.ncpu`
115 # sysctl -n hw.* does not work when invoked via B&I chroot /BuildRoot.
116 # Builders can default to 2, since even if they are single processor,
117 # nothing else is running on the machine.
118 if [ -z "$SYSCTL" ]; then
119 SYSCTL=2
122 # The $LOCAL_MAKEFLAGS variable can be used to override $MAKEFLAGS.
123 MAKEFLAGS=${LOCAL_MAKEFLAGS-"-j $SYSCTL"}
125 # Build the native GCC. Do this even if the user didn't ask for it
126 # because it'll be needed for the bootstrap.
127 mkdir -p $DIR/obj-$BUILD-$BUILD $DIR/dst-$BUILD-$BUILD || exit 1
128 cd $DIR/obj-$BUILD-$BUILD || exit 1
129 if [ \! -f $DIR/$BUILD-configured ] ; then
130 $SRC_DIR/configure $CONFIGFLAGS \
131 --host=$BUILD-apple-darwin$DARWIN_VERS --target=$BUILD-apple-darwin$DARWIN_VERS || exit 1
132 touch $DIR/$BUILD-configured || exit 1
134 make $MAKEFLAGS $BOOTSTRAP CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
135 make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \
136 CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
138 # Add the compiler we just built to the path, giving it appropriate names.
139 D=$DIR/dst-$BUILD-$BUILD/usr/bin
140 ln -f $D/gcc-$MAJ_VERS $D/gcc || exit 1
141 ln -f $D/gcc $D/$BUILD-apple-darwin$DARWIN_VERS-gcc || exit 1
142 PATH=$DIR/dst-$BUILD-$BUILD/usr/bin:$PATH
144 # The cross-tools' build process expects to find certain programs
145 # under names like 'i386-apple-darwin$DARWIN_VERS-ar'; so make them.
146 # Annoyingly, ranlib changes behaviour depending on what you call it,
147 # so we have to use a shell script for indirection, grrr.
148 rm -rf $DIR/bin || exit 1
149 mkdir $DIR/bin || exit 1
150 for prog in ar nm ranlib ; do
151 for t in `echo $TARGETS $HOSTS | sort -u`; do
152 P=$DIR/bin/${t}-apple-darwin$DARWIN_VERS-${prog}
153 echo '#!/bin/sh' > $P || exit 1
154 echo 'exec /usr/bin/'${prog}' $*' >> $P || exit 1
155 chmod a+x $P || exit 1
156 done
157 done
158 PATH=$DIR/bin:$PATH
160 # Build the cross-compilers, using the compiler we just built.
161 for t in $TARGETS ; do
162 if [ $t != $BUILD ] ; then
163 mkdir -p $DIR/obj-$BUILD-$t $DIR/dst-$BUILD-$t || exit 1
164 cd $DIR/obj-$BUILD-$t || exit 1
165 $SRC_DIR/configure $CONFIGFLAGS \
166 --program-prefix=$t-apple-darwin$DARWIN_VERS- \
167 --host=$BUILD-apple-darwin$DARWIN_VERS --target=$t-apple-darwin$DARWIN_VERS || exit 1
168 make $MAKEFLAGS all CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
169 make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$t install-gcc install-target \
170 CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
172 # Add the compiler we just built to the path.
173 PATH=$DIR/dst-$BUILD-$t/usr/bin:$PATH
175 done
177 # Rearrange various libraries, for no really good reason.
178 for t in $TARGETS ; do
179 DT=$DIR/dst-$BUILD-$t
180 D=`echo $DT/usr/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS`
181 if [ $t == $BUILD ] ; then
182 mv $DT/usr/lib/libstdc++.a $D || exit 1
183 mv $DT/usr/lib/libsupc++.a $D || exit 1
184 # 64-bit bringup
185 if [ -f $DT/usr/lib/ppc64/libstdc++.a ]; then
186 mv $DT/usr/lib/ppc64/libstdc++.a $D/ppc64 || exit 1
187 mv $DT/usr/lib/ppc64/libsupc++.a $D/ppc64 || exit 1
189 else
190 DD=$DT/usr/${t}-apple-darwin$DARWIN_VERS/lib
191 mv $DD/libstdc++.a $D || exit 1
192 mv $DD/libsupc++.a $D || exit 1
193 # 64-bit bringup
194 if [ -f $DD/ppc64/libstdc++.a ]; then
195 mv $DD/ppc64/libstdc++.a $D/ppc64 || exit 1
196 mv $DD/ppc64/libsupc++.a $D/ppc64 || exit 1
199 mv $D/static/libgcc.a $D/libgcc_static.a || exit 1
200 mv $D/kext/libgcc.a $D/libcc_kext.a || exit 1
201 rm -r $D/static $D/kext || exit 1
202 done
204 # Make all symbols in libgcc.a private extern. This is a temporary fix
205 # and should be removed after we merge with mainline 4.0 final.
206 for t in $TARGETS ; do
207 DT=$DIR/dst-$BUILD-$t
208 D=`echo $DT/usr/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS`
209 D64=$D/ppc64
211 for lib in $D/libgcc.a $D/libgcc_eh.a $D/libgcc_static.a $D/libgcc_eh.a $D64/libgcc.a $D64/libgcc_eh.a $D/libcc_kext.a ; do
212 if [ -f $lib ] ; then
213 nmedit -p $lib
215 done
216 done
218 # Build the cross-hosted compilers.
219 for h in $HOSTS ; do
220 if [ $h != $BUILD ] ; then
221 for t in $TARGETS ; do
222 mkdir -p $DIR/obj-$h-$t $DIR/dst-$h-$t || exit 1
223 cd $DIR/obj-$h-$t || exit 1
224 if [ $h = $t ] ; then
226 else
227 pp=$t-apple-darwin$DARWIN_VERS-
230 $SRC_DIR/configure $CONFIGFLAGS \
231 --program-prefix=$pp \
232 --host=$h-apple-darwin$DARWIN_VERS --target=$t-apple-darwin$DARWIN_VERS || exit 1
233 make $MAKEFLAGS all-gcc CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
234 make $MAKEFLAGS DESTDIR=$DIR/dst-$h-$t install-gcc \
235 CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
236 done
238 done
240 ########################################
241 # Construct the actual destination root, by copying stuff from
242 # $DIR/dst-* to $DEST_DIR, with occasional 'lipo' commands.
244 cd $DEST_DIR || exit 1
246 # Clean out DEST_DIR in case -noclean was passed to buildit.
247 rm -rf * || exit 1
249 # HTML documentation
250 HTMLDIR="/Developer/ADC Reference Library/documentation/DeveloperTools"
251 mkdir -p ".$HTMLDIR" || exit 1
252 cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/doc/HTML/* ".$HTMLDIR/" || exit 1
254 # Manual pages
255 mkdir -p .$DEST_ROOT/share || exit 1
256 cp -Rp $DIR/dst-$BUILD-$BUILD$DEST_ROOT/share/man .$DEST_ROOT/share/ \
257 || exit 1
259 # libexec
260 cd $DIR/dst-$BUILD-$BUILD$DEST_ROOT/libexec/gcc/$BUILD-apple-darwin$DARWIN_VERS/$VERS \
261 || exit 1
262 LIBEXEC_FILES=`find . -type f -print || exit 1`
263 LIBEXEC_DIRS=`find . -type d -print || exit 1`
264 cd $DEST_DIR || exit 1
265 for t in $TARGETS ; do
266 DL=$DEST_ROOT/libexec/gcc/$t-apple-darwin$DARWIN_VERS/$VERS
267 for d in $LIBEXEC_DIRS ; do
268 mkdir -p .$DL/$d || exit 1
269 done
270 for f in $LIBEXEC_FILES ; do
271 if file $DIR/dst-*-$t$DL/$f | grep -q 'Mach-O executable' ; then
272 lipo -output .$DL/$f -create $DIR/dst-*-$t$DL/$f || exit 1
273 else
274 cp -p $DIR/dst-$BUILD-$t$DL/$f .$DL/$f || exit 1
276 done
277 done
279 # bin
280 # The native drivers ('native' is different in different architectures).
281 BIN_FILES=`ls $DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin | grep '^[^-]*-[0-9.]*$' \
282 | grep -v gccbug | grep -v gcov || exit 1`
283 mkdir .$DEST_ROOT/bin
284 for f in $BIN_FILES ; do
285 lipo -output .$DEST_ROOT/bin/$f -create $DIR/dst-*$DEST_ROOT/bin/$f || exit 1
286 done
287 # gcov, which is special only because it gets built multiple times and lipo
288 # will complain if we try to add two architectures into the same output.
289 TARG0=`echo $TARGETS | cut -d ' ' -f 1`
290 lipo -output .$DEST_ROOT/bin/gcov-$MAJ_VERS -create \
291 $DIR/dst-*-$TARG0$DEST_ROOT/bin/*gcov* || exit 1
292 # The fully-named drivers, which have the same target on every host.
293 for t in $TARGETS ; do
294 lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gcc-$VERS -create \
295 $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gcc-$VERS || exit 1
296 lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++-$VERS -create \
297 $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++ || exit 1
298 done
300 # lib
301 mkdir -p .$DEST_ROOT/lib/gcc || exit 1
302 for t in $TARGETS ; do
303 cp -Rp $DIR/dst-$BUILD-$t$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS \
304 .$DEST_ROOT/lib/gcc || exit 1
305 done
307 SHARED_LIBS=`ls $DIR/dst-$BUILD-$BUILD$DEST_ROOT/lib | grep '\.dylib$'`
308 for l in $SHARED_LIBS ; do
309 F=$DIR/dst-$BUILD-$BUILD$DEST_ROOT/lib/$l
310 if [ \! -L $F ] ; then
311 # The following bit sniffs for a ppc64 libstdc++ dylib to lipo in.
312 multi=$DIR/dst-$BUILD-$BUILD$DEST_ROOT/lib/ppc64/$l
313 if [ \! -f $multi ] ; then
314 multi=
316 if [ -f $DIR/dst-$BUILD-*$DEST_ROOT/*-apple-darwin$DARWIN_VERS/lib/$l ] ; then
317 lipo -output .$DEST_ROOT/lib/$l -create $F $multi \
318 $DIR/dst-$BUILD-*$DEST_ROOT/*-apple-darwin$DARWIN_VERS/lib/$l || exit 1
319 else
320 cp -p $F .$DEST_ROOT/lib/$l || exit 1
322 F1=`echo $l \
323 | sed 's/\(\.[0-9]\{1,\}\)\(\.[0-9]\{1,\}\)\{1,\}\.dylib/\1.dylib/'`
324 F0=`echo $l | sed 's/\(\.[0-9]\{1,\}\)\{1,\}\.dylib/.dylib/'`
325 ln -s $l .$DEST_ROOT/lib/$F1 || exit 1
326 for t in $TARGETS ; do
327 ln -s ../../../$F1 .$DEST_ROOT/lib/gcc/$t-apple-darwin$DARWIN_VERS/$VERS/$F0 \
328 || exit 1
329 done
331 done
333 for l in $SHARED_LIBS ; do
334 F=$DEST_ROOT/lib/$l
335 F1=`echo $l \
336 | sed 's/\(\.[0-9]\{1,\}\)\(\.[0-9]\{1,\}\)\{1,\}\.dylib/\1.dylib/'`
337 if [ -f .$F ] ; then
339 # Now that we've lipo'ed things together, change the install name
340 # to match the official path. The destination should always be
341 # shorter than the full name, so this should always work. The
342 # install name should be the symlink with the major version number
343 # so that apps using the library (and the install name) will link
344 # against the symlink and get the latest version.
345 # Also change dependent library names so that libstdc++.6.0.2.dylib
346 # (for example) links against libgcc.1.dylib to avoid link errors.
348 install_name_tool -id $DEST_ROOT/lib/$F1 .$F
350 # At this point, l is the name of the library we're rewriting.
351 # .$DEST_ROOT/lib/$F1 is the major version of the library.
353 # For every other shared library: change the name from short name to major
354 for subl in $SHARED_LIBS ; do
355 SUBF=.$DEST_ROOT/lib/$subl
356 if [ -f $SUBF ] ; then
357 install_name_tool -change $DEST_ROOT/lib/$l $DEST_ROOT/lib/$F1 $SUBF
359 done
361 # For every other library and architecture, check to see if any of the
362 # dependent library names happens to be the bogus name given during a cross
363 # compile.
364 for usinglib in $SHARED_LIBS ; do
365 USINGPATH=.$DEST_ROOT/lib/$usinglib
366 if [ -f $USINGPATH ] ; then
367 for t1 in $TARGETS ; do
368 BADPATH=$DEST_ROOT/$t-apple-darwin$DARWIN_VERS/lib/$l
369 GOODPATH=$DEST_ROOT/lib/$F1
370 # Deal with the weird names generated for cross compiler portions.
371 install_name_tool -change $BADPATH $GOODPATH $USINGPATH
372 done
374 done
376 done
378 # include
379 HEADERPATH=$DEST_ROOT/include/gcc/darwin/$MAJ_VERS
380 mkdir -p .$HEADERPATH || exit 1
381 cp -Rp $DIR/dst-$BUILD-$BUILD$HEADERPATH/c++ \
382 .$HEADERPATH/ || exit 1
383 for t in $TARGETS ; do
384 DS=$HEADERPATH/c++
385 [ $t = $BUILD ] || \
386 cp -Rp $DIR/dst-$BUILD-$t$DS/$t-apple-darwin$DARWIN_VERS .$DS/ || exit 1
387 done
389 # Some headers are installed from more-hdrs/. They all share
390 # one common feature: they shouldn't be installed here. Sometimes,
391 # they should be part of FSF GCC and installed from there; sometimes,
392 # they should be installed by some completely different package; sometimes,
393 # they only exist for codewarrior compatibility and codewarrior should provide
394 # its own. We take care not to install the headers if Libc is already
395 # providing them.
396 cd $SRC_DIR/more-hdrs
397 for h in `echo *.h` ; do
398 if [ ! -f /usr/include/$h -o -L /usr/include/$h ] ; then
399 cp -R $h $DEST_DIR$HEADERPATH/$h || exit 1
400 for t in $TARGETS ; do
401 THEADERPATH=$DEST_DIR$DEST_ROOT/lib/gcc/${t}-apple-darwin$DARWIN_VERS/$VERS/include
402 [ -f $THEADERPATH/$h ] || \
403 ln -s ../../../../../include/gcc/darwin/$MAJ_VERS/$h $THEADERPATH/$h || \
404 exit 1
405 done
407 done
408 mkdir -p $DEST_DIR$HEADERPATH/machine
409 for h in `echo */*.h` ; do
410 if [ ! -f /usr/include/$h -o -L /usr/include/$h ] ; then
411 cp -R $h $DEST_DIR$HEADERPATH/$h || exit 1
412 for t in $TARGETS ; do
413 THEADERPATH=$DEST_DIR$DEST_ROOT/lib/gcc/${t}-apple-darwin$DARWIN_VERS/$VERS/include
414 mkdir -p $THEADERPATH/machine
415 # In fixincludes/fixinc.in we created this file... always link for now
416 [ -f /disable/$THEADERPATH/$h ] || \
417 ln -f -s ../../../../../../include/gcc/darwin/$MAJ_VERS/$h $THEADERPATH/$h || \
418 exit 1
419 done
421 done
423 # Install man pages using version number.
424 # Only g++ man page needs rename. gcc, cpp and gcov man page are already
425 # installed using proper name.
426 mv $DEST_DIR$DEST_ROOT/share/man/man1/g++.1 \
427 $DEST_DIR$DEST_ROOT/share/man/man1/g++-$MAJ_VERS.1
428 ln -f $DEST_DIR$DEST_ROOT/share/man/man1/g++-$MAJ_VERS.1 \
429 $DEST_DIR$DEST_ROOT/share/man/man1/c++-$MAJ_VERS.1
430 for t in $TARGETS ; do
431 ln -f $DEST_DIR$DEST_ROOT/share/man/man1/gcc-$MAJ_VERS.1 \
432 $DEST_DIR$DEST_ROOT/share/man/man1/$t-apple-darwin$DARWIN_VERS-gcc-$VERS.1
433 ln -f $DEST_DIR$DEST_ROOT/share/man/man1/g++-$MAJ_VERS.1 \
434 $DEST_DIR$DEST_ROOT/share/man/man1/$t-apple-darwin$DARWIN_VERS-g++-$VERS.1
435 done
437 # Build driver-driver using fully-named drivers
438 for t in $TARGETS ; do
439 $DEST_DIR$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gcc-$VERS \
440 $ORIG_SRC_DIR/gcc/config/darwin-driver.c \
441 -DPDN="\"-apple-darwin$DARWIN_VERS-gcc-$VERS\"" \
442 -DIL="\"$DEST_ROOT/bin/\"" -I $ORIG_SRC_DIR/include \
443 -I $ORIG_SRC_DIR/gcc -I $ORIG_SRC_DIR/gcc/config \
444 -liberty -L$DIR/dst-$BUILD-$t$DEST_ROOT/lib/ \
445 -L$DIR/dst-$BUILD-$t$DEST_ROOT/$t-apple-darwin$DARWIN_VERS/lib/ \
446 -o $DEST_DIR/$DEST_ROOT/bin/tmp-$t-gcc-$MAJ_VERS || exit 1
448 $DEST_DIR$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gcc-$VERS \
449 $ORIG_SRC_DIR/gcc/config/darwin-driver.c \
450 -DPDN="\"-apple-darwin$DARWIN_VERS-g++-$VERS\"" \
451 -DIL="\"$DEST_ROOT/bin/\"" -I $ORIG_SRC_DIR/include \
452 -I $ORIG_SRC_DIR/gcc -I $ORIG_SRC_DIR/gcc/config \
453 -liberty -L$DIR/dst-$BUILD-$t$DEST_ROOT/lib/ \
454 -L$DIR/dst-$BUILD-$t$DEST_ROOT/$t-apple-darwin$DARWIN_VERS/lib/ \
455 -o $DEST_DIR/$DEST_ROOT/bin/tmp-$t-g++-$MAJ_VERS || exit 1
456 done
458 lipo -output $DEST_DIR/$DEST_ROOT/bin/gcc-$MAJ_VERS -create \
459 $DEST_DIR/$DEST_ROOT/bin/tmp-*-gcc-$MAJ_VERS || exit 1
461 lipo -output $DEST_DIR/$DEST_ROOT/bin/g++-$MAJ_VERS -create \
462 $DEST_DIR/$DEST_ROOT/bin/tmp-*-g++-$MAJ_VERS || exit 1
464 ln -f $DEST_DIR/$DEST_ROOT/bin/g++-$MAJ_VERS $DEST_DIR/$DEST_ROOT/bin/c++-$MAJ_VERS || exit 1
466 rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-gcc-$MAJ_VERS || exit 1
467 rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-g++-$MAJ_VERS || exit 1
470 ########################################
471 # Save the source files and objects needed for debugging
473 cd $SYM_DIR || exit 1
475 # Clean out SYM_DIR in case -noclean was passed to buildit.
476 rm -rf * || exit 1
478 # Save executables and libraries.
479 cd $DEST_DIR || exit 1
480 find . \( -perm -0111 -or -name \*.a \) -type f -print \
481 | cpio -pdml $SYM_DIR || exit 1
482 # Save source files.
483 mkdir $SYM_DIR/src || exit 1
484 cd $DIR || exit 1
485 find obj-* -name \*.\[chy\] -print | cpio -pdml $SYM_DIR/src || exit 1
487 ########################################
488 # Strip the executables and libraries
489 find $DEST_DIR -perm -0111 \! -name \*.dylib -type f -print \
490 | xargs strip || exit 1
491 find $DEST_DIR \( -name \*.a -or -name \*.dylib \) -type f -print \
492 | xargs strip -SX || exit 1
493 find $DEST_DIR -name \*.a -type f -print \
494 | xargs ranlib || exit 1
496 if [ "$MAJ_VERS" = "3.5" ]; then
497 rm -f `find $DEST_DIR -name \*.dylib -print`
498 rm -f $DEST_DIR$DEST_ROOT/share/man/man7/fsf-funding.7
499 rm -f $DEST_DIR$DEST_ROOT/share/man/man7/gfdl.7
500 rm -f $DEST_DIR$DEST_ROOT/share/man/man7/gpl.7
503 # Done!
504 exit 0