source: scripts/scripts/native-scripts/native-glibc.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: 6.0 KB
Line 
1#!/bin/bash
2
3# cross-lfs native glibc build
4# ----------------------------
5# $LastChangedBy$
6# $LastChangedDate$
7# $LastChangedRevision$
8# $HeadURL$
9#
10
11cd ${SRC}
12LOG="glibc-native.log"
13
14# Test if the 64 script has been called.
15# This should only really get called during bi-arch builds
16SELF=`basename ${0}`
17set_buildenv
18set_libdirname
19setup_multiarch
20
21# Only add --build=foo ( and probably should set --host=foo )
22# if we are doing a multi-arch build.
23# By rights --host should be inferred from --build, and CC will
24# be set for the correct emulation ( via -m32/-m64 etc ) anyway
25if [ "Y" = "${MULTIARCH}" ]; then
26 if [ -z "${ALT_TGT}" ]; then ALT_TGT="${TARGET}" ; fi
27 extra_conf="--build=${ALT_TGT}"
28fi
29
30if [ "${USE_SYSROOT}" = "Y" ]; then
31 KERN_HDR_PREFIX=/usr
32else
33 KERN_HDR_PREFIX="${TGT_TOOLS}"
34fi
35
36# point at the correct kernel headers
37#------------------------------------
38if [ "Y" = "${USE_SANITISED_HEADERS}" ]; then
39 KERN_HDR_DIR="${KERN_HDR_PREFIX}/kernel-hdrs"
40else
41 KERN_HDR_DIR="${KERN_HDR_PREFIX}/include"
42fi
43
44unpack_tarball glibc-${GLIBC_VER} &&
45cd ${PKGDIR}
46
47# Gather package version information
48#-----------------------------------
49target_glibc_ver=`grep VERSION version.h | \
50 sed 's@.*\"\([0-9.]*\)\"@\1@'`
51export target_glibc_ver
52
53# Retrieve target_gcc_ver from gcc -v output
54target_gcc_ver=`${CC-gcc} -v 2>&1 | grep " version " | \
55 sed 's@.*version \([0-9.]*\).*@\1@g'`
56
57# get kernel version from kernel headers
58kernver=`grep UTS_RELEASE ${KERN_HDR_DIR}/linux/version.h | \
59 sed 's@.*\"\([0-9.]*\).*\"@\1@g' `
60
61# if we don't have linuxthreads dirs (ie: a glibc release), then
62# unpack the linuxthreads tarball
63case ${GLIBC_VER} in
64 2.4 | 2.4.* ) ;;
65 * )
66 if [ ! -d linuxthreads -o ! -d linuxthreads_db ]; then
67 OLDPKGDIR=${PKGDIR} ; unpack_tarball glibc-linuxthreads-${GLIBC_VER}
68 PKGDIR=${OLDPKGDIR}
69 fi
70 ;;
71esac
72
73# unpack libidn add-on if required (should be supplied with cvs versions)
74if [ "${USE_LIBIDN}" = "Y" ]; then
75case ${target_glibc_ver} in
76 2.3.[4-9]* | 2.4* )
77 cd ${SRC}/${PKGDIR}
78 if [ ! -d libidn ]; then
79 OLDPKGDIR=${PKGDIR} ; unpack_tarball glibc-libidn-${GLIBC_VER}
80 PKGDIR=${OLDPKGDIR}
81 fi
82 ;;
83esac
84fi
85
86# apply glibc patches as required depending on the above gcc/kernel versions
87# see funcs/glibc_funcs.sh
88apply_glibc_patches
89
90# Ensure sanity check uses correct glibc
91cd ${SRC}/${PKGDIR}
92ld_so=`gcc ${ARCH_CFLAGS} -dumpspecs | grep dynamic-linker | \
93 sed -e "s@.*-dynamic-linker \([-._a-zA-Z0-9/]*/${libdirname}/[-._a-zA-Z0-9/]*\).*@\1@g" \
94 -e 's@^.*/\(.*\)@\1@g'`
95sed -i "s@link_libs -o@link_libs -L/usr/${libdirname} -Wl,-dynamic-linker=/${libdirname}/${ld_so} -o@" \
96 scripts/test-installation.pl
97
98# configuration for pthread type
99#-------------------------------
100# HACK: nptl for sparc64 wont build
101case ${TGT_ARCH} in
102 sparc64 )
103 USE_NPTL=N
104 ;;
105esac
106
107if [ "Y" = "${USE_NPTL}" ]; then
108 # remove linuxthreads dirs if they exist
109 # (CVS source contains linuxthreads)
110 test -d linuxthreads &&
111 rm -rf linuxthreads*
112
113 # As of ~2003-10-06 nptl is included in glibc cvs
114 #test -d ./nptl &&
115 #test -d ./nptl_db ||
116 #unpack_tarball nptl-${NPTL_VER}
117
118 # fix tst-cancelx7 test (if needed)
119 fname="${SRC}/${PKGDIR}/nptl/Makefile"
120 grep tst-cancelx7-ARGS ${fname} > /dev/null 2>&1 || {
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
145# End prep
146#--------------------------------
147touch /etc/ld.so.conf
148
149test -d ${SRC}/glibc-${GLIBC_VER}-native${suffix} &&
150 rm -rf ${SRC}/glibc-${GLIBC_VER}-native${suffix}
151
152mkdir ${SRC}/glibc-${GLIBC_VER}-native${suffix}
153cd ${SRC}/glibc-${GLIBC_VER}-native${suffix}
154
155if [ ! "${libdirname}" = "lib" ]; then
156 extra_conf="${extra_conf} --libdir=/usr/${libdirname}"
157 # Also create a configparms file setting slibdir to */libdirname
158 echo "slibdir=/${libdirname}" >> configparms
159fi
160
161max_log_init Glibc ${GLIBC_VER} native ${CONFLOGS} ${LOG}
162CFLAGS="-O2 -pipe" PARALLELMFLAGS="${PMFLAGS}" \
163CC="${CC-gcc} ${ARCH_CFLAGS} ${TGT_CFLAGS}" \
164CXX="${CXX-g++} ${ARCH_CFLAGS} ${TGT_CFLAGS}" \
165../${PKGDIR}/configure --prefix=/usr \
166 --without-cvs --disable-profile --enable-add-ons \
167 --with-headers=${KERN_HDR_DIR} ${extra_conf} \
168 --mandir=/usr/share/man --infodir=/usr/share/info \
169 --libexecdir=/usr/${libdirname}/glibc \
170 >> ${LOGFILE} 2>&1 &&
171echo " o Configure OK" &&
172
173min_log_init ${BUILDLOGS} &&
174make PARALLELMFLAGS="${PMFLAGS}" \
175 >> ${LOGFILE} 2>&1 &&
176echo " o Build OK" || barf
177
178# Tests moved after install, during glibc tests
179# at times librt will be rebuilt... incorrectly.
180# Better to install first and not have to worry
181# about anything built correctly being replaced
182# by something broken...
183
184echo "-Installing Glibc" &&
185min_log_init ${INSTLOGS} &&
186make install \
187 >> ${LOGFILE} 2>&1 &&
188echo " o install OK" || barf
189
190make localedata/install-locales \
191 >> ${LOGFILE} 2>&1 &&
192echo " o install-locales OK" || barf
193ln -sf ../usr/share/zoneinfo/${TZ} /etc/localtime &&
194
195# Use make -k check... will have to revisit this
196min_log_init ${TESTLOGS} &&
197make -k check \
198 >> ${LOGFILE} 2>&1 &&
199echo " o Test OK" || errmsg
200
201# install sample nscd.conf
202if [ ! -f /etc/nscd.conf ]; then
203 echo -n " o Creating /etc/nscd.conf - "
204 cp ${SRC}/${PKGDIR}/nscd/nscd.conf /etc/nscd.conf &&
205 echo "OK" || echo "FAIL"
206fi
207
208if [ ! -d /var/run/nscd ]; then
209 mkdir -p /var/run/nscd
210fi
Note: See TracBrowser for help on using the repository browser.