[617118d] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | # cross-lfs target gcc build |
---|
| 4 | # -------------------------- |
---|
| 5 | # $LastChangedBy$ |
---|
| 6 | # $LastChangedDate$ |
---|
| 7 | # $LastChangedRevision$ |
---|
| 8 | # $HeadURL$ |
---|
| 9 | # |
---|
| 10 | |
---|
| 11 | cd ${SRC} |
---|
| 12 | |
---|
| 13 | LOG="gcc-target.log" |
---|
| 14 | |
---|
| 15 | set_libdirname |
---|
| 16 | setup_multiarch |
---|
| 17 | |
---|
| 18 | if [ "${USE_SYSROOT}" = "Y" ]; then |
---|
| 19 | BUILD_PREFIX=/usr |
---|
| 20 | INSTALL_PREFIX="${LFS}${BUILD_PREFIX}" |
---|
| 21 | INSTALL_OPTIONS="DESTDIR=${LFS}" |
---|
| 22 | else |
---|
| 23 | BUILD_PREFIX=${TGT_TOOLS} |
---|
| 24 | INSTALL_PREFIX="${TGT_TOOLS}" |
---|
| 25 | INSTALL_OPTIONS="" |
---|
| 26 | fi |
---|
| 27 | |
---|
| 28 | if [ ! "${libdirname}" = "lib" ]; then |
---|
| 29 | extra_conf="${extra_conf} --libdir=${BUILD_PREFIX}/${libdirname}" |
---|
| 30 | fi |
---|
| 31 | |
---|
| 32 | if [ "Y" = "${MULTIARCH}" ]; then |
---|
| 33 | vendor_os=`echo ${TARGET} | sed 's@\([^-]*\)-\(.*\)@\2@'` |
---|
| 34 | case ${TGT_ARCH} in |
---|
| 35 | x86_64 ) |
---|
| 36 | TARGET=x86_64-${vendor_os} |
---|
| 37 | ;; |
---|
| 38 | sparc64* ) |
---|
| 39 | TARGET=sparc64-${vendor_os} |
---|
| 40 | ;; |
---|
| 41 | sparc* ) |
---|
| 42 | TARGET=sparc64-${vendor_os} |
---|
| 43 | ;; |
---|
| 44 | powerpc* | ppc* ) |
---|
| 45 | TARGET=powerpc64-${vendor_os} |
---|
| 46 | ;; |
---|
| 47 | s390* ) |
---|
| 48 | TARGET=s390x-${vendor_os} |
---|
| 49 | ;; |
---|
| 50 | mips*el* ) |
---|
| 51 | TARGET=mips64el-${vendor_os} |
---|
| 52 | ;; |
---|
| 53 | * ) |
---|
| 54 | # TODO: add some error messages etc |
---|
| 55 | barf |
---|
| 56 | ;; |
---|
| 57 | esac |
---|
| 58 | else |
---|
| 59 | # If we are not bi-arch, disable multilib |
---|
| 60 | extra_conf="${extra_conf} --enable-multilib=no" |
---|
| 61 | |
---|
| 62 | # HACK: this sets abi to n32 with mips... this should be handled |
---|
| 63 | # by the multiarch funcs somehow... and set according to DEFAULTENV |
---|
| 64 | case ${TGT_ARCH} in |
---|
| 65 | mips* ) |
---|
| 66 | extra_conf="${extra_conf} --with-abi=${DEFAULTENV}" |
---|
| 67 | ;; |
---|
| 68 | esac |
---|
| 69 | fi |
---|
| 70 | |
---|
| 71 | # if target has no floating point unit, use soft float |
---|
| 72 | if [ "${WITHOUT_FPU}" = "Y" ]; then |
---|
| 73 | extra_conf="${extra_conf} --with-float=soft" |
---|
| 74 | fi |
---|
| 75 | |
---|
| 76 | unpack_tarball gcc-${GCC_VER} |
---|
| 77 | |
---|
| 78 | #3.0 20030427 |
---|
| 79 | # Cannot trust ${GCC_VER} to supply us with the correct |
---|
| 80 | # gcc version (especially if cvs). |
---|
| 81 | # Grab it straight from version.c |
---|
| 82 | cd ${SRC}/${PKGDIR} |
---|
| 83 | target_gcc_ver=`grep version_string gcc/version.c | \ |
---|
| 84 | sed 's@.* = \(\|"\)\([0-9.]*\).*@\2@g'` |
---|
| 85 | # As of gcc4, the above doesn't cut it... check gcc/BASE-VER |
---|
| 86 | if [ -z "${target_gcc_ver}" -a -f gcc/BASE-VER ]; then |
---|
| 87 | target_gcc_ver=`cat gcc/BASE-VER` |
---|
| 88 | fi |
---|
| 89 | |
---|
| 90 | # Apply linkonce patch for gcc (should be fixed come gcc 3.4.4) |
---|
| 91 | cd ${SRC}/${PKGDIR} |
---|
| 92 | case ${target_gcc_ver} in |
---|
| 93 | 3.4.3 ) 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 ) apply_patch gcc-4.0.0-fix_tree_optimisation_PR21173 |
---|
| 100 | apply_patch gcc-4.0.0-reload_check_uninitialized_pseudos_PR20973 |
---|
| 101 | apply_patch gcc-4.0.0-clean_exec_and_lib_search_paths_when_cross-1 |
---|
| 102 | ;; |
---|
[8546c13] | 103 | 4.0.* ) apply_patch gcc-4.0.0-clean_exec_and_lib_search_paths_when_cross-1 ;; |
---|
| 104 | 4.1.* ) apply_patch gcc-4.0.0-clean_exec_and_lib_search_paths_when_cross-1 ;; |
---|
[617118d] | 105 | esac |
---|
| 106 | |
---|
| 107 | # if we are using gcc-3.4x, set libexecdir to */${libdirname} |
---|
| 108 | case ${target_gcc_ver} in |
---|
| 109 | 3.4* | 4.* ) |
---|
| 110 | extra_conf="${extra_conf} --libexecdir=${BUILD_PREFIX}/${libdirname}" |
---|
| 111 | ;; |
---|
| 112 | esac |
---|
| 113 | |
---|
| 114 | # HACK: should at least check if any of these are set first |
---|
| 115 | ARCH_CFLAGS="${TGT_CFLAGS} ${ARCH_CFLAGS}" |
---|
| 116 | |
---|
| 117 | # if target is same as build host, adjust build slightly to avoid running |
---|
| 118 | # configure checks which we cannot run |
---|
| 119 | if [ "${TARGET}" = "${BUILD}" ]; then |
---|
| 120 | BUILD=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'` |
---|
| 121 | fi |
---|
| 122 | |
---|
| 123 | if [ ! "${USE_SYSROOT}" = "Y" ]; then |
---|
| 124 | # LFS style build |
---|
| 125 | #---------------- |
---|
| 126 | |
---|
| 127 | # source functions for required gcc modifications |
---|
| 128 | . ${SCRIPTS}/funcs/cross_gcc-funcs.sh |
---|
| 129 | |
---|
| 130 | # Alter the generated specs file to |
---|
| 131 | # o set dynamic linker to be under ${TGT_TOOLS}/lib{,32,64} |
---|
| 132 | # o set startfile_prefix_spec so we search for startfiles |
---|
| 133 | # under ${TGT_TOOLS}/lib/lib{,32,64} |
---|
| 134 | gcc_specs_mod |
---|
| 135 | |
---|
| 136 | # We need to stop cpp using /usr/include as the standard include directory. |
---|
| 137 | # This is defined in gcc/cppdefault.c using STANDARD_INCLUDE_DIR |
---|
| 138 | cpp_undef_standard_include_dir |
---|
| 139 | |
---|
| 140 | # We need to override SYSTEM_HEADER_DIR so fixincludes only fixes |
---|
| 141 | # headers under ${TGT_TOOLS} |
---|
| 142 | fixincludes_set_native_system_header_dir |
---|
| 143 | fi |
---|
| 144 | |
---|
| 145 | # HACKS |
---|
| 146 | #------- |
---|
| 147 | # This here is a hack. mklibgcc runs the created xgcc for determining |
---|
| 148 | # the multilib dirs and multilib os dirs. Only problem here is we are |
---|
| 149 | # cross building a native compiler so we cannot actually run xgcc. |
---|
| 150 | # We get around this by substituting our cross-compiler here for xgcc, |
---|
| 151 | # by rights it should have the same specs and produce the expected results |
---|
[8546c13] | 152 | # |
---|
| 153 | # NOTE: with gcc-4.1 onwards we can just set GCC_FOR_TARGET to our cross-compiler |
---|
| 154 | # and be done with the shenannigans |
---|
[617118d] | 155 | |
---|
[8546c13] | 156 | extra_makeopts="" |
---|
| 157 | case ${target_gcc_ver} in |
---|
| 158 | 4.[1-9].* ) |
---|
| 159 | extra_makeopts="${extra_makeopts} GCC_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-gcc" |
---|
| 160 | ;; |
---|
| 161 | * ) |
---|
| 162 | cd ${SRC}/${PKGDIR}/gcc |
---|
| 163 | test -f mklibgcc.in-ORIG || |
---|
| 164 | mv mklibgcc.in mklibgcc.in-ORIG |
---|
[617118d] | 165 | |
---|
[8546c13] | 166 | sed "s@\./xgcc@${HST_TOOLS}/bin/${TARGET}-gcc@g" \ |
---|
| 167 | mklibgcc.in-ORIG > mklibgcc.in |
---|
| 168 | |
---|
| 169 | # A similar problem exists when setting MULTILIBS on the environment |
---|
| 170 | # for the mklibgcc script for generation of libgcc.mk . |
---|
| 171 | # Here we will force it to use our cross-compiler to produce the results |
---|
| 172 | # of gcc --print-multi-lib |
---|
| 173 | sed -i "/MULTILIBS/s@\$(GCC_FOR_TARGET)@${HST_TOOLS}/bin/${TARGET}-gcc@g" \ |
---|
| 174 | Makefile.in |
---|
| 175 | ;; |
---|
| 176 | esac |
---|
[617118d] | 177 | |
---|
| 178 | # When cross-building a target native compiler we run into big issues |
---|
| 179 | # when determining assembler and linker features required for tls support, |
---|
| 180 | # ( not to mention which nm, objdump et al to use ) during the configures |
---|
| 181 | # triggered by make. |
---|
| 182 | # |
---|
| 183 | # Gcc's configury does not take into account the fact that when cross |
---|
| 184 | # building the target native compiler we are _still_ actually cross-compiling. |
---|
| 185 | # As far as it is concerned during the final configure fragment host = target, |
---|
| 186 | # it doesn't check whether host = build. |
---|
| 187 | # |
---|
| 188 | # It then performs its checks for binutils components as if this was a standard |
---|
| 189 | # host native build. |
---|
| 190 | # |
---|
| 191 | # If a target native binutils was installed before attempting to build gcc |
---|
| 192 | # it will try to use the created ld, as etc under ${TGT_TOOLS} |
---|
| 193 | # This obviously will not work, they will not run on the host. |
---|
| 194 | # |
---|
| 195 | # If the target native binutils hasn't been built yet it will use the |
---|
| 196 | # as ld et al from the _build_ host. |
---|
| 197 | # This quite frankly sucks rocks. |
---|
| 198 | # |
---|
| 199 | # The following patch fixes this behaviour, enforcing usage of our |
---|
| 200 | # cross-tools for configure checks if host = target and host != build |
---|
| 201 | # |
---|
| 202 | # NOTE: 20050507 This doesn't appear to be necessary for gcc 4.x :-) |
---|
| 203 | # This of course will have to be checked thoroughly... |
---|
| 204 | |
---|
| 205 | # TODO: Add patches for gcc-3.3 series as well |
---|
| 206 | cd ${SRC}/${PKGDIR} |
---|
| 207 | case ${target_gcc_ver} in |
---|
| 208 | 3.4* ) |
---|
| 209 | apply_patch gcc-3.4.1-fix_configure_for_target_native |
---|
| 210 | ;; |
---|
[23b6afb] | 211 | 4.* ) |
---|
[7efeff4] | 212 | # set AS_FOR_TARGET and LD_FOR_TARGET so these are used for feature checks... |
---|
[8546c13] | 213 | extra_makeopts="${extra_makeopts} AS_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-as" |
---|
[23b6afb] | 214 | extra_makeopts="${extra_makeopts} LD_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-ld" |
---|
| 215 | ;; |
---|
[617118d] | 216 | esac |
---|
| 217 | # |
---|
| 218 | # End HACKS |
---|
| 219 | |
---|
| 220 | test -d ${SRC}/gcc-${GCC_VER}-target && |
---|
| 221 | rm -rf ${SRC}/gcc-${GCC_VER}-target |
---|
| 222 | |
---|
| 223 | mkdir -p ${SRC}/gcc-${GCC_VER}-target && |
---|
| 224 | cd ${SRC}/gcc-${GCC_VER}-target && |
---|
| 225 | |
---|
| 226 | max_log_init Gcc ${GCC_VER} cross-pt2 ${CONFLOGS} ${LOG} |
---|
| 227 | #CONFIG_SHELL=/bin/bash \ |
---|
| 228 | CFLAGS="-O2 -pipe" \ |
---|
| 229 | CXXFLAGS="-O2 -pipe" \ |
---|
| 230 | CC="${TARGET}-gcc ${ARCH_CFLAGS}" \ |
---|
| 231 | ../${PKGDIR}/configure --prefix=${BUILD_PREFIX} \ |
---|
| 232 | --build=${BUILD} --host=${TARGET} --target=${TARGET} \ |
---|
| 233 | --enable-languages=c,c++ --enable-__cxa_atexit \ |
---|
| 234 | --enable-c99 --enable-long-long --enable-threads=posix \ |
---|
| 235 | --disable-nls --enable-shared ${extra_conf} \ |
---|
| 236 | >> ${LOGFILE} 2>&1 && |
---|
| 237 | echo " o Configure OK" || barf |
---|
| 238 | # --enable-languages=c,c++,f77,objc,ada,java,pascal,treelang --enable-__cxa_atexit \ |
---|
| 239 | # --enable-version-specific-runtime-libs \ |
---|
| 240 | |
---|
[8546c13] | 241 | min_log_init ${BUILDLOGS} && |
---|
| 242 | make ${PMFLAGS} BOOT_LDFLAGS="-s" BOOT_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" \ |
---|
| 243 | STAGE1_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" ${extra_makeopts} all \ |
---|
| 244 | >> ${LOGFILE} 2>&1 && |
---|
| 245 | echo " o Build OK" || barf |
---|
| 246 | |
---|
| 247 | min_log_init ${INSTLOGS} && |
---|
| 248 | make ${INSTALL_OPTIONS} install \ |
---|
| 249 | >> ${LOGFILE} 2>&1 && |
---|
| 250 | echo " o Install OK" || barf |
---|
| 251 | |
---|
| 252 | if [ ! "${USE_SYSROOT}" = "Y" ]; then |
---|
| 253 | # Prep new root for target native glibc build |
---|
| 254 | libdirs="${libdirname}" |
---|
| 255 | if [ "Y" = "${MULTIARCH}" ]; then libdirs="lib lib32 lib64" ; fi |
---|
| 256 | for dir in ${libdirs} ; do |
---|
| 257 | if [ -d ${TGT_TOOLS}/${dir} ]; then |
---|
| 258 | test -d ${LFS}/usr/${dir} || mkdir -p ${LFS}/usr/${dir} |
---|
| 259 | ln -sf ../..${TGT_TOOLS}/${dir}/libgcc_s.so.1 \ |
---|
| 260 | ${LFS}/usr/${dir}/libgcc_s.so.1 |
---|
| 261 | test -f ${TGT_TOOLS}/${dir}/libgcc_s.so && |
---|
| 262 | ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s.so |
---|
| 263 | test -f ${TGT_TOOLS}/${dir}/libgcc_s_32.so && |
---|
| 264 | ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s_32.so |
---|
| 265 | test -f ${TGT_TOOLS}/${dir}/libgcc_s_64.so && |
---|
| 266 | ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s_64.so |
---|
| 267 | fi |
---|
| 268 | done |
---|
| 269 | fi |
---|
| 270 | |
---|
| 271 | test -L ${INSTALL_PREFIX}/bin/cc || ln -s gcc ${INSTALL_PREFIX}/bin/cc |
---|
| 272 | |
---|
| 273 | esac |
---|
| 274 | |
---|
| 275 | # if we are using gcc-3.4x, set libexecdir to */${libdirname} |
---|
| 276 | case ${target_gcc_ver} in |
---|
| 277 | 3.4* | 4.* ) |
---|
| 278 | extra_conf="${extra_conf} --libexecdir=${BUILD_PREFIX}/${libdirname}" |
---|
| 279 | ;; |
---|
| 280 | esac |
---|
| 281 | |
---|
| 282 | # HACK: should at least check if any of these are set first |
---|
| 283 | ARCH_CFLAGS="${TGT_CFLAGS} ${ARCH_CFLAGS}" |
---|
| 284 | |
---|
| 285 | # if target is same as build host, adjust build slightly to avoid running |
---|
| 286 | # configure checks which we cannot run |
---|
| 287 | if [ "${TARGET}" = "${BUILD}" ]; then |
---|
| 288 | BUILD=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'` |
---|
| 289 | fi |
---|
| 290 | |
---|
| 291 | if [ ! "${USE_SYSROOT}" = "Y" ]; then |
---|
| 292 | # LFS style build |
---|
| 293 | #---------------- |
---|
| 294 | |
---|
| 295 | # source functions for required gcc modifications |
---|
| 296 | . ${SCRIPTS}/funcs/cross_gcc-funcs.sh |
---|
| 297 | |
---|
| 298 | # Alter the generated specs file to |
---|
| 299 | # o set dynamic linker to be under ${TGT_TOOLS}/lib{,32,64} |
---|
| 300 | # o set startfile_prefix_spec so we search for startfiles |
---|
| 301 | # under ${TGT_TOOLS}/lib/lib{,32,64} |
---|
| 302 | gcc_specs_mod |
---|
| 303 | |
---|
| 304 | # We need to stop cpp using /usr/include as the standard include directory. |
---|
| 305 | # This is defined in gcc/cppdefault.c using STANDARD_INCLUDE_DIR |
---|
| 306 | cpp_undef_standard_include_dir |
---|
| 307 | |
---|
| 308 | # We need to override SYSTEM_HEADER_DIR so fixincludes only fixes |
---|
| 309 | # headers under ${TGT_TOOLS} |
---|
| 310 | fixincludes_set_native_system_header_dir |
---|
| 311 | fi |
---|
| 312 | |
---|
| 313 | # HACKS |
---|
| 314 | #------- |
---|
| 315 | |
---|
| 316 | # This here is a hack. mklibgcc runs the created xgcc for determining |
---|
| 317 | # the multilib dirs and multilib os dirs. Only problem here is we are |
---|
| 318 | # cross building a native compiler so we cannot actually run xgcc. |
---|
| 319 | # We get around this by substituting our cross-compiler here for xgcc, |
---|
| 320 | # by rights it should have the same specs and produce the expected results |
---|
| 321 | # |
---|
| 322 | # NOTE: with gcc-4.1 onwards we can just set GCC_FOR_TARGET to our cross-compiler |
---|
| 323 | # and be done with the shenannigans |
---|
| 324 | |
---|
| 325 | extra_makeopts="" |
---|
| 326 | case ${target_gcc_ver} in |
---|
| 327 | 4.[1-9].* ) |
---|
| 328 | extra_makeopts="${extra_makeopts} GCC_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-gcc" |
---|
| 329 | ;; |
---|
| 330 | * ) |
---|
| 331 | cd ${SRC}/${PKGDIR}/gcc |
---|
| 332 | test -f mklibgcc.in-ORIG || |
---|
| 333 | mv mklibgcc.in mklibgcc.in-ORIG |
---|
| 334 | |
---|
| 335 | sed "s@\./xgcc@${HST_TOOLS}/bin/${TARGET}-gcc@g" \ |
---|
| 336 | mklibgcc.in-ORIG > mklibgcc.in |
---|
| 337 | |
---|
| 338 | # A similar problem exists when setting MULTILIBS on the environment |
---|
| 339 | # for the mklibgcc script for generation of libgcc.mk . |
---|
| 340 | # Here we will force it to use our cross-compiler to produce the results |
---|
| 341 | # of gcc --print-multi-lib |
---|
| 342 | sed -i "/MULTILIBS/s@\$(GCC_FOR_TARGET)@${HST_TOOLS}/bin/${TARGET}-gcc@g" \ |
---|
| 343 | Makefile.in |
---|
| 344 | ;; |
---|
| 345 | esac |
---|
| 346 | |
---|
| 347 | # When cross-building a target native compiler we run into big issues |
---|
| 348 | # when determining assembler and linker features required for tls support, |
---|
| 349 | # ( not to mention which nm, objdump et al to use ) during the configures |
---|
| 350 | # triggered by make. |
---|
| 351 | # |
---|
| 352 | # Gcc's configury does not take into account the fact that when cross |
---|
| 353 | # building the target native compiler we are _still_ actually cross-compiling. |
---|
| 354 | # As far as it is concerned during the final configure fragment host = target, |
---|
| 355 | # it doesn't check whether host = build. |
---|
| 356 | # |
---|
| 357 | # It then performs its checks for binutils components as if this was a standard |
---|
| 358 | # host native build. |
---|
| 359 | # |
---|
| 360 | # If a target native binutils was installed before attempting to build gcc |
---|
| 361 | # it will try to use the created ld, as etc under ${TGT_TOOLS} |
---|
| 362 | # This obviously will not work, they will not run on the host. |
---|
| 363 | # |
---|
| 364 | # If the target native binutils hasn't been built yet it will use the |
---|
| 365 | # as ld et al from the _build_ host. |
---|
| 366 | # This quite frankly sucks rocks. |
---|
| 367 | # |
---|
| 368 | # The following patch fixes this behaviour, enforcing usage of our |
---|
| 369 | # cross-tools for configure checks if host = target and host != build |
---|
| 370 | # |
---|
| 371 | # NOTE: 20050507 This doesn't appear to be necessary for gcc 4.x :-) |
---|
| 372 | # This of course will have to be checked thoroughly... |
---|
| 373 | |
---|
| 374 | # TODO: Add patches for gcc-3.3 series as well |
---|
| 375 | cd ${SRC}/${PKGDIR} |
---|
| 376 | case ${target_gcc_ver} in |
---|
| 377 | 3.4* ) |
---|
| 378 | apply_patch gcc-3.4.1-fix_configure_for_target_native |
---|
| 379 | ;; |
---|
| 380 | 4.* ) |
---|
| 381 | # set AS_FOR_TARGET and LD_FOR_TARGET so these are used for feature checks... |
---|
| 382 | extra_makeopts="${extra_makeopts} AS_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-as" |
---|
| 383 | extra_makeopts="${extra_makeopts} LD_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-ld" |
---|
| 384 | ;; |
---|
| 385 | esac |
---|
| 386 | # End HACKS |
---|
| 387 | |
---|
| 388 | test -d ${SRC}/gcc-${GCC_VER}-target && |
---|
| 389 | rm -rf ${SRC}/gcc-${GCC_VER}-target |
---|
| 390 | |
---|
| 391 | mkdir -p ${SRC}/gcc-${GCC_VER}-target && |
---|
| 392 | cd ${SRC}/gcc-${GCC_VER}-target && |
---|
| 393 | |
---|
| 394 | max_log_init Gcc ${GCC_VER} cross-pt2 ${CONFLOGS} ${LOG} |
---|
| 395 | #CONFIG_SHELL=/bin/bash \ |
---|
| 396 | CFLAGS="-O2 -pipe" \ |
---|
| 397 | CXXFLAGS="-O2 -pipe" \ |
---|
| 398 | CC="${TARGET}-gcc ${ARCH_CFLAGS}" \ |
---|
| 399 | ../${PKGDIR}/configure --prefix=${BUILD_PREFIX} \ |
---|
| 400 | --build=${BUILD} --host=${TARGET} --target=${TARGET} \ |
---|
| 401 | --enable-languages=c,c++ --enable-__cxa_atexit \ |
---|
| 402 | --enable-c99 --enable-long-long --enable-threads=posix \ |
---|
| 403 | --disable-nls --enable-shared ${extra_conf} \ |
---|
| 404 | >> ${LOGFILE} 2>&1 && |
---|
| 405 | echo " o Configure OK" || barf |
---|
| 406 | # --enable-languages=c,c++,f77,objc,ada,java,pascal,treelang --enable-__cxa_atexit \ |
---|
| 407 | # --enable-version-specific-runtime-libs \ |
---|
| 408 | |
---|
[617118d] | 409 | min_log_init ${BUILDLOGS} && |
---|
| 410 | make ${PMFLAGS} BOOT_LDFLAGS="-s" BOOT_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" \ |
---|
[23b6afb] | 411 | STAGE1_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" ${extra_makeopts} all \ |
---|
[617118d] | 412 | >> ${LOGFILE} 2>&1 && |
---|
| 413 | echo " o Build OK" || barf |
---|
| 414 | |
---|
| 415 | min_log_init ${INSTLOGS} && |
---|
| 416 | make ${INSTALL_OPTIONS} install \ |
---|
| 417 | >> ${LOGFILE} 2>&1 && |
---|
| 418 | echo " o Install OK" || barf |
---|
| 419 | |
---|
| 420 | if [ ! "${USE_SYSROOT}" = "Y" ]; then |
---|
| 421 | # Prep new root for target native glibc build |
---|
| 422 | libdirs="${libdirname}" |
---|
| 423 | if [ "Y" = "${MULTIARCH}" ]; then libdirs="lib lib32 lib64" ; fi |
---|
| 424 | for dir in ${libdirs} ; do |
---|
| 425 | if [ -d ${TGT_TOOLS}/${dir} ]; then |
---|
| 426 | test -d ${LFS}/usr/${dir} || mkdir -p ${LFS}/usr/${dir} |
---|
| 427 | ln -sf ../..${TGT_TOOLS}/${dir}/libgcc_s.so.1 \ |
---|
| 428 | ${LFS}/usr/${dir}/libgcc_s.so.1 |
---|
| 429 | test -f ${TGT_TOOLS}/${dir}/libgcc_s.so && |
---|
| 430 | ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s.so |
---|
| 431 | test -f ${TGT_TOOLS}/${dir}/libgcc_s_32.so && |
---|
| 432 | ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s_32.so |
---|
| 433 | test -f ${TGT_TOOLS}/${dir}/libgcc_s_64.so && |
---|
| 434 | ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s_64.so |
---|
| 435 | fi |
---|
| 436 | done |
---|
| 437 | fi |
---|
| 438 | |
---|
| 439 | test -L ${INSTALL_PREFIX}/bin/cc || ln -s gcc ${INSTALL_PREFIX}/bin/cc |
---|
| 440 | |
---|