1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # cross-lfs native binutils build
|
---|
4 | # -------------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | cd ${SRC}
|
---|
12 | LOG="binutils-native.log"
|
---|
13 |
|
---|
14 | set_libdirname
|
---|
15 | setup_multiarch
|
---|
16 |
|
---|
17 | if [ ! "${libdirname}" = "lib" ]; then
|
---|
18 | extra_conf="--libdir=/usr/${libdirname}"
|
---|
19 | fi
|
---|
20 |
|
---|
21 | unpack_tarball binutils-${BINUTILS_VER} &&
|
---|
22 |
|
---|
23 | # Determine whether this binutils requires
|
---|
24 | # 'make configure-host' and whether
|
---|
25 | # ld search path can be set with --with-lib-path.
|
---|
26 | # Returned in ${BINUTILS_CONF_HOST} and
|
---|
27 | # ${BINUTILS_WITH_LIB_PATH} respectively
|
---|
28 |
|
---|
29 | # TODO: check for architecture specific patches in check_binutils
|
---|
30 | # ( alpha )
|
---|
31 | check_binutils
|
---|
32 |
|
---|
33 | cd ${SRC}/${PKGDIR}
|
---|
34 |
|
---|
35 | case ${BINUTILS_VER} in
|
---|
36 | # 20031015 - fix static linking issues during testsuite
|
---|
37 | # with current CVS glibc. kernel 2.5.68+
|
---|
38 | # Will only patch HJL 2.14.90.0.[6-7]
|
---|
39 | 2.14.90.0.[6-7] ) apply_patch binutils-2.14.90.0.7-fix-static-link ;;
|
---|
40 |
|
---|
41 | # Issue with HJL binutils 2.15.94.0.1 stripping needed information
|
---|
42 | # one manifestation is with stripping TLS info from libc.a
|
---|
43 | 2.15.94.0.1 ) apply_patch binutils-2.15.94.0.1-fix-strip-1 ;;
|
---|
44 | esac
|
---|
45 |
|
---|
46 | # remove libpath from ldscript search paths so we can use
|
---|
47 | # --libpath= to set library install location
|
---|
48 | # ( ie /usr/lib64 if building binutils bins and libs 64bit )
|
---|
49 | # TODO: we dont need the whole genscripts-multilib patch, we only really
|
---|
50 | # need to remove libpath
|
---|
51 | # TODO: also need to update patches for 2.14.x
|
---|
52 |
|
---|
53 | case ${BINUTILS_VER} in
|
---|
54 | 2.14 )
|
---|
55 | apply_patch binutils-2.14-genscripts-multilib
|
---|
56 | ;;
|
---|
57 | 2.14.90.0.8 )
|
---|
58 | apply_patch binutils-2.14.90.0.8-genscripts-multilib
|
---|
59 | ;;
|
---|
60 | 2.15.9[0124].0.* | 2.15 )
|
---|
61 | apply_patch binutils-2.15.91.0.1-genscripts-multilib-2
|
---|
62 | ;;
|
---|
63 | esac
|
---|
64 |
|
---|
65 | cd ${SRC}
|
---|
66 |
|
---|
67 | # Remove pre-existing build directory and recreate
|
---|
68 | test -d binutils-${BINUTILS_VER}-native-build &&
|
---|
69 | rm -rf binutils-${BINUTILS_VER}-native-build
|
---|
70 |
|
---|
71 | mkdir binutils-${BINUTILS_VER}-native-build
|
---|
72 | cd binutils-${BINUTILS_VER}-native-build
|
---|
73 |
|
---|
74 | # --host=${TARGET} here, or it will be set *-unknown-linux-gnu
|
---|
75 | max_log_init Binutils ${BINUTILS_VER} native ${CONFLOGS} ${LOG}
|
---|
76 | CC="${CC-gcc} ${ARCH_CFLAGS}" \
|
---|
77 | ../${PKGDIR}/configure \
|
---|
78 | --prefix=/usr \
|
---|
79 | --host=${TARGET} \
|
---|
80 | --disable-nls ${extra_conf} \
|
---|
81 | --enable-shared \
|
---|
82 | --enable-64-bit-bfd \
|
---|
83 | >> ${LOGFILE} 2>&1 &&
|
---|
84 | {
|
---|
85 | # Run make configure-host if required
|
---|
86 | test Y != "${BINUTILS_CONF_HOST}" ||
|
---|
87 | {
|
---|
88 | echo -e "\nmake configure-host\n${BRKLN}" >> ${LOGFILE}
|
---|
89 | make configure-host >> ${LOGFILE} 2>&1
|
---|
90 | }
|
---|
91 | } &&
|
---|
92 | echo " o Configure OK" &&
|
---|
93 |
|
---|
94 | min_log_init ${BUILDLOGS} &&
|
---|
95 | make ${PMFLAGS} LDFLAGS="-s" \
|
---|
96 | >> ${LOGFILE} 2>&1 &&
|
---|
97 | echo " o Build OK" || barf
|
---|
98 |
|
---|
99 | min_log_init ${TESTLOGS} &&
|
---|
100 | make -k check \
|
---|
101 | >> ${LOGFILE} 2>&1 &&
|
---|
102 | echo " o Test OK" || errmsg
|
---|
103 |
|
---|
104 | min_log_init ${INSTLOGS} &&
|
---|
105 | make install \
|
---|
106 | >> ${LOGFILE} 2>&1 &&
|
---|
107 | echo " o All OK" || barf
|
---|
108 |
|
---|
109 | # Copy over libiberty.h
|
---|
110 | cp -p ${SRC}/${PKGDIR}/include/libiberty.h /usr/include/libiberty.h
|
---|