Changeset 8546c13
- Timestamp:
- Mar 7, 2006, 3:30:04 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:
- 7efeff4
- Parents:
- c7ec163
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/scripts/target-scripts/target-gcc.sh
rc7ec163 r8546c13 101 101 apply_patch gcc-4.0.0-clean_exec_and_lib_search_paths_when_cross-1 102 102 ;; 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 ;; 103 105 esac 104 106 … … 148 150 # We get around this by substituting our cross-compiler here for xgcc, 149 151 # by rights it should have the same specs and produce the expected results 150 cd ${SRC}/${PKGDIR}/gcc 151 test -f mklibgcc.in-ORIG || 152 mv mklibgcc.in mklibgcc.in-ORIG 153 154 sed "s@\./xgcc@${HST_TOOLS}/bin/${TARGET}-gcc@g" \ 155 mklibgcc.in-ORIG > mklibgcc.in 156 157 # A similar problem exists when setting MULTILIBS on the environment 158 # for the mklibgcc script for generation of libgcc.mk . 159 # Here we will force it to use our cross-compiler to produce the results 160 # of gcc --print-multi-lib 161 sed -i "/MULTILIBS/s@\$(GCC_FOR_TARGET)@${HST_TOOLS}/bin/${TARGET}-gcc@g" \ 162 Makefile.in 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 155 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 165 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 163 177 164 178 # When cross-building a target native compiler we run into big issues … … 198 212 # Testing only... set AS_FOR_TARGET and LD_FOR_TARGET so these are used 199 213 # for feature checks... will have to check for unintended side effects 200 extra_makeopts=" AS_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-as"214 extra_makeopts="${extra_makeopts} AS_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-as" 201 215 extra_makeopts="${extra_makeopts} LD_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-ld" 202 216 ;; … … 258 272 test -L ${INSTALL_PREFIX}/bin/cc || ln -s gcc ${INSTALL_PREFIX}/bin/cc 259 273 274 esac 275 276 # if we are using gcc-3.4x, set libexecdir to */${libdirname} 277 case ${target_gcc_ver} in 278 3.4* | 4.* ) 279 extra_conf="${extra_conf} --libexecdir=${BUILD_PREFIX}/${libdirname}" 280 ;; 281 esac 282 283 # HACK: should at least check if any of these are set first 284 ARCH_CFLAGS="${TGT_CFLAGS} ${ARCH_CFLAGS}" 285 286 # if target is same as build host, adjust build slightly to avoid running 287 # configure checks which we cannot run 288 if [ "${TARGET}" = "${BUILD}" ]; then 289 BUILD=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'` 290 fi 291 292 if [ ! "${USE_SYSROOT}" = "Y" ]; then 293 # LFS style build 294 #---------------- 295 296 # source functions for required gcc modifications 297 . ${SCRIPTS}/funcs/cross_gcc-funcs.sh 298 299 # Alter the generated specs file to 300 # o set dynamic linker to be under ${TGT_TOOLS}/lib{,32,64} 301 # o set startfile_prefix_spec so we search for startfiles 302 # under ${TGT_TOOLS}/lib/lib{,32,64} 303 gcc_specs_mod 304 305 # We need to stop cpp using /usr/include as the standard include directory. 306 # This is defined in gcc/cppdefault.c using STANDARD_INCLUDE_DIR 307 cpp_undef_standard_include_dir 308 309 # We need to override SYSTEM_HEADER_DIR so fixincludes only fixes 310 # headers under ${TGT_TOOLS} 311 fixincludes_set_native_system_header_dir 312 fi 313 314 # HACKS 315 #------- 316 317 # This here is a hack. mklibgcc runs the created xgcc for determining 318 # the multilib dirs and multilib os dirs. Only problem here is we are 319 # cross building a native compiler so we cannot actually run xgcc. 320 # We get around this by substituting our cross-compiler here for xgcc, 321 # by rights it should have the same specs and produce the expected results 322 # 323 # NOTE: with gcc-4.1 onwards we can just set GCC_FOR_TARGET to our cross-compiler 324 # and be done with the shenannigans 325 326 extra_makeopts="" 327 case ${target_gcc_ver} in 328 4.[1-9].* ) 329 extra_makeopts="${extra_makeopts} GCC_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-gcc" 330 ;; 331 * ) 332 cd ${SRC}/${PKGDIR}/gcc 333 test -f mklibgcc.in-ORIG || 334 mv mklibgcc.in mklibgcc.in-ORIG 335 336 sed "s@\./xgcc@${HST_TOOLS}/bin/${TARGET}-gcc@g" \ 337 mklibgcc.in-ORIG > mklibgcc.in 338 339 # A similar problem exists when setting MULTILIBS on the environment 340 # for the mklibgcc script for generation of libgcc.mk . 341 # Here we will force it to use our cross-compiler to produce the results 342 # of gcc --print-multi-lib 343 sed -i "/MULTILIBS/s@\$(GCC_FOR_TARGET)@${HST_TOOLS}/bin/${TARGET}-gcc@g" \ 344 Makefile.in 345 ;; 346 esac 347 348 # When cross-building a target native compiler we run into big issues 349 # when determining assembler and linker features required for tls support, 350 # ( not to mention which nm, objdump et al to use ) during the configures 351 # triggered by make. 352 # 353 # Gcc's configury does not take into account the fact that when cross 354 # building the target native compiler we are _still_ actually cross-compiling. 355 # As far as it is concerned during the final configure fragment host = target, 356 # it doesn't check whether host = build. 357 # 358 # It then performs its checks for binutils components as if this was a standard 359 # host native build. 360 # 361 # If a target native binutils was installed before attempting to build gcc 362 # it will try to use the created ld, as etc under ${TGT_TOOLS} 363 # This obviously will not work, they will not run on the host. 364 # 365 # If the target native binutils hasn't been built yet it will use the 366 # as ld et al from the _build_ host. 367 # This quite frankly sucks rocks. 368 # 369 # The following patch fixes this behaviour, enforcing usage of our 370 # cross-tools for configure checks if host = target and host != build 371 # 372 # NOTE: 20050507 This doesn't appear to be necessary for gcc 4.x :-) 373 # This of course will have to be checked thoroughly... 374 375 # TODO: Add patches for gcc-3.3 series as well 376 cd ${SRC}/${PKGDIR} 377 case ${target_gcc_ver} in 378 3.4* ) 379 apply_patch gcc-3.4.1-fix_configure_for_target_native 380 ;; 381 4.* ) 382 # set AS_FOR_TARGET and LD_FOR_TARGET so these are used for feature checks... 383 extra_makeopts="${extra_makeopts} AS_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-as" 384 extra_makeopts="${extra_makeopts} LD_FOR_TARGET=${HST_TOOLS}/bin/${TARGET}-ld" 385 ;; 386 esac 387 # End HACKS 388 389 test -d ${SRC}/gcc-${GCC_VER}-target && 390 rm -rf ${SRC}/gcc-${GCC_VER}-target 391 392 mkdir -p ${SRC}/gcc-${GCC_VER}-target && 393 cd ${SRC}/gcc-${GCC_VER}-target && 394 395 max_log_init Gcc ${GCC_VER} cross-pt2 ${CONFLOGS} ${LOG} 396 #CONFIG_SHELL=/bin/bash \ 397 CFLAGS="-O2 -pipe" \ 398 CXXFLAGS="-O2 -pipe" \ 399 CC="${TARGET}-gcc ${ARCH_CFLAGS}" \ 400 ../${PKGDIR}/configure --prefix=${BUILD_PREFIX} \ 401 --build=${BUILD} --host=${TARGET} --target=${TARGET} \ 402 --enable-languages=c,c++ --enable-__cxa_atexit \ 403 --enable-c99 --enable-long-long --enable-threads=posix \ 404 --disable-nls --enable-shared ${extra_conf} \ 405 >> ${LOGFILE} 2>&1 && 406 echo " o Configure OK" || barf 407 # --enable-languages=c,c++,f77,objc,ada,java,pascal,treelang --enable-__cxa_atexit \ 408 # --enable-version-specific-runtime-libs \ 409 410 min_log_init ${BUILDLOGS} && 411 make ${PMFLAGS} BOOT_LDFLAGS="-s" BOOT_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" \ 412 STAGE1_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" ${extra_makeopts} all \ 413 >> ${LOGFILE} 2>&1 && 414 echo " o Build OK" || barf 415 416 min_log_init ${INSTLOGS} && 417 make ${INSTALL_OPTIONS} install \ 418 >> ${LOGFILE} 2>&1 && 419 echo " o Install OK" || barf 420 421 if [ ! "${USE_SYSROOT}" = "Y" ]; then 422 # Prep new root for target native glibc build 423 libdirs="${libdirname}" 424 if [ "Y" = "${MULTIARCH}" ]; then libdirs="lib lib32 lib64" ; fi 425 for dir in ${libdirs} ; do 426 if [ -d ${TGT_TOOLS}/${dir} ]; then 427 test -d ${LFS}/usr/${dir} || mkdir -p ${LFS}/usr/${dir} 428 ln -sf ../..${TGT_TOOLS}/${dir}/libgcc_s.so.1 \ 429 ${LFS}/usr/${dir}/libgcc_s.so.1 430 test -f ${TGT_TOOLS}/${dir}/libgcc_s.so && 431 ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s.so 432 test -f ${TGT_TOOLS}/${dir}/libgcc_s_32.so && 433 ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s_32.so 434 test -f ${TGT_TOOLS}/${dir}/libgcc_s_64.so && 435 ln -sf libgcc_s.so.1 ${LFS}/usr/${dir}/libgcc_s_64.so 436 fi 437 done 438 fi 439 440 test -L ${INSTALL_PREFIX}/bin/cc || ln -s gcc ${INSTALL_PREFIX}/bin/cc 441
Note:
See TracChangeset
for help on using the changeset viewer.