source: scripts_home/scripts/cross-scripts/cross-glibc-full.sh@ 1c9c5c3

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

r624@server (orig r622): jim | 2005-10-31 12:40:28 -0800
Rearranging Archive

  • Property mode set to 100755
File size: 5.3 KB
RevLine 
[617118d]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
66if [ ! -d linuxthreads -o ! -d linuxthreads_db ]; then
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# HACK: nptl for sparc64 wont build
87case ${TGT_ARCH} in
88 sparc64 )
89 USE_NPTL=N
90 ;;
91esac
92
93if [ "Y" = "${USE_NPTL}" ]; then
94 # remove linuxthreads dirs if they exist
95 # (CVS source contains linuxthreads)
96 if [ -d linuxthreads ]; then rm -rf linuxthreads* ; fi
97
98 # As of ~2003-10-06 nptl is included in glibc cvs
99 #test -d ./nptl &&
100 #test -d ./nptl_db ||
101 #unpack_tarball nptl-${NPTL_VER}
102
103 # fix tst-cancelx7 test
104 fname="${SRC}/${PKGDIR}/nptl/Makefile"
105 grep tst-cancelx7-ARGS ${fname} > /dev/null 2>&1 ||
106 {
107 echo " - patching ${fname}"
108 mv ${fname} ${fname}-ORIG
109 sed -e '/tst-cancel7-ARGS = --command "$(built-program-cmd)"/a\
110tst-cancelx7-ARGS = --command "$(built-program-cmd)"' \
111 ${fname}-ORIG > ${fname}
112 }
113
114 extra_conf="${extra_conf} --with-tls --with-__thread"
115else
116 if [ -d nptl ]; then rm -rf nptl* ; fi
117fi
118
119# set without-fp if target has no floating point unit
120if [ "${WITHOUT_FPU}" = "Y" ]; then
121 extra_conf="${extra_conf} --without-fp"
122fi
123
124# set --enable-kernel to match the kernel version
125# of the kernel headers glibc is to be built against
126#-------------------------------------------------
127# HACK: hack around 2.6.8.1 release
128case ${kernver} in 2.6.8.* ) kernver=2.6.8 ;; esac
129extra_conf="${extra_conf} --enable-kernel=${kernver}"
130
131test -d ${SRC}/glibc-${GLIBC_VER}-cross${suffix} &&
132 rm -rf ${SRC}/glibc-${GLIBC_VER}-cross${suffix}
133
134mkdir -p ${SRC}/glibc-${GLIBC_VER}-cross${suffix}
135cd ${SRC}/glibc-${GLIBC_VER}-cross${suffix}
136
137
138if [ "${USE_NPTL}" = "Y" ]; then
139 echo "libc_cv_forced_unwind=yes" > config.cache
140 echo "libc_cv_c_cleanup=yes" >> config.cache
141 case ${TGT_ARCH} in
142 sparc64 )
143 echo "libc_cv_sparc64_tls=yes" >> config.cache
144 ;;
145 esac
146 extra_conf="${extra_conf} --cache-file=config.cache"
147fi
148
149# Are libs to be installed into a non-standard place?
150if [ ! "${libdirname}" = "lib" ]; then
151 extra_conf="${extra_conf} --libdir=${BUILD_PREFIX}/${libdirname}"
152 # Also create a configparms file setting slibdir to */${libdirname}
153 if [ "${USE_SYSROOT}" = "Y" ]; then
154 echo "slibdir=/${libdirname}" >> configparms
155 else
156 echo "slibdir=${TGT_TOOLS}/${libdirname}" >> configparms
157 fi
158fi
159
160max_log_init Glibc ${GLIBC_VER} Cross ${CONFLOGS} ${LOG}
161BUILD_CC=gcc BUILD_CFLAGS="-O2 ${HOST_CFLAGS} -pipe" CFLAGS="-O2 -pipe" \
162CC="${TARGET}-gcc ${ARCH_CFLAGS} ${TGT_CFLAGS}" \
163AR="${TARGET}-ar" RANLIB="${TARGET}-ranlib" \
164../${PKGDIR}/configure --prefix=${BUILD_PREFIX} \
165 --host=${ALT_TGT} --build=${BUILD} \
166 --without-cvs --disable-profile --enable-add-ons \
167 --with-headers=${KERN_HDR_DIR} ${extra_conf} \
168 --with-binutils=${HST_TOOLS}/bin --without-gd \
169 --mandir=${BUILD_PREFIX}/share/man \
170 --infodir=${BUILD_PREFIX}/share/info \
171 --libexecdir=${BUILD_PREFIX}/${libdirname}/glibc \
172 >> ${LOGFILE} 2>&1 &&
173echo " o Configure OK" || barf
174
175min_log_init ${BUILDLOGS} &&
176make SHELL="bash" PARALLELMFLAGS="${PMFLAGS}" \
177 >> ${LOGFILE} 2>&1 &&
178echo " o Build OK" || barf
179
180min_log_init ${INSTLOGS} &&
181make ${INSTALL_OPTIONS} install \
182 >> ${LOGFILE} 2>&1 &&
183echo " o install OK"
184
Note: See TracBrowser for help on using the repository browser.