several changes to toolchain packages
[hdw-linux/hdw-linux.git] / packages / toolchain / binutils / binutils
1 # hdw - linux toolchain binutils package
2 #
3 # author: hackbard@hackdaworld.dyndns.org
4 #
5 # [V] 2.17
6 # [S] 0-1 0-4 0-5
7 # [D] binutils-2.17.tar.bz2 http://ftp.gnu.org/gnu/binutils/
8
9 if [ "$priority" = "1" ] ; then
10         confopt="$confopt --disable-nls"
11         libpath="$prefix/lib"
12         echo "libpath = $libpath"
13 fi
14
15 if [ "$priority" = "4" ] ; then
16         custmain=1
17         custmain()      {
18                 # install the ld linking against toolchain libc
19                 mv -v $prefix/bin/{ld,ld-old}
20                 mv -v $prefix/`gcc -dumpmachine`/bin/{ld,ld-old}
21                 mv -v $prefix/bin/{ld-new,ld}
22                 ln -sfv $prefix/bin/ld $prefix/`gcc -dumpmachine`/bin/ld
23
24                 # show new linker to gcc
25                 SPECFILE="`gcc -print-libgcc-file-name`"
26                 SPECFILE="`dirname $SPECFILE`/specs"
27                 gcc -dumpspecs | 
28                 sed -e "s@/lib/ld.so.1@$prefix/lib/ld.so.1@g" \
29                     -e "s@/lib/ld-linux.so.2@$prefix/lib/ld-linux.so.2@g" > \
30                         $SPECFILE
31                 echo "debug: (specfile ->$SPECFILE)"
32                 cp -v $SPECFILE $hdw_home_dir
33                 cat $SPECFILE
34                 echo "debug: (gcc -dumpspecs)"
35                 gcc -dumpspecs
36
37                 INCDIR="`dirname $SPECFILE`/include"
38                 unset SPECFILE
39
40                 # remove fixed includes from gcc's private include dir
41                 find $INCDIR/* -maxdepth 0 -xtype d -exec rm -rvf '{}' \;
42                 rm -vf `grep -l "DO NOT EDIT THIS FILE" $INCDIR/*`
43                 unset INCDIR
44                         }
45 fi
46
47 if [ "$priority" = "5" ] ; then
48         confopt="$confopt --disable-nls --with-lib-path=$prefix/lib"    
49         if [ "$hdw_crossbuild" = "0" ] ; then
50                 libpath="/usr/lib:/lib"
51         else
52                 libpath="$root/usr/lib:$root/lib"
53         fi
54 fi
55
56 build_main()    {
57         mkdir -p ../binutils-build
58         cd ../binutils-build
59         ../binutils-${ver}/configure $confopt &&
60         make $make_conf &&
61         make $install_conf install
62                 }
63
64 post_install()  {
65         # build ld-new with changed linkers default library search path
66         # (glibc will go there)
67         make -C ld clean
68         make -C ld LIB_PATH=$libpath
69         cp -v ld/ld-new $prefix/bin
70                 }