source: scripts/cross-scripts/cross-gcc-static.sh@ 7882dc5

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