Scan dynamic libraries for GC roots
[delight/core.git] / patches / patch-build_gcc-5465
blob6e0b07fc98f3dec0b0f9c158146ab731bd5a9b9c
1 --- gcc-5465-orig/build_gcc     2007-07-20 13:53:27.000000000 -0400
2 +++ gcc-5465/build_gcc  2008-02-26 13:26:49.000000000 -0500
3 @@ -114,11 +114,12 @@
4  CONFIGFLAGS="--disable-checking -enable-werror \
5    --prefix=$DEST_ROOT \
6    --mandir=\${prefix}/share/man \
7 -  --enable-languages=c,objc,c++,obj-c++ \
8 +  --enable-languages=c,objc,c++,obj-c++,d \
9    --program-transform-name=/^[cg][^.-]*$/s/$/-$MAJ_VERS/ \
10    --with-gxx-include-dir=\${prefix}/include/c++/$LIBSTDCXX_VERSION \
11    --with-slibdir=/usr/lib \
12 -  --build=$BUILD-apple-darwin$DARWIN_VERS"
13 +  --build=$BUILD-apple-darwin$DARWIN_VERS \
14 +  $EXTRA_CONFIG_FLAGS"
16  # Figure out how many make processes to run.
17  SYSCTL=`sysctl -n hw.activecpu`
18 @@ -150,7 +151,7 @@
19  # Unset RC_DEBUG_OPTIONS because it causes the bootstrap to fail.
20  RC_DEBUG_OPTIONS= \
21    make $MAKEFLAGS $BOOTSTRAP CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
22 -make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
23 +#make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
24  make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \
25    CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1
27 @@ -253,9 +254,9 @@
28  rm -rf * || exit 1
30  # HTML documentation
31 -HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools"
32 -mkdir -p ".$HTMLDIR" || exit 1
33 -cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1
34 +#HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools"
35 +#mkdir -p ".$HTMLDIR" || exit 1
36 +#cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1
38  # Manual pages
39  mkdir -p .$DEST_ROOT/share || exit 1
40 @@ -287,7 +288,7 @@
41  # bin
42  # The native drivers ('native' is different in different architectures).
43  BIN_FILES=`ls $DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin | grep '^[^-]*-[0-9.]*$' \
44 -  | grep -v gccbug | grep -v gcov || exit 1`
45 +  | grep -v gccbug | grep -v gcov | grep -v gdmd || exit 1`
46  mkdir .$DEST_ROOT/bin
47  for f in $BIN_FILES ; do
48    lipo -output .$DEST_ROOT/bin/$f -create $DIR/dst-*$DEST_ROOT/bin/$f || exit 1
49 @@ -303,6 +304,8 @@
50      $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gcc-$VERS || exit 1
51    lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++-$VERS -create \
52      $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-g++* || exit 1
53 +  lipo -output .$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gdc-$VERS -create \
54 +    $DIR/dst-*-$t$DEST_ROOT/bin/$t-apple-darwin$DARWIN_VERS-gdc* || exit 1
55  done
57  # lib
58 @@ -351,6 +354,42 @@
59    fi
60  done
62 +# GDC: Phobos and gdmd
63 +if test -e $DIR/dst-$BUILD-$BUILD$DEST_ROOT/include/d2; then
64 +    phobos_sfx=2;
65 +else
66 +    phobos_sfx='';
67 +fi
68 +cp -p $DIR/dst-$BUILD-$BUILD$DEST_ROOT/bin/gdmd-* $DEST_DIR$DEST_ROOT/bin
69 +cp -pR $DIR/dst-$BUILD-$BUILD$DEST_ROOT/include/d$phobos_sfx $DEST_DIR$DEST_ROOT/include \
70 +    || exit 1
71 +phobos_lib_list=
72 +for t in $TARGETS ; do
73 +    if test $t = $BUILD ; then
74 +       phobos_lib_dir="$DIR/dst-$BUILD-$t$DEST_ROOT/lib"
75 +    else
76 +       cp -pR $DIR/dst-$BUILD-$t$DEST_ROOT/include/d$phobos_sfx/$VERS/$t-apple-darwin$DARWIN_VERS \
77 +           $DEST_DIR$DEST_ROOT/include/d$phobos_sfx/$VERS || exit 1
78 +       phobos_lib_dir="$DIR/dst-$BUILD-$t$DEST_ROOT/$t-apple-darwin$DARWIN_VERS/lib"
79 +    fi
80 +    phobos_lib_list="$phobos_lib_list $phobos_lib_dir/libgphobos$phobos_sfx.a"
82 +    # Get 64-bit variants
83 +    other_libdir=''
84 +    if test "$t" = i686; then
85 +       other_libdir="x86_64"
86 +    elif test "$t" = powerpc; then
87 +       other_libdir="ppc64"
88 +    fi
89 +    if test -n "$other_libdir"; then
90 +       other_phobos="$phobos_lib_dir/$other_libdir/libgphobos$phobos_sfx.a"
91 +       if test -r "$other_phobos"; then
92 +           phobos_lib_list="$phobos_lib_list $other_phobos"
93 +       fi
94 +    fi
95 +done
96 +lipo -output $DEST_DIR$DEST_ROOT/lib/libgphobos$phobos_sfx.a -create $phobos_lib_list || exit 1
98  # Add extra man page symlinks for 'c++' and for arch-specific names.
99  MDIR=$DEST_DIR$DEST_ROOT/share/man/man1
100  ln -f $MDIR/g++-$MAJ_VERS.1 $MDIR/c++-$MAJ_VERS.1 || exit 1
101 @@ -385,6 +424,17 @@
102          -L$DIR/obj-$h-$BUILD/libiberty/                                        \
103          -L$DIR/obj-$h-$h/libiberty/                                        \
104         -o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-g++-$MAJ_VERS || exit 1
106 +    $DIR/dst-$BUILD-$h$DEST_ROOT/bin/$h-apple-darwin$DARWIN_VERS-gcc-$VERS                 \
107 +       $ORIG_SRC_DIR/driverdriver.c                               \
108 +       -DPDN="\"-apple-darwin$DARWIN_VERS-gdc-$VERS\""                                    \
109 +       -DIL="\"$DEST_ROOT/bin/\"" -I  $ORIG_SRC_DIR/include                   \
110 +       -I  $ORIG_SRC_DIR/gcc -I  $ORIG_SRC_DIR/gcc/config                     \
111 +       -liberty -L$DIR/dst-$BUILD-$h$DEST_ROOT/lib/                           \
112 +       -L$DIR/dst-$BUILD-$h$DEST_ROOT/$h-apple-darwin$DARWIN_VERS/lib/                    \
113 +        -L$DIR/obj-$h-$BUILD/libiberty/                                        \
114 +        -L$DIR/obj-$h-$h/libiberty/                                        \
115 +       -o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-gdc-$MAJ_VERS || exit 1
116  done
117  # APPLE LOCAL end ARM native compiler support
119 @@ -394,10 +444,24 @@
120  lipo -output $DEST_DIR/$DEST_ROOT/bin/g++-$MAJ_VERS -create \
121    $DEST_DIR/$DEST_ROOT/bin/tmp-*-g++-$MAJ_VERS || exit 1
123 +lipo -output $DEST_DIR/$DEST_ROOT/bin/gdc-$MAJ_VERS -create \
124 +  $DEST_DIR/$DEST_ROOT/bin/tmp-*-gdc-$MAJ_VERS || exit 1
126  ln -f $DEST_DIR/$DEST_ROOT/bin/g++-$MAJ_VERS $DEST_DIR/$DEST_ROOT/bin/c++-$MAJ_VERS || exit 1
128  rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-gcc-$MAJ_VERS || exit 1
129  rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-g++-$MAJ_VERS || exit 1
130 +rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-gdc-$MAJ_VERS || exit 1
132 +# Build rdmd
133 +for h in $HOSTS ; do
134 +    $DEST_DIR$DEST_ROOT/bin/$h-apple-darwin$DARWIN_VERS-gdc-$VERS \
135 +       $ORIG_SRC_DIR/gcc/d/rdmd.d \
136 +       -o $DEST_DIR/$DEST_ROOT/bin/tmp-$h-rdmd || exit 1
137 +done
138 +lipo -output $DEST_DIR/$DEST_ROOT/bin/rdmd -create \
139 +  $DEST_DIR/$DEST_ROOT/bin/tmp-*-rdmd || exit 1
140 +rm $DEST_DIR/$DEST_ROOT/bin/tmp-*-rdmd || exit 1
142  ########################################
143  # Create SYM_DIR with information required for debugging.