initial checkin of new hdw-linux development cvs repository
[hdw-linux/hdw-linux.git] / packages / toolchain / gcc / gcc
1 # hdw - linux toolchain gcc package
2 #
3 # author: hackbard@hackdaworld.dyndns.org
4 #
5 # [V] 3.3.4
6 # [S] 0-1 0-4
7 # [D] gcc-3.3.4.tar.bz2 ftp://ftp.fu-berlin.de/unix/gnu/gcc/gcc-3.3.4/
8
9
10 extraver="-$ver"
11 [ "$ver" = "cvs" ] && extraver=""
12
13 confopt="$confopt --enable-shared --with-local-prefix=$prefix"
14 confopt="$confopt --libexecdir=$prefix/lib"
15
16 unset CFLAGS
17
18 if [ "$priority" = "1" ] ; then
19         confopt=${confopt//--host* /--host=$hdw_arch_build }
20         confopt="$confopt --enable-languages=c --disable-nls"
21
22         # use host system gcc tools
23         export CC="gcc"
24         export CXX="c++"
25
26         make_conf="BOOT_LDFLAGS=\"-static\" bootstrap"
27
28         post_install()  {
29                 ln -sf gcc $prefix/bin/cc
30                         }
31 fi
32
33 if [ "$priority" = "4" ] ; then
34         confopt="$confopt --enable-clocale=gnu --enable-threads=posix"
35         confopt="$confopt --enable-__cxa_atexit --enable-languages=c,c++"
36         confopt="$confopt --disable-libstdcxx-pch"
37         make_conf=""
38
39         pre_install()   {
40                 echo "patching gcc specs now"
41                 for i in gcc/config/*/{pa-,}linux*.h; do
42                         echo "patching $i ..."
43                         mv $i $i.orig
44                 sed "s%-dynamic-linker /lib%-dynamic-linker $prefix/lib%g" \
45                         $i.orig > $i
46                 done
47                 # patch sysv4 entries
48                 for i in gcc/config/*/sysv4.h; do
49                         echo "patching $i ..."
50                         mv $i $i.orig
51                 sed "s%-dynamic-linker /lib%-dynamic-linker $prefix/lib%g" \
52                         $i.orig > $i
53                 done
54                 # sparc specific
55                 for i in gcc/config/sparc/linux*.h; do
56                         echo "patching $i ..."
57                         mv $i $i.orig
58                         sed "s%/usr/lib%$prefix/lib%g" $i.orig > $i
59                 done
60                 # general linux.h
61                 echo "patching gcc/config/linux.h ..."
62                 echo "#undef STANDARD_INCLUDE_DIR" >> gcc/config/linux.h
63                 echo "#define STANDARD_INCLUDE_DIR 0" >> gcc/config/linux.h
64                 # no fix includes
65         [ -f $hdw_home_dir/packages/base/gcc/no_fix_includes.patch ] && \
66         patch -Nfp1 < $hdw_home_dir/packages/base/gcc/no_fix_includes.patch
67                         }
68 fi
69
70 build_main()    {
71         mkdir -p ../gcc-build && cd ../gcc-build
72         ../gcc${extraver}/configure $confopt &&
73         make $make_conf &&
74         make install
75                 }