use host system tools
[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] 4.0.0
6 # [S] 0-1 0-4
7 # [D] gcc-4.0.0.tar.bz2 ftp://ftp.fu-berlin.de/unix/gnu/gcc/gcc-4.0.0/
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 --enable-languages=c --disable-nls"
20
21         # use host system tools
22         hdw_arch_prefix=""
23         . ./scripts/optimization
24         unset CFLAGS
25
26         post_install()  {
27                 ln -sf gcc $prefix/bin/cc
28                         }
29 fi
30
31 if [ "$priority" = "4" ] ; then
32         confopt="$confopt --enable-clocale=gnu --enable-threads=posix"
33         confopt="$confopt --enable-__cxa_atexit --enable-languages=c,c++"
34         confopt="$confopt --disable-libstdcxx-pch"
35         make_conf=""
36
37         pre_install()   {
38                 echo "patching gcc specs now"
39                 for i in gcc/config/*/{pa-,}linux*.h; do
40                         echo "patching $i ..."
41                         mv $i $i.orig
42                 sed "s%-dynamic-linker /lib%-dynamic-linker $prefix/lib%g" \
43                         $i.orig > $i
44                 done
45                 # patch sysv4 entries
46                 for i in gcc/config/*/sysv4.h; do
47                         echo "patching $i ..."
48                         mv $i $i.orig
49                 sed "s%-dynamic-linker /lib%-dynamic-linker $prefix/lib%g" \
50                         $i.orig > $i
51                 done
52                 # sparc specific
53                 for i in gcc/config/sparc/linux*.h; do
54                         echo "patching $i ..."
55                         mv $i $i.orig
56                         sed "s%/usr/lib%$prefix/lib%g" $i.orig > $i
57                 done
58                 # general linux.h
59                 echo "patching gcc/config/linux.h ..."
60                 echo "#undef STANDARD_INCLUDE_DIR" >> gcc/config/linux.h
61                 echo "#define STANDARD_INCLUDE_DIR 0" >> gcc/config/linux.h
62                 # no fix includes
63         [ -f $hdw_home_dir/packages/base/gcc/no_fix_includes.patch ] && \
64         patch -Nfp1 < $hdw_home_dir/packages/base/gcc/no_fix_includes.patch
65                         }
66 fi
67
68 build_main()    {
69         mkdir -p ../gcc-build && cd ../gcc-build
70         ../gcc${extraver}/configure $confopt &&
71         make $make_conf &&
72         make install
73                 }