source: scripts_home/scripts/cross-scripts/cross-gcc-final.sh@ 1c9c5c3

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

r624@server (orig r622): jim | 2005-10-31 12:40:28 -0800
Rearranging Archive

  • Property mode set to 100755
File size: 4.9 KB
RevLine 
[617118d]1#!/bin/bash
2
3# cross-lfs cross-gcc final build
4# -------------------------------
5# $LastChangedBy$
6# $LastChangedDate$
7# $LastChangedRevision$
8# $HeadURL$
9#
10### GCC ( shared ) ###
11
12cd ${SRC}
13
14LOG="gcc-cross-final.log"
15
16if [ "Y" = "${MULTIARCH}" ]; then
17 vendor_os=`echo ${TARGET} | sed 's@\([^-]*\)-\(.*\)@\2@'`
18 case ${TGT_ARCH} in
19 x86_64 )
20 ;;
21 sparc* )
22 TARGET=sparc64-${vendor_os}
23 ;;
24 powerpc* | ppc* )
25 TARGET=powerpc64-${vendor_os}
26 ;;
27 s390* )
28 TARGET=s390x-${vendor_os}
29 ;;
30 mips*el* )
31 TARGET=mips64el-${vendor_os}
32 ;;
33 * )
34 # TODO: add some error messages etc
35 barf
36 ;;
37 esac
38
39else
40 # If we are not multi-arch, disable multilib
41 extra_conf="--enable-multilib=no"
42
43 # HACK: this sets abi to n32 with mips... this should be handled
44 # by the multiarch funcs somehow... and set according to DEFAULTENV
45 case ${TGT_ARCH} in
46 mips* )
47 extra_conf="${extra_conf} --with-abi=${DEFAULTENV}"
48 ;;
49 esac
50fi
51
52# if target is same as build host, adjust host slightly to
53# trick configure so we do not produce native tools
54if [ "${TARGET}" = "${BUILD}" ]; then
55 althost=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'`
56 extra_conf="--host=${althost} ${extra_conf}"
57fi
58
59# if target has no floating point unit, use soft float
60if [ "${WITHOUT_FPU}" = "Y" ]; then
61 extra_conf="${extra_conf} --with-float=soft"
62fi
63
64unpack_tarball gcc-${GCC_VER}
65
66#3.0 20030427
67# Cannot trust ${GCC_VER} to supply us with the correct
68# gcc version (especially if cvs).
69# Grab it straight from version.c
70cd ${SRC}/${PKGDIR}
71target_gcc_ver=`grep version_string gcc/version.c | \
72 sed 's@.* = \(\|"\)\([0-9.]*\).*@\2@g'`
73# As of gcc4, the above doesn't cut it... check gcc/BASE-VER
74if [ -z "${target_gcc_ver}" -a -f gcc/BASE-VER ]; then
75 target_gcc_ver=`cat gcc/BASE-VER`
76fi
77
78# Apply linkonce patch for gcc (should be fixed come gcc 3.4.4)
79cd ${SRC}/${PKGDIR}
80case ${target_gcc_ver} in
81 3.4.3 ) apply_patch gcc-3.4.3-linkonce-1
82 apply_patch gcc-3.4.0-arm-bigendian
83 apply_patch gcc-3.4.0-arm-nolibfloat
84 apply_patch gcc-3.4.0-arm-lib1asm
85 apply_patch gcc-3.4.3-clean_exec_and_lib_search_paths_when_cross-1
86 ;;
87 4.0.0 ) apply_patch gcc-4.0.0-fix_tree_optimisation_PR21173
88 apply_patch gcc-4.0.0-reload_check_uninitialized_pseudos_PR20973
89 apply_patch gcc-4.0.0-clean_exec_and_lib_search_paths_when_cross-1
90 ;;
91esac
92
93# if we are using gcc-3.4x, set libexecdir to */${libdirname}
94case ${target_gcc_ver} in
95 3.4* | 4.* )
96 extra_conf="${extra_conf} --libexecdir=${HST_TOOLS}/${libdirname}"
97 ;;
98esac
99
100if [ "${USE_SYSROOT}" = "Y" ]; then
101 extra_conf="${extra_conf} --with-sysroot=${LFS}"
102else
103 # LFS style build
104 #----------------
105
106 # source functions for required gcc modifications
107 . ${SCRIPTS}/funcs/cross_gcc-funcs.sh
108
109 # Alter the generated specs file to
110 # o set dynamic linker to be under ${TGT_TOOLS}/lib{,32,64}
111 # o set startfile_prefix_spec so we search for startfiles
112 # under ${TGT_TOOLS}/lib/lib{,32,64}
113 gcc_specs_mod
114
115 # Set cpp's default include search path, and the header search path
116 # used by fixincludes to be ${TGT_TOOLS}/include
117 cpp_set_cross_system_header_dir
118
119 # fix configure so that shared libgcc gets built against the correct
120 # startfiles if the user sets ${TGT_TOOLS} = ${HOST_TOOLS}/${TARGET}
121 configure_fix_flags_for_target
122fi
123
124test -d ${SRC}/gcc-${GCC_VER}-cross-final &&
125 rm -rf ${SRC}/gcc-${GCC_VER}-cross-final
126
127mkdir -p ${SRC}/gcc-${GCC_VER}-cross-final &&
128cd ${SRC}/gcc-${GCC_VER}-cross-final &&
129
130# NOTE:
131# Some errors occur on solaris where bash syntax is used with a
132# standard /bin/sh ( ie: expecting $(command) to be evaluated )
133# To avoid this issue we override make's default shell with
134# /bin/bash
135# This is done via passing CONFIG_SHELL=/bin/bash to
136# configure, which uses this when it specifies SHELL in
137# the Makefiles.
138
139max_log_init Gcc ${GCC_VER} cross-pt2 ${CONFLOGS} ${LOG}
140#CONFIG_SHELL=/bin/bash \
141CFLAGS="-O2 ${HOST_CFLAGS} -pipe" \
142../${PKGDIR}/configure --prefix=${HST_TOOLS} \
143 --target=${TARGET} ${extra_conf} --with-local-prefix=${TGT_TOOLS} \
144 --enable-languages=c,c++ --enable-__cxa_atexit \
145 --enable-c99 --enable-long-long --enable-threads=posix \
146 --disable-nls --enable-shared \
147 >> ${LOGFILE} 2>&1 &&
148echo " o Configure OK" || barf
149# --enable-languages=c,c++,f77,objc,ada,java,pascal,treelang --enable-__cxa_atexit \
150
151min_log_init ${BUILDLOGS} &&
152#make ${PMFLAGS} BOOT_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" \
153# STAGE1_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" all \
154make ${PMFLAGS} \
155 CFLAGS_FOR_TARGET="-O2 -pipe ${TGT_CFLAGS}" \
156 CXXFLAGS_FOR_TARGET="-O2 -pipe ${TGT_CFLAGS}" \
157 >> ${LOGFILE} 2>&1 &&
158echo " o Build OK" || barf
159
160min_log_init ${INSTLOGS} &&
161make install \
162 >> ${LOGFILE} 2>&1 &&
163echo " o Install OK" || barf
164
Note: See TracBrowser for help on using the repository browser.