source: scripts/native-scripts/native-glibc.sh@ 873009c

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 873009c 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: 5.5 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
63if [ ! -d linuxthreads -o ! -d linuxthreads_db ]; then
64 OLDPKGDIR=${PKGDIR} ; unpack_tarball glibc-linuxthreads-${GLIBC_VER}
65 PKGDIR=${OLDPKGDIR}
66fi
67
68# unpack libidn add-on if required (should be supplied with cvs versions)
69case ${target_glibc_ver} in
70 2.3.[4-9]* | 2.4* )
71 cd ${SRC}/${PKGDIR}
72 if [ ! -d libidn ]; then
73 OLDPKGDIR=${PKGDIR} ; unpack_tarball glibc-libidn-${GLIBC_VER}
74 PKGDIR=${OLDPKGDIR}
75 fi
76 ;;
77esac
78
79# apply glibc patches as required depending on the above gcc/kernel versions
80# see funcs/glibc_funcs.sh
81apply_glibc_patches
82
83# configuration for pthread type
84#-------------------------------
85# HACK: nptl for sparc64 wont build
86case ${TGT_ARCH} in
87 sparc64 )
88 USE_NPTL=N
89 ;;
90esac
91
92if [ "Y" = "${USE_NPTL}" ]; then
93 # remove linuxthreads dirs if they exist
94 # (CVS source contains linuxthreads)
95 test -d linuxthreads &&
96 rm -rf linuxthreads*
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 (if needed)
104 fname="${SRC}/${PKGDIR}/nptl/Makefile"
105 grep tst-cancelx7-ARGS ${fname} > /dev/null 2>&1 || {
106 echo " - patching ${fname}"
107 mv ${fname} ${fname}-ORIG
108 sed -e '/tst-cancel7-ARGS = --command "$(built-program-cmd)"/a\
109tst-cancelx7-ARGS = --command "$(built-program-cmd)"' \
110 ${fname}-ORIG > ${fname}
111 }
112
113 extra_conf="${extra_conf} --with-tls --with-__thread"
114else
115 if [ -d ./nptl ]; then rm -rf nptl* ; fi
116fi
117
118# set without-fp if target has no floating point unit
119if [ "${WITHOUT_FPU}" = "Y" ]; then
120 extra_conf="${extra_conf} --without-fp"
121fi
122
123# set --enable-kernel to match the kernel version
124# of the kernel headers glibc is to be built against
125#-------------------------------------------------
126# HACK: hack around 2.6.8.1 release
127case ${kernver} in 2.6.8.* ) kernver=2.6.8 ;; esac
128extra_conf="${extra_conf} --enable-kernel=${kernver}"
129
130# End prep
131#--------------------------------
132touch /etc/ld.so.conf
133
134test -d ${SRC}/glibc-${GLIBC_VER}-native${suffix} &&
135 rm -rf ${SRC}/glibc-${GLIBC_VER}-native${suffix}
136
137mkdir ${SRC}/glibc-${GLIBC_VER}-native${suffix}
138cd ${SRC}/glibc-${GLIBC_VER}-native${suffix}
139
140if [ ! "${libdirname}" = "lib" ]; then
141 extra_conf="${extra_conf} --libdir=/usr/${libdirname}"
142 # Also create a configparms file setting slibdir to */libdirname
143 echo "slibdir=/${libdirname}" >> configparms
144fi
145
146max_log_init Glibc ${GLIBC_VER} native ${CONFLOGS} ${LOG}
147CFLAGS="-O2 -pipe" PARALLELMFLAGS="${PMFLAGS}" \
148CC="${CC-gcc} ${ARCH_CFLAGS} ${TGT_CFLAGS}" \
149CXX="${CXX-g++} ${ARCH_CFLAGS} ${TGT_CFLAGS}" \
150../${PKGDIR}/configure --prefix=/usr \
151 --without-cvs --disable-profile --enable-add-ons \
152 --with-headers=${KERN_HDR_DIR} ${extra_conf} \
153 --mandir=/usr/share/man --infodir=/usr/share/info \
154 --libexecdir=/usr/${libdirname}/glibc \
155 >> ${LOGFILE} 2>&1 &&
156echo " o Configure OK" &&
157
158min_log_init ${BUILDLOGS} &&
159make PARALLELMFLAGS="${PMFLAGS}" \
160 >> ${LOGFILE} 2>&1 &&
161echo " o Build OK" || barf
162
163# Tests moved after install, during glibc tests
164# at times librt will be rebuilt... incorrectly.
165# Better to install first and not have to worry
166# about anything built correctly being replaced
167# by something broken...
168
169echo "-Installing Glibc" &&
170min_log_init ${INSTLOGS} &&
171make install \
172 >> ${LOGFILE} 2>&1 &&
173echo " o install OK" || barf
174
175make localedata/install-locales \
176 >> ${LOGFILE} 2>&1 &&
177echo " o install-locales OK" || barf
178ln -sf ../usr/share/zoneinfo/${TZ} /etc/localtime &&
179
180# Use make -k check... will have to revisit this
181min_log_init ${TESTLOGS} &&
182make -k check \
183 >> ${LOGFILE} 2>&1 &&
184echo " o Test OK" || errmsg
185
186# install sample nscd.conf
187if [ ! -f /etc/nscd.conf ]; then
188 echo -n " o Creating /etc/nscd.conf - "
189 cp ${SRC}/${PKGDIR}/nscd/nscd.conf /etc/nscd.conf &&
190 echo "OK" || echo "FAIL"
191fi
192
193if [ ! -d /var/run/nscd ]; then
194 mkdir -p /var/run/nscd
195fi
Note: See TracBrowser for help on using the repository browser.