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