source: scripts/cross-scripts/cross-glibc-crtobjs.sh@ 17c4d95

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 17c4d95 was 617118d, checked in by Jim Gifford <clfs@…>, 19 years ago

r561@server (orig r559): root | 2005-06-05 02:38:49 -0700
Fixed Directory Structure

  • Property mode set to 100755
File size: 4.5 KB
Line 
1#!/bin/bash
2
3# cross-lfs glibc startfiles build
4# --------------------------------
5# $LastChangedBy$
6# $LastChangedDate$
7# $LastChangedRevision$
8# $HeadURL$
9#
10
11cd ${SRC}
12
13# Defaults
14LOG="glibc-cross-crt-objs.log"
15libdirname=lib
16
17
18# Test how this script has been called.
19# This should only really get called during bi-arch/multi-lib builds
20SELF=`basename ${0}`
21set_buildenv
22set_libdirname
23setup_multiarch
24
25if [ -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
30if [ "${TARGET}" = "${BUILD}" -o "${ALT_TGT}" = "${BUILD}" ]; then
31 BUILD=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'`
32fi
33
34if [ "${USE_SYSROOT}" = "Y" ]; then
35 BUILD_PREFIX=/usr
36 INSTALL_PREFIX="${LFS}${BUILD_PREFIX}"
37else
38 BUILD_PREFIX=${TGT_TOOLS}
39 INSTALL_PREFIX="${TGT_TOOLS}"
40fi
41
42if [ "${USE_SANITISED_HEADERS}" = "Y" ]; then
43 KERN_HDR_DIR="${INSTALL_PREFIX}/kernel-hdrs"
44else
45 KERN_HDR_DIR="${INSTALL_PREFIX}/include"
46fi
47
48unpack_tarball glibc-${GLIBC_VER}
49cd ${PKGDIR}
50
51# Gather package version information
52#-----------------------------------
53target_glibc_ver=`grep VERSION version.h | \
54 sed 's@.*\"\([0-9.]*\)\"@\1@'`
55export target_glibc_ver
56
57# Retrieve target_gcc_ver from gcc -v output
58target_gcc_ver=`${TARGET}-gcc -v 2>&1 | grep " version " | \
59 sed 's@.*version \([0-9.]*\).*@\1@g'`
60
61# check kernel headers for version
62kernver=`grep UTS_RELEASE ${KERN_HDR_DIR}/linux/version.h | \
63 sed 's@.*\"\([0-9.]*\).*\"@\1@g' `
64
65if [ ! -d linuxthreads -o ! -d linuxthreads_db ]; then
66 cd ${SRC}/${PKGDIR}
67 OLDPKGDIR=${PKGDIR} ; unpack_tarball glibc-linuxthreads-${GLIBC_VER}
68 PKGDIR=${OLDPKGDIR}
69fi
70
71# unpack libidn add-on if required (should be supplied with cvs versions)
72case ${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 ;;
80esac
81
82# apply glibc patches as required depending on the above gcc/kernel versions
83# see funcs/glibc_funcs.sh
84apply_glibc_patches
85
86# set without-fp if target has no floating point unit
87if [ "${WITHOUT_FPU}" = "Y" ]; then
88 extra_conf="${extra_conf} --without-fp"
89fi
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
95case ${kernver} in 2.6.8.* ) kernver=2.6.8 ;; esac
96extra_conf="${extra_conf} --enable-kernel=${kernver}"
97
98test -d ${SRC}/glibc-${GLIBC_VER}-crtobjs${suffix} &&
99 rm -rf ${SRC}/glibc-${GLIBC_VER}-crtobjs${suffix}
100
101mkdir -p ${SRC}/glibc-${GLIBC_VER}-crtobjs${suffix}
102cd ${SRC}/glibc-${GLIBC_VER}-crtobjs${suffix}
103
104if [ "${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"
118else
119 extra_conf="${extra_conf} --enable-add-ons=linuxthreads"
120fi
121
122max_log_init Glibc ${GLIBC_VER} Cross ${CONFLOGS} ${LOG}
123BUILD_CC=gcc BUILD_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" \
124CFLAGS="-O2 -pipe" \
125CC="${TARGET}-gcc ${ARCH_CFLAGS} ${TGT_CFLAGS}" \
126AR="${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 &&
134echo " 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
144min_log_init ${BUILDLOGS} &&
145make SHELL="bash" PARALLELMFLAGS="${PMFLAGS}" csu/subdir_lib \
146 >> ${LOGFILE} 2>&1 &&
147echo " o Build OK" || barf
148
149min_log_init ${INSTLOGS} &&
150
151mkdir -p ${INSTALL_PREFIX}/${libdirname} &&
152cp -fp csu/crt[1in].o ${INSTALL_PREFIX}/${libdirname} &&
153echo " o install OK"
154
Note: See TracBrowser for help on using the repository browser.