source: scripts/scripts/cross-scripts/cross-gcc-final.sh @ e0507947

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since e0507947 was e0507947, checked in by Jim Gifford <clfs@…>, 14 years ago

r2503@server (orig r1242): ryan | 2006-03-10 02:06:12 -0800

r1292@rei: lfs | 2006-03-07 20:00:23 +1100
gcc build script updates for gcc-4.1.0


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