[617118d] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
| 3 | # cross-lfs glibc startfiles build
|
---|
| 4 | # --------------------------------
|
---|
| 5 | # $LastChangedBy$
|
---|
| 6 | # $LastChangedDate$
|
---|
| 7 | # $LastChangedRevision$
|
---|
| 8 | # $HeadURL$
|
---|
| 9 | #
|
---|
| 10 |
|
---|
| 11 | cd ${SRC}
|
---|
| 12 |
|
---|
| 13 | # Defaults
|
---|
| 14 | LOG="glibc-cross-crt-objs.log"
|
---|
| 15 | libdirname=lib
|
---|
| 16 |
|
---|
| 17 |
|
---|
| 18 | # Test how this script has been called.
|
---|
| 19 | # This should only really get called during bi-arch/multi-lib builds
|
---|
| 20 | SELF=`basename ${0}`
|
---|
| 21 | set_buildenv
|
---|
| 22 | set_libdirname
|
---|
| 23 | setup_multiarch
|
---|
| 24 |
|
---|
| 25 | if [ -z "${ALT_TGT}" ]; then ALT_TGT="${TARGET}" ; fi
|
---|
| 26 |
|
---|
| 27 | # if target = build, modify build slightly to
|
---|
| 28 | # trick configure into believing we are cross compiling
|
---|
| 29 | # and avoid some configure checks
|
---|
| 30 | if [ "${TARGET}" = "${BUILD}" -o "${ALT_TGT}" = "${BUILD}" ]; then
|
---|
| 31 | BUILD=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'`
|
---|
| 32 | fi
|
---|
| 33 |
|
---|
| 34 | if [ "${USE_SYSROOT}" = "Y" ]; then
|
---|
| 35 | BUILD_PREFIX=/usr
|
---|
| 36 | INSTALL_PREFIX="${LFS}${BUILD_PREFIX}"
|
---|
| 37 | else
|
---|
| 38 | BUILD_PREFIX=${TGT_TOOLS}
|
---|
| 39 | INSTALL_PREFIX="${TGT_TOOLS}"
|
---|
| 40 | fi
|
---|
| 41 |
|
---|
| 42 | if [ "${USE_SANITISED_HEADERS}" = "Y" ]; then
|
---|
| 43 | KERN_HDR_DIR="${INSTALL_PREFIX}/kernel-hdrs"
|
---|
| 44 | else
|
---|
| 45 | KERN_HDR_DIR="${INSTALL_PREFIX}/include"
|
---|
| 46 | fi
|
---|
| 47 |
|
---|
| 48 | unpack_tarball glibc-${GLIBC_VER}
|
---|
| 49 | cd ${PKGDIR}
|
---|
| 50 |
|
---|
| 51 | # Gather package version information
|
---|
| 52 | #-----------------------------------
|
---|
| 53 | target_glibc_ver=`grep VERSION version.h | \
|
---|
| 54 | sed 's@.*\"\([0-9.]*\)\"@\1@'`
|
---|
| 55 | export target_glibc_ver
|
---|
| 56 |
|
---|
| 57 | # Retrieve target_gcc_ver from gcc -v output
|
---|
| 58 | target_gcc_ver=`${TARGET}-gcc -v 2>&1 | grep " version " | \
|
---|
| 59 | sed 's@.*version \([0-9.]*\).*@\1@g'`
|
---|
| 60 |
|
---|
| 61 | # check kernel headers for version
|
---|
| 62 | kernver=`grep UTS_RELEASE ${KERN_HDR_DIR}/linux/version.h | \
|
---|
| 63 | sed 's@.*\"\([0-9.]*\).*\"@\1@g' `
|
---|
| 64 |
|
---|
| 65 | if [ ! -d linuxthreads -o ! -d linuxthreads_db ]; then
|
---|
| 66 | cd ${SRC}/${PKGDIR}
|
---|
| 67 | OLDPKGDIR=${PKGDIR} ; unpack_tarball glibc-linuxthreads-${GLIBC_VER}
|
---|
| 68 | PKGDIR=${OLDPKGDIR}
|
---|
| 69 | fi
|
---|
| 70 |
|
---|
| 71 | # unpack libidn add-on if required (should be supplied with cvs versions)
|
---|
| 72 | case ${target_glibc_ver} in
|
---|
| 73 | 2.3.[4-9]* | 2.4* )
|
---|
| 74 | cd ${SRC}/${PKGDIR}
|
---|
| 75 | if [ ! -d libidn ]; then
|
---|
| 76 | OLDPKGDIR=${PKGDIR} ; unpack_tarball glibc-libidn-${GLIBC_VER}
|
---|
| 77 | PKGDIR=${OLDPKGDIR}
|
---|
| 78 | fi
|
---|
| 79 | ;;
|
---|
| 80 | esac
|
---|
| 81 |
|
---|
| 82 | # apply glibc patches as required depending on the above gcc/kernel versions
|
---|
| 83 | # see funcs/glibc_funcs.sh
|
---|
| 84 | apply_glibc_patches
|
---|
| 85 |
|
---|
| 86 | # set without-fp if target has no floating point unit
|
---|
| 87 | if [ "${WITHOUT_FPU}" = "Y" ]; then
|
---|
| 88 | extra_conf="${extra_conf} --without-fp"
|
---|
| 89 | fi
|
---|
| 90 |
|
---|
| 91 | # set --enable-kernel to match the kernel version
|
---|
| 92 | # of the kernel headers glibc is to be built against
|
---|
| 93 | #-------------------------------------------------
|
---|
| 94 | # HACK: hack around 2.6.8.1 release
|
---|
| 95 | case ${kernver} in 2.6.8.* ) kernver=2.6.8 ;; esac
|
---|
| 96 | extra_conf="${extra_conf} --enable-kernel=${kernver}"
|
---|
| 97 |
|
---|
| 98 | test -d ${SRC}/glibc-${GLIBC_VER}-crtobjs${suffix} &&
|
---|
| 99 | rm -rf ${SRC}/glibc-${GLIBC_VER}-crtobjs${suffix}
|
---|
| 100 |
|
---|
| 101 | mkdir -p ${SRC}/glibc-${GLIBC_VER}-crtobjs${suffix}
|
---|
| 102 | cd ${SRC}/glibc-${GLIBC_VER}-crtobjs${suffix}
|
---|
| 103 |
|
---|
| 104 | if [ "${USE_NPTL}" = "Y" ]; then
|
---|
| 105 | extra_conf="${extra_conf} --enable-add-ons=nptl"
|
---|
| 106 | extra_conf="${extra_conf} --with-tls --with-__thread"
|
---|
| 107 | echo "libc_cv_forced_unwind=yes" > config.cache
|
---|
| 108 | echo "libc_cv_c_cleanup=yes" >> config.cache
|
---|
| 109 |
|
---|
| 110 | # TODO: check for biarch etc
|
---|
| 111 | case ${TGT_ARCH} in
|
---|
| 112 | sparc64* | ultrasparc* )
|
---|
| 113 | echo "libc_cv_sparc64_tls=yes" >> config.cache
|
---|
| 114 | ;;
|
---|
| 115 | esac
|
---|
| 116 |
|
---|
| 117 | extra_conf="${extra_conf} --cache-file=config.cache"
|
---|
| 118 | else
|
---|
| 119 | extra_conf="${extra_conf} --enable-add-ons=linuxthreads"
|
---|
| 120 | fi
|
---|
| 121 |
|
---|
| 122 | max_log_init Glibc ${GLIBC_VER} Cross ${CONFLOGS} ${LOG}
|
---|
| 123 | BUILD_CC=gcc BUILD_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" \
|
---|
| 124 | CFLAGS="-O2 -pipe" \
|
---|
| 125 | CC="${TARGET}-gcc ${ARCH_CFLAGS} ${TGT_CFLAGS}" \
|
---|
| 126 | AR="${TARGET}-ar" RANLIB="${TARGET}-ranlib" \
|
---|
| 127 | ../${PKGDIR}/configure --prefix=${BUILD_PREFIX} \
|
---|
| 128 | --host=${ALT_TGT} --build=${BUILD} \
|
---|
| 129 | --without-cvs \
|
---|
| 130 | --disable-profile ${extra_conf} \
|
---|
| 131 | --with-headers=${KERN_HDR_DIR} \
|
---|
| 132 | --with-binutils=${HST_TOOLS}/bin \
|
---|
| 133 | >> ${LOGFILE} 2>&1 &&
|
---|
| 134 | echo " o Configure OK" || barf
|
---|
| 135 |
|
---|
| 136 | # OK, we have an issue when building on solaris, make invokes /bin/sh
|
---|
| 137 | # by default. Issue is primarily with the System V /bin/echo which always
|
---|
| 138 | # expands and interprets special characters (such as \n) instead of just
|
---|
| 139 | # echoing the string. The invoked /bin/sh does not inherit our set PATH and
|
---|
| 140 | # use the bsd style echo we created earlier.
|
---|
| 141 | # To get around this issue we will just force make to use "bash" as
|
---|
| 142 | # its shell and use bash's internal echo, which works how we would expect it.
|
---|
| 143 |
|
---|
| 144 | min_log_init ${BUILDLOGS} &&
|
---|
| 145 | make SHELL="bash" PARALLELMFLAGS="${PMFLAGS}" csu/subdir_lib \
|
---|
| 146 | >> ${LOGFILE} 2>&1 &&
|
---|
| 147 | echo " o Build OK" || barf
|
---|
| 148 |
|
---|
| 149 | min_log_init ${INSTLOGS} &&
|
---|
| 150 |
|
---|
| 151 | mkdir -p ${INSTALL_PREFIX}/${libdirname} &&
|
---|
| 152 | cp -fp csu/crt[1in].o ${INSTALL_PREFIX}/${libdirname} &&
|
---|
| 153 | echo " o install OK"
|
---|
| 154 |
|
---|