Changeset 3a26e5e
- Timestamp:
- Mar 7, 2006, 3:30:20 AM (19 years ago)
- Branches:
- clfs-1.2, clfs-2.1, clfs-3.0.0-systemd, clfs-3.0.0-sysvinit, master, systemd, sysvinit
- Children:
- 2fae446
- Parents:
- 7efeff4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/scripts/target-scripts/target-gcc.sh
r7efeff4 r3a26e5e 271 271 test -L ${INSTALL_PREFIX}/bin/cc || ln -s gcc ${INSTALL_PREFIX}/bin/cc 272 272 273 esac274 275 # if we are using gcc-3.4x, set libexecdir to */${libdirname}276 case ${target_gcc_ver} in277 3.4* | 4.* )278 extra_conf="${extra_conf} --libexecdir=${BUILD_PREFIX}/${libdirname}"279 ;;280 esac281 282 # HACK: should at least check if any of these are set first283 ARCH_CFLAGS="${TGT_CFLAGS} ${ARCH_CFLAGS}"284 285 # if target is same as build host, adjust build slightly to avoid running286 # configure checks which we cannot run287 if [ "${TARGET}" = "${BUILD}" ]; then288 BUILD=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'`289 fi290 291 if [ ! "${USE_SYSROOT}" = "Y" ]; then292 # LFS style build293 #----------------294 295 # source functions for required gcc modifications296 . ${SCRIPTS}/funcs/cross_gcc-funcs.sh297 298 # Alter the generated specs file to299 # o set dynamic linker to be under ${TGT_TOOLS}/lib{,32,64}300 # o set startfile_prefix_spec so we search for startfiles301 # under ${TGT_TOOLS}/lib/lib{,32,64}302 gcc_specs_mod303 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_DIR306 cpp_undef_standard_include_dir307 308 # We need to override SYSTEM_HEADER_DIR so fixincludes only fixes309 # headers under ${TGT_TOOLS}310 fixincludes_set_native_system_header_dir311 fi312 313 # HACKS314 #-------315 316 # This here is a hack. mklibgcc runs the created xgcc for determining317 # the multilib dirs and multilib os dirs. Only problem here is we are318 # 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 results321 #322 # NOTE: with gcc-4.1 onwards we can just set GCC_FOR_TARGET to our cross-compiler323 # and be done with the shenannigans324 325 extra_makeopts=""326 case ${target_gcc_ver} in327 4.[1-9].* )328 extra_makeopts="${extra_makeopts} GCC_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-gcc"329 ;;330 * )331 cd ${SRC}/${PKGDIR}/gcc332 test -f mklibgcc.in-ORIG ||333 mv mklibgcc.in mklibgcc.in-ORIG334 335 sed "s@\./xgcc@${HST_TOOLS}/bin/${TARGET}-gcc@g" \336 mklibgcc.in-ORIG > mklibgcc.in337 338 # A similar problem exists when setting MULTILIBS on the environment339 # for the mklibgcc script for generation of libgcc.mk .340 # Here we will force it to use our cross-compiler to produce the results341 # of gcc --print-multi-lib342 sed -i "/MULTILIBS/s@\$(GCC_FOR_TARGET)@${HST_TOOLS}/bin/${TARGET}-gcc@g" \343 Makefile.in344 ;;345 esac346 347 # When cross-building a target native compiler we run into big issues348 # when determining assembler and linker features required for tls support,349 # ( not to mention which nm, objdump et al to use ) during the configures350 # triggered by make.351 #352 # Gcc's configury does not take into account the fact that when cross353 # 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 standard358 # host native build.359 #360 # If a target native binutils was installed before attempting to build gcc361 # 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 the365 # 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 our369 # cross-tools for configure checks if host = target and host != build370 #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 well375 cd ${SRC}/${PKGDIR}376 case ${target_gcc_ver} in377 3.4* )378 apply_patch gcc-3.4.1-fix_configure_for_target_native379 ;;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 esac386 # End HACKS387 388 test -d ${SRC}/gcc-${GCC_VER}-target &&389 rm -rf ${SRC}/gcc-${GCC_VER}-target390 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" || barf406 # --enable-languages=c,c++,f77,objc,ada,java,pascal,treelang --enable-__cxa_atexit \407 # --enable-version-specific-runtime-libs \408 409 min_log_init ${BUILDLOGS} &&410 make ${PMFLAGS} BOOT_LDFLAGS="-s" BOOT_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" \411 STAGE1_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" ${extra_makeopts} all \412 >> ${LOGFILE} 2>&1 &&413 echo " o Build OK" || barf414 415 min_log_init ${INSTLOGS} &&416 make ${INSTALL_OPTIONS} install \417 >> ${LOGFILE} 2>&1 &&418 echo " o Install OK" || barf419 420 if [ ! "${USE_SYSROOT}" = "Y" ]; then421 # Prep new root for target native glibc build422 libdirs="${libdirname}"423 if [ "Y" = "${MULTIARCH}" ]; then libdirs="lib lib32 lib64" ; fi424 for dir in ${libdirs} ; do425 if [ -d ${TGT_TOOLS}/${dir} ]; then426 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.1429 test -f ${TGT_TOOLS}/${dir}/libgcc_s.so &&430 ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s.so431 test -f ${TGT_TOOLS}/${dir}/libgcc_s_32.so &&432 ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s_32.so433 test -f ${TGT_TOOLS}/${dir}/libgcc_s_64.so &&434 ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s_64.so435 fi436 done437 fi438 439 test -L ${INSTALL_PREFIX}/bin/cc || ln -s gcc ${INSTALL_PREFIX}/bin/cc440
Note:
See TracChangeset
for help on using the changeset viewer.