1 | #!/bin/bash
|
---|
2 |
|
---|
3 | # cross-lfs cross-gcc w static libgcc (no threads) build
|
---|
4 | # ------------------------------------------------------
|
---|
5 | # $LastChangedBy$
|
---|
6 | # $LastChangedDate$
|
---|
7 | # $LastChangedRevision$
|
---|
8 | # $HeadURL$
|
---|
9 | #
|
---|
10 |
|
---|
11 | cd ${SRC}
|
---|
12 |
|
---|
13 | LOG="gcc-cross-static-no-threads.log"
|
---|
14 |
|
---|
15 | if [ "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 |
|
---|
38 | else
|
---|
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
|
---|
49 | fi
|
---|
50 |
|
---|
51 | # if target is same as build host, adjust host slightly to
|
---|
52 | # trick configure so we do not produce native tools
|
---|
53 | if [ "${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}"
|
---|
56 | fi
|
---|
57 |
|
---|
58 | unpack_tarball gcc-${GCC_VER}
|
---|
59 |
|
---|
60 | #3.0 20030427
|
---|
61 | # Cannot trust ${GCC_VER} to supply us with the correct
|
---|
62 | # gcc version (especially if cvs).
|
---|
63 | # Grab it straight from version.c
|
---|
64 | cd ${SRC}/${PKGDIR}
|
---|
65 | target_gcc_ver=`grep version_string gcc/version.c | \
|
---|
66 | sed 's@.* = \(\|"\)\([0-9.]*\).*@\2@g'`
|
---|
67 | # As of gcc4, the above doesn't cut it... check gcc/BASE-VER
|
---|
68 | if [ -z "${target_gcc_ver}" -a -f gcc/BASE-VER ]; then
|
---|
69 | target_gcc_ver=`cat gcc/BASE-VER`
|
---|
70 | fi
|
---|
71 |
|
---|
72 | # Apply linkonce patch for gcc (should be fixed come gcc 3.4.4)
|
---|
73 | cd ${SRC}/${PKGDIR}
|
---|
74 | case ${target_gcc_ver} in
|
---|
75 | 3.4.3 ) apply_patch gcc-3.4.3-linkonce-1
|
---|
76 | apply_patch gcc-3.4.0-arm-bigendian
|
---|
77 | apply_patch gcc-3.4.0-arm-nolibfloat
|
---|
78 | apply_patch gcc-3.4.0-arm-lib1asm
|
---|
79 | apply_patch gcc-3.4.3-clean_exec_and_lib_search_paths_when_cross-1
|
---|
80 | ;;
|
---|
81 | 4.0.0 ) apply_patch gcc-4.0.0-fix_tree_optimisation_PR21173
|
---|
82 | apply_patch gcc-4.0.0-reload_check_uninitialized_pseudos_PR20973
|
---|
83 | apply_patch gcc-4.0.0-clean_exec_and_lib_search_paths_when_cross-1
|
---|
84 | ;;
|
---|
85 | esac
|
---|
86 |
|
---|
87 | # if we are using gcc-3.4x, set libexecdir to */${libdirname}
|
---|
88 | case ${target_gcc_ver} in
|
---|
89 | 3.4* | 4.* )
|
---|
90 | extra_conf="${extra_conf} --libexecdir=${HST_TOOLS}/${libdirname}"
|
---|
91 | ;;
|
---|
92 | esac
|
---|
93 |
|
---|
94 | # for some reason the build breaks in the absence of any target glibc headers if
|
---|
95 | # a sysroot is used.
|
---|
96 | if [ ! "${USE_SYSROOT}" = "Y" ]; then
|
---|
97 | # LFS style build
|
---|
98 | #----------------
|
---|
99 |
|
---|
100 | # source functions for required gcc modifications
|
---|
101 | . ${SCRIPTS}/funcs/cross_gcc-funcs.sh
|
---|
102 |
|
---|
103 | # Alter the generated specs file to
|
---|
104 | # o set dynamic linker to be under ${TGT_TOOLS}/lib{,32,64}
|
---|
105 | # o set startfile_prefix_spec so we search for startfiles
|
---|
106 | # under ${TGT_TOOLS}/lib/lib{,32,64}
|
---|
107 | gcc_specs_mod
|
---|
108 |
|
---|
109 | # Set cpp's default include search path, and the header search path
|
---|
110 | # used by fixincludes to be ${TGT_TOOLS}/include
|
---|
111 | cpp_set_cross_system_header_dir
|
---|
112 | fi
|
---|
113 |
|
---|
114 | test -d ${SRC}/gcc-${GCC_VER}-cross-static-no-threads &&
|
---|
115 | rm -rf ${SRC}/gcc-${GCC_VER}-cross-static-no-threads
|
---|
116 |
|
---|
117 | mkdir -p ${SRC}/gcc-${GCC_VER}-cross-static-no-threads &&
|
---|
118 | cd ${SRC}/gcc-${GCC_VER}-cross-static-no-threads
|
---|
119 |
|
---|
120 | # initial run does not produce a libgcc_eh.a, nor
|
---|
121 | # libgcc_s.so, gcc_eh objects are packed into the standard libgcc.a .
|
---|
122 | # We'd need crt[i1n].o to build these.
|
---|
123 | #
|
---|
124 | # Unfortunately glibc requires we have libgcc_eh.a for building against
|
---|
125 | #
|
---|
126 |
|
---|
127 | # NOTE:
|
---|
128 | # Some errors occur on solaris where bash syntax is used with a
|
---|
129 | # standard /bin/sh ( ie: expecting $(command) to be evaluated )
|
---|
130 | # To avoid this issue we override make's default shell with
|
---|
131 | # /bin/bash
|
---|
132 | # This is done via passing CONFIG_SHELL=/bin/bash to
|
---|
133 | # configure, which uses this when it specifies SHELL in
|
---|
134 | # the Makefiles.
|
---|
135 |
|
---|
136 | max_log_init Gcc ${GCC_VER} cross-pt1 ${CONFLOGS} ${LOG}
|
---|
137 | #CONFIG_SHELL=/bin/bash \
|
---|
138 | CFLAGS="-O2 ${HOST_CFLAGS} -pipe" \
|
---|
139 | ../${PKGDIR}/configure --prefix=${HST_TOOLS} \
|
---|
140 | --target=${TARGET} ${extra_conf} \
|
---|
141 | --with-local-prefix=${TGT_TOOLS} --enable-languages=c \
|
---|
142 | --disable-nls --disable-shared --disable-threads \
|
---|
143 | >> ${LOGFILE} 2>&1 &&
|
---|
144 | echo " o Configure OK" || barf
|
---|
145 |
|
---|
146 | min_log_init ${BUILDLOGS} &&
|
---|
147 | #make ${PMFLAGS} BOOT_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" \
|
---|
148 | # STAGE1_CFLAGS="-O ${HOST_CFLAGS} -pipe" all-gcc \
|
---|
149 | make all-gcc \
|
---|
150 | >> ${LOGFILE} 2>&1 &&
|
---|
151 | echo " o Build OK" || barf
|
---|
152 |
|
---|
153 | min_log_init ${INSTLOGS} &&
|
---|
154 | make install-gcc \
|
---|
155 | >> ${LOGFILE} 2>&1 &&
|
---|
156 | echo " o Install OK" || barf
|
---|
157 |
|
---|