source: scripts/target-scripts/target-binutils.sh@ 60454e2

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 60454e2 was 617118d, checked in by Jim Gifford <clfs@…>, 19 years ago

r561@server (orig r559): root | 2005-06-05 02:38:49 -0700
Fixed Directory Structure

  • Property mode set to 100755
File size: 3.7 KB
Line 
1#!/bin/bash
2
3# cross-lfs target binutils build
4# -------------------------------
5# $LastChangedBy$
6# $LastChangedDate$
7# $LastChangedRevision$
8# $HeadURL$
9#
10
11cd ${SRC}
12LOG="binutils-target.log"
13
14set_libdirname
15setup_multiarch
16
17if [ "${USE_SYSROOT}" = "Y" ]; then
18 BUILD_PREFIX=/usr
19 INSTALL_PREFIX="${LFS}${BUILD_PREFIX}"
20 INSTALL_OPTIONS="DESTDIR=${LFS}"
21else
22 BUILD_PREFIX=${TGT_TOOLS}
23 INSTALL_PREFIX="${TGT_TOOLS}"
24 INSTALL_OPTIONS=""
25fi
26
27if [ ! "${libdirname}" = "lib" ]; then
28 extra_conf="--libdir=${BUILD_PREFIX}/${libdirname}"
29fi
30
31
32# HACK
33if [ ! "X${TGT_CFLAGS}" = "X" ]; then
34 ARCH_CFLAGS="${TGT_CFLAGS} ${ARCH_CFLAGS}"
35fi
36
37# if target is same as build host, adjust build slightly to avoid running
38# configure checks which we cannot run
39if [ "${TARGET}" = "${BUILD}" ]; then
40 BUILD=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'`
41fi
42
43unpack_tarball binutils-${BINUTILS_VER} &&
44
45# Determine whether this binutils requires
46# 'make configure-host' and whether
47# ld search path can be set with --with-lib-path.
48# Returned in ${BINUTILS_CONF_HOST} and
49# ${BINUTILS_WITH_LIB_PATH} respectively
50
51# TODO: check for architecture specific patches in check_binutils
52# ( alpha )
53check_binutils
54
55cd ${SRC}/${PKGDIR}
56
57case ${BINUTILS_VER} in
58 # 20031015 - fix static linking issues during testsuite
59 # with current CVS glibc. kernel 2.5.68+
60 # Will only patch HJL 2.14.90.0.[6-7]
61 2.14.90.0.[6-7] ) apply_patch binutils-2.14.90.0.7-fix-static-link ;;
62
63 # Issue with HJL binutils 2.15.94.0.1 stripping needed information
64 # one manifestation is with stripping TLS info from libc.a
65 2.15.94.0.1 ) apply_patch binutils-2.15.94.0.1-fix-strip-1 ;;
66esac
67
68## Check if we have sysroot set
69if [ ! "${USE_SYSROOT}" = "Y" ]; then
70 # sysroot not set, just set libpath
71 test Y == "${BINUTILS_WITH_LIB_PATH}" &&
72 BINUTILS_LIB_PATH="--with-lib-path=${TGT_TOOLS}/lib" ||
73 BINUTILS_LIB_PATH=""
74fi
75
76# These are probably not required for sysrooted builds, but
77# they don't hurt...
78case ${BINUTILS_VER} in
79 2.14 )
80 apply_patch binutils-2.14-genscripts-multilib
81 ;;
82 2.14.90.0.8 )
83 apply_patch binutils-2.14.90.0.8-genscripts-multilib
84 ;;
85 2.15.9[0124].0.* | 2.15 )
86 apply_patch binutils-2.15.91.0.1-genscripts-multilib-2
87 ;;
88 2.16* )
89 apply_patch binutils-2.15.91.0.1-genscripts-multilib-2
90 ;;
91esac
92
93cd ${SRC}
94
95# Remove pre-existing build directory and recreate
96test -d binutils-${BINUTILS_VER}-target-build &&
97 rm -rf binutils-${BINUTILS_VER}-target-build
98
99mkdir binutils-${BINUTILS_VER}-target-build
100cd binutils-${BINUTILS_VER}-target-build
101
102max_log_init Binutils ${BINUTILS_VER} target ${CONFLOGS} ${LOG}
103CC="${TARGET}-gcc ${ARCH_CFLAGS}" ../${PKGDIR}/configure \
104 --prefix=${BUILD_PREFIX} \
105 --build=${BUILD} \
106 --host=${TARGET} \
107 --target=${TARGET} \
108 --disable-nls ${extra_conf} \
109 --enable-shared \
110 --enable-64-bit-bfd ${BINUTILS_LIB_PATH} \
111 >> ${LOGFILE} 2>&1 &&
112{
113 # Run make configure-host if required
114 test Y != "${BINUTILS_CONF_HOST}" ||
115 {
116 echo -e "\nmake configure-host\n${BRKLN}" >> ${LOGFILE}
117 make configure-host >> ${LOGFILE} 2>&1
118 }
119} &&
120echo " o Configure OK" &&
121
122min_log_init ${BUILDLOGS} &&
123make headers -C bfd \
124 >> ${LOGFILE} 2>&1 &&
125make \
126 >> ${LOGFILE} 2>&1 &&
127echo " o Build OK" || barf
128
129min_log_init ${INSTLOGS} &&
130make ${INSTALL_OPTIONS} install \
131 >> ${LOGFILE} 2>&1 &&
132echo " o All OK" || barf
133
134# Copy over libiberty.h
135cp -p ${SRC}/${PKGDIR}/include/libiberty.h ${INSTALL_PREFIX}/include/libiberty.h
Note: See TracBrowser for help on using the repository browser.