source: scripts/scripts/cross-scripts/cross-glibc-full.sh@ f6180d2

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since f6180d2 was f6180d2, checked in by Jim Gifford <clfs@…>, 20 years ago

r2514@server (orig r1253): ryan | 2006-03-10 02:09:42 -0800

r1303@rei: lfs | 2006-03-10 20:58:18 +1100
Update for glibc-2.4


  • Property mode set to 100755
File size: 5.6 KB
Line 
1#!/bin/bash
2
3# cross-lfs cross glibc full build
4# --------------------------------
5# $LastChangedBy$
6# $LastChangedDate$
7# $LastChangedRevision$
8# $HeadURL$
9#
10
11cd ${SRC}
12
13LOG="glibc-cross.log"
14libdirname=lib
15
16# Test how this script has been called.
17# This should only really get called during bi-arch/multi-lib builds
18SELF=`basename ${0}`
19set_buildenv
20set_libdirname
21setup_multiarch
22
23if [ -z ${ALT_TGT} ]; then ALT_TGT="${TARGET}" ; fi
24
25# if target = build, modify build slightly to
26# trick configure to believing we are cross compiling
27if [ "${TARGET}" = "${BUILD}" -o "${ALT_TGT}" = "${BUILD}" ]; then
28 BUILD=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'`
29fi
30
31if [ "${USE_SYSROOT}" = "Y" ]; then
32 BUILD_PREFIX=/usr
33 INSTALL_PREFIX="${LFS}${BUILD_PREFIX}"
34 INSTALL_OPTIONS="install_root=${LFS}"
35else
36 BUILD_PREFIX=${TGT_TOOLS}
37 INSTALL_PREFIX="${TGT_TOOLS}"
38 INSTALL_OPTIONS=""
39fi
40
41if [ "${USE_SANITISED_HEADERS}" = "Y" ]; then
42 KERN_HDR_DIR="${INSTALL_PREFIX}/kernel-hdrs"
43else
44 KERN_HDR_DIR="${INSTALL_PREFIX}/include"
45fi
46
47unpack_tarball glibc-${GLIBC_VER}
48cd ${PKGDIR}
49
50# Gather package version information
51#-----------------------------------
52target_glibc_ver=`grep VERSION version.h | \
53 sed 's@.*\"\([0-9.]*\)\"@\1@'`
54export target_glibc_ver
55
56# Retrieve target_gcc_ver from gcc -v output
57target_gcc_ver=`${TARGET}-gcc -v 2>&1 | grep " version " | \
58 sed 's@.*version \([0-9.]*\).*@\1@g'`
59
60# check kernel headers for version
61kernver=`grep UTS_RELEASE ${KERN_HDR_DIR}/linux/version.h | \
62 sed 's@.*\"\([0-9.]*\).*\"@\1@g' `
63
64# if we don't have linuxthreads dirs (ie: a glibc release), then
65# unpack the linuxthreads tarball
66case ${GLIBC_VER} in
67 2.4 | 2.4.* ) ;;
68 * )
69 if [ ! -d linuxthreads -o ! -d linuxthreads_db ]; then
70 OLDPKGDIR=${PKGDIR} ; unpack_tarball glibc-linuxthreads-${GLIBC_VER}
71 PKGDIR=${OLDPKGDIR}
72 fi
73 ;;
74esac
75
76# unpack libidn add-on if required (should be supplied with cvs versions)
77if [ "${USE_LIBIDN}" = "Y" ]; then
78case ${target_glibc_ver} in
79 2.3.[4-9]* | 2.4* )
80 cd ${SRC}/${PKGDIR}
81 if [ ! -d libidn ]; then
82 OLDPKGDIR=${PKGDIR} ; unpack_tarball glibc-libidn-${GLIBC_VER}
83 PKGDIR=${OLDPKGDIR}
84 fi
85 ;;
86esac
87fi
88
89# apply glibc patches as required depending on the above gcc/kernel versions
90# see funcs/glibc_funcs.sh
91apply_glibc_patches
92
93
94# HACK: nptl for sparc64 wont build
95case ${TGT_ARCH} in
96 sparc64 )
97 USE_NPTL=N
98 ;;
99esac
100
101if [ "Y" = "${NO_GCC_EH}" ]; then
102 cd ${SRC}/${PKGDIR}
103 if [ ! -f Makeconfig-ORIG ]; then cp -p Makeconfig Makeconfig-ORIG ; fi
104 sed 's/-lgcc_eh//g' Makeconfig-ORIG > Makeconfig
105fi
106
107if [ "Y" = "${USE_NPTL}" ]; then
108 # remove linuxthreads dirs if they exist
109 # (CVS source contains linuxthreads)
110 if [ -d linuxthreads ]; then rm -rf linuxthreads* ; fi
111
112 # As of ~2003-10-06 nptl is included in glibc cvs
113 #test -d ./nptl &&
114 #test -d ./nptl_db ||
115 #unpack_tarball nptl-${NPTL_VER}
116
117 # fix tst-cancelx7 test
118 fname="${SRC}/${PKGDIR}/nptl/Makefile"
119 grep tst-cancelx7-ARGS ${fname} > /dev/null 2>&1 ||
120 {
121 echo " - patching ${fname}"
122 mv ${fname} ${fname}-ORIG
123 sed -e '/tst-cancel7-ARGS = --command "$(built-program-cmd)"/a\
124tst-cancelx7-ARGS = --command "$(built-program-cmd)"' \
125 ${fname}-ORIG > ${fname}
126 }
127
128 extra_conf="${extra_conf} --with-tls --with-__thread"
129else
130 if [ -d nptl ]; then rm -rf nptl* ; fi
131fi
132
133# set without-fp if target has no floating point unit
134if [ "${WITHOUT_FPU}" = "Y" ]; then
135 extra_conf="${extra_conf} --without-fp"
136fi
137
138# set --enable-kernel to match the kernel version
139# of the kernel headers glibc is to be built against
140#-------------------------------------------------
141# HACK: hack around 2.6.8.1 release
142case ${kernver} in 2.6.8.* ) kernver=2.6.8 ;; esac
143extra_conf="${extra_conf} --enable-kernel=${kernver}"
144
145test -d ${SRC}/glibc-${GLIBC_VER}-cross${suffix} &&
146 rm -rf ${SRC}/glibc-${GLIBC_VER}-cross${suffix}
147
148mkdir -p ${SRC}/glibc-${GLIBC_VER}-cross${suffix}
149cd ${SRC}/glibc-${GLIBC_VER}-cross${suffix}
150
151
152if [ "${USE_NPTL}" = "Y" ]; then
153 echo "libc_cv_forced_unwind=yes" > config.cache
154 echo "libc_cv_c_cleanup=yes" >> config.cache
155 case ${TGT_ARCH} in
156 sparc64 )
157 echo "libc_cv_sparc64_tls=yes" >> config.cache
158 ;;
159 esac
160 extra_conf="${extra_conf} --cache-file=config.cache"
161fi
162
163# Are libs to be installed into a non-standard place?
164if [ ! "${libdirname}" = "lib" ]; then
165 extra_conf="${extra_conf} --libdir=${BUILD_PREFIX}/${libdirname}"
166 # Also create a configparms file setting slibdir to */${libdirname}
167 if [ "${USE_SYSROOT}" = "Y" ]; then
168 echo "slibdir=/${libdirname}" >> configparms
169 else
170 echo "slibdir=${TGT_TOOLS}/${libdirname}" >> configparms
171 fi
172fi
173
174max_log_init Glibc ${GLIBC_VER} Cross ${CONFLOGS} ${LOG}
175BUILD_CC=gcc BUILD_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" CFLAGS="-O2 -pipe" \
176CC="${TARGET}-gcc ${ARCH_CFLAGS} ${TGT_CFLAGS}" \
177AR="${TARGET}-ar" RANLIB="${TARGET}-ranlib" \
178../${PKGDIR}/configure --prefix=${BUILD_PREFIX} \
179 --host=${ALT_TGT} --build=${BUILD} \
180 --without-cvs --disable-profile --enable-add-ons \
181 --with-headers=${KERN_HDR_DIR} ${extra_conf} \
182 --with-binutils=${HST_TOOLS}/bin --without-gd \
183 --mandir=${BUILD_PREFIX}/share/man \
184 --infodir=${BUILD_PREFIX}/share/info \
185 --libexecdir=${BUILD_PREFIX}/${libdirname}/glibc \
186 >> ${LOGFILE} 2>&1 &&
187echo " o Configure OK" || barf
188
189min_log_init ${BUILDLOGS} &&
190make SHELL="bash" PARALLELMFLAGS="${PMFLAGS}" \
191 >> ${LOGFILE} 2>&1 &&
192echo " o Build OK" || barf
193
194min_log_init ${INSTLOGS} &&
195make ${INSTALL_OPTIONS} install \
196 >> ${LOGFILE} 2>&1 &&
197echo " o install OK"
198
Note: See TracBrowser for help on using the repository browser.