1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # cross-lfs cross-binutils build
|
---|
4 | # ------------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | cd ${SRC}
|
---|
12 | LOG="binutils-cross.log"
|
---|
13 |
|
---|
14 | #NOTE: This to be revisited... could well be satisfied by setup_multiarch...
|
---|
15 | set -x
|
---|
16 |
|
---|
17 | if [ "Y" = "${MULTIARCH}" ]; then
|
---|
18 | vendor_os=`echo ${TARGET} | sed 's@\([^-]*\)-\(.*\)@\2@'`
|
---|
19 | case ${TGT_ARCH} in
|
---|
20 | x86_64 )
|
---|
21 | ;;
|
---|
22 | mipsel* | mips64el )
|
---|
23 | TARGET=mips64el-${vendor_os}
|
---|
24 | ;;
|
---|
25 | sparc* )
|
---|
26 | TARGET=sparc64-${vendor_os}
|
---|
27 | ;;
|
---|
28 | powerpc* | ppc* )
|
---|
29 | TARGET=powerpc64-${vendor_os}
|
---|
30 | ;;
|
---|
31 | s390* )
|
---|
32 | TARGET=s390x-${vendor_os}
|
---|
33 | ;;
|
---|
34 | * )
|
---|
35 | # TODO: add some error messages etc
|
---|
36 | barf
|
---|
37 | ;;
|
---|
38 | esac
|
---|
39 | fi
|
---|
40 |
|
---|
41 | # if target is same as build host, adjust host slightly to
|
---|
42 | # trick configure so we do not produce native tools
|
---|
43 | if [ "${TARGET}" = "${BUILD}" ]; then
|
---|
44 | althost=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'`
|
---|
45 | extra_conf="--host=${althost}"
|
---|
46 | fi
|
---|
47 |
|
---|
48 | set +x
|
---|
49 |
|
---|
50 | unpack_tarball binutils-${BINUTILS_VER} &&
|
---|
51 |
|
---|
52 | # Determine whether this binutils requires
|
---|
53 | # 'make configure-host' and whether
|
---|
54 | # ld search path can be set with --with-lib-path.
|
---|
55 | # Returned in ${BINUTILS_CONF_HOST} and
|
---|
56 | # ${BINUTILS_WITH_LIB_PATH} respectively
|
---|
57 |
|
---|
58 | # TODO: check for architecture specific patches in check_binutils
|
---|
59 | # ( alpha )
|
---|
60 | check_binutils
|
---|
61 |
|
---|
62 | cd ${SRC}/${PKGDIR}
|
---|
63 |
|
---|
64 | case ${BINUTILS_VER} in
|
---|
65 | # 20031015 - fix static linking issues during testsuite
|
---|
66 | # with current CVS glibc. kernel 2.5.68+
|
---|
67 | # Will only patch HJL 2.14.90.0.[6-7]
|
---|
68 | 2.14.90.0.[6-7] ) apply_patch binutils-2.14.90.0.7-fix-static-link ;;
|
---|
69 |
|
---|
70 | # Issue with HJL binutils 2.15.94.0.1 stripping needed information
|
---|
71 | # one manifestation is with stripping TLS info from libc.a
|
---|
72 | 2.15.94.0.1 ) apply_patch binutils-2.15.94.0.1-fix-strip-1 ;;
|
---|
73 | esac
|
---|
74 |
|
---|
75 | # Check if we have sysroot set
|
---|
76 | if [ "${USE_SYSROOT}" = "Y" ]; then
|
---|
77 | # if sysroot not already defined, set it to ${LFS}
|
---|
78 | extra_conf="${extra_conf} --with-sysroot=${LFS}"
|
---|
79 | INSTALL_PREFIX=${LFS}/usr
|
---|
80 | else
|
---|
81 | # sysroot not set, just set libpath
|
---|
82 | test Y == "${BINUTILS_WITH_LIB_PATH}" &&
|
---|
83 | BINUTILS_LIB_PATH="--with-lib-path=${TGT_TOOLS}/lib" ||
|
---|
84 | BINUTILS_LIB_PATH=""
|
---|
85 |
|
---|
86 | INSTALL_PREFIX=${TGT_TOOLS}
|
---|
87 | fi
|
---|
88 |
|
---|
89 | # These are probably not required for sysrooted builds, but
|
---|
90 | # they don't hurt...
|
---|
91 | case ${BINUTILS_VER} in
|
---|
92 | 2.14 )
|
---|
93 | apply_patch binutils-2.14-genscripts-multilib
|
---|
94 | ;;
|
---|
95 | 2.14.90.0.8 )
|
---|
96 | apply_patch binutils-2.14.90.0.8-genscripts-multilib
|
---|
97 | ;;
|
---|
98 | # Following works for HJL and FSF binutils 2.15
|
---|
99 | 2.15.9[0124].0.* | 2.15 )
|
---|
100 | apply_patch binutils-2.15.91.0.1-genscripts-multilib-2
|
---|
101 | ;;
|
---|
102 | # Following works for HJL and FSF binutils 2.15
|
---|
103 | 2.16* )
|
---|
104 | apply_patch binutils-2.15.91.0.1-genscripts-multilib-2
|
---|
105 | ;;
|
---|
106 | esac
|
---|
107 |
|
---|
108 | cd ${SRC}
|
---|
109 |
|
---|
110 | # Remove pre-existing build directory and recreate
|
---|
111 | test -d binutils-${BINUTILS_VER}-cross-build &&
|
---|
112 | rm -rf binutils-${BINUTILS_VER}-cross-build
|
---|
113 |
|
---|
114 | mkdir binutils-${BINUTILS_VER}-cross-build
|
---|
115 | cd binutils-${BINUTILS_VER}-cross-build
|
---|
116 |
|
---|
117 | max_log_init Binutils ${BINUTILS_VER} Cross ${CONFLOGS} ${LOG}
|
---|
118 | ../${PKGDIR}/configure --prefix=${HST_TOOLS} \
|
---|
119 | --target=${TARGET} ${extra_conf} --disable-nls \
|
---|
120 | --enable-shared ${SYSROOT_OPTS} \
|
---|
121 | --enable-64-bit-bfd ${BINUTILS_LIB_PATH} \
|
---|
122 | >> ${LOGFILE} 2>&1 &&
|
---|
123 | {
|
---|
124 | # Run make configure-host if required
|
---|
125 | test Y != "${BINUTILS_CONF_HOST}" ||
|
---|
126 | {
|
---|
127 | echo -e "\nmake configure-host\n${BRKLN}" >> ${LOGFILE}
|
---|
128 | make configure-host >> ${LOGFILE} 2>&1
|
---|
129 | }
|
---|
130 | } &&
|
---|
131 | echo " o Configure OK" &&
|
---|
132 |
|
---|
133 | min_log_init ${BUILDLOGS} &&
|
---|
134 | #make ${PMFLAGS} headers -C bfd \
|
---|
135 | make headers -C bfd \
|
---|
136 | >> ${LOGFILE} 2>&1 &&
|
---|
137 | make \
|
---|
138 | >> ${LOGFILE} 2>&1 &&
|
---|
139 | echo " o Build OK" || barf
|
---|
140 |
|
---|
141 | min_log_init ${INSTLOGS} &&
|
---|
142 | make install \
|
---|
143 | >> ${LOGFILE} 2>&1 &&
|
---|
144 | echo " o All OK" || barf
|
---|
145 |
|
---|
146 | # Copy over libiberty.h
|
---|
147 | cp -p ${SRC}/${PKGDIR}/include/libiberty.h ${INSTALL_PREFIX}/include/libiberty.h
|
---|
148 |
|
---|