source: scripts/scripts/cross-scripts/cross-glibc-full.sh @ 11fbfa9

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 11fbfa9 was 11fbfa9, checked in by Jim Gifford <clfs@…>, 18 years ago

r1045@server (orig r1043): ryan | 2006-01-12 00:56:45 -0800

r1079@rei: lfs | 2006-01-12 19:13:09 +1100
Update for glibc-2.3.6
Also add option to skip libgcc_s.so.1 creation (to match cross-lfs book)


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