source: scripts/cross-scripts/cross-glibc-hdrs.sh@ 7ed0e05

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 7ed0e05 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.2 KB
RevLine 
[617118d]1#!/bin/bash
2
3# cross-lfs cross glibc header creation
4# -------------------------------------
5# $LastChangedBy$
6# $LastChangedDate$
7# $LastChangedRevision$
8# $HeadURL$
9#
10
11cd ${SRC}
12LOG="glibc-cross-headers.log"
13unpack_tarball glibc-${GLIBC_VER}
14
15cd ${PKGDIR}
16#3.1b1 - get real version of the glibc we are installing 20030527
17target_glibc_ver=`grep VERSION version.h | \
18 sed 's@.*\"\([0-9.]*\)\"@\1@'`
19export target_glibc_ver
20
21# if target is same as build host, adjust build slightly
22if [ "${TARGET}" = "${BUILD}" ]; then
23 BUILD=`echo ${BUILD} | sed 's@\([_a-zA-Z0-9]*\)\(-[_a-zA-Z0-9]*\)\(.*\)@\1\2x\3@'`
24fi
25
26# unpack linuxthreads add-on if required
27if [ ! "Y" = "${USE_NPTL}" -a ! -d ${SRC}/${PKGDIR}/linuxthreads ]; then
28 cd ${SRC}/${PKGDIR}
29 OLDPKGDIR=${PKGDIR} ; unpack_tarball glibc-linuxthreads-${GLIBC_VER}
30 PKGDIR=${OLDPKGDIR}
31fi
32
33# unpack libidn add-on if required (should be supplied with cvs versions)
34case ${target_glibc_ver} in
35 2.3.[4-9]* | 2.4* )
36 cd ${SRC}/${PKGDIR}
37 if [ ! -d libidn ]; then
38 OLDPKGDIR=${PKGDIR} ; unpack_tarball glibc-libidn-${GLIBC_VER}
39 PKGDIR=${OLDPKGDIR}
40 fi
41 ;;
42esac
43
44# MIPS specific fixes
45case ${TGT_ARCH} in
46 mips* )
47 # Fix syscalls for mips w 2.3.4
48 case ${GLIBC_VER} in
49 2.3.[45] ) apply_patch glibc-2.3.4-mips_syscall-2 ;;
50 esac
51 # For mips we need to use a mips compiler for generating headers
52 # this should have been created by cross-gcc-static-no-thread.sh
53 CC="${TARGET}-gcc"
54 ;;
55esac
56
57if [ "${USE_SYSROOT}" = "Y" ]; then
58 BUILD_PREFIX=/usr
59 INSTALL_PREFIX="${LFS}${BUILD_PREFIX}"
60 INSTALL_OPTIONS="install_root=${LFS}"
61else
62 BUILD_PREFIX=${TGT_TOOLS}
63 INSTALL_PREFIX="${TGT_TOOLS}"
64 INSTALL_OPTIONS=""
65fi
66
67if [ "${USE_SANITISED_HEADERS}" = "Y" ]; then
68 KERN_HDR_DIR="${INSTALL_PREFIX}/kernel-hdrs"
69else
70 KERN_HDR_DIR="${INSTALL_PREFIX}/include"
71fi
72
73test -d ${SRC}/glibc-${GLIBC_VER}-hdrs &&
74 rm -rf ${SRC}/glibc-${GLIBC_VER}-hdrs
75
76mkdir -p ${SRC}/glibc-${GLIBC_VER}-hdrs
77cd ${SRC}/glibc-${GLIBC_VER}-hdrs
78max_log_init Glibc ${GLIBC_VER} Cross ${CONFLOGS} ${LOG}
79
80# NOTE: ran into this during nptl configury
81# TODO: look into if this is required wo nptl
82if [ "Y" = ${USE_NPTL} ]; then
83 case ${TGT_ARCH} in
84 powerpc* | ppc* )
85 echo "libc_cv_ppc_machine=yes" >> config.cache
86 ;;
87 esac
88fi
89
90# set without-fp if target has no floating point unit
91if [ "${WITHOUT_FPU}" = "Y" ]; then
92 extra_conf="${extra_conf} --without-fp"
93fi
94
95# HACK: hack around 2.6.8.1 release
96case ${KERNEL_VER} in 2.6.8.* ) KERNEL_VER=2.6.8 ;; esac
97
98# Have to use the hosts cpp to generate the headers
99CC=${CC-gcc} ../${PKGDIR}/configure --prefix=${BUILD_PREFIX} \
100 --host=${TARGET} --build=${BUILD} \
101 --without-cvs --disable-sanity-checks \
102 --enable-kernel=${KERNEL_VER} \
103 --with-headers=${KERN_HDR_DIR} \
104 --with-binutils=${HST_TOOLS}/${TARGET}/bin \
105 --cache-file=config.cache ${extra_conf} \
106 >> ${LOGFILE} 2>&1 &&
107
108# Use target ld gas et al
109PATH=${HST_TOOLS}/${TARGET}/bin:${PATH} \
110make ${INSTALL_OPTIONS} install-headers \
111 >> ${LOGFILE} 2>&1 &&
112echo " o install-headers OK" || barf
113
114echo " include/bits should have been created"
115cp bits/stdio_lim.h ${INSTALL_PREFIX}/include/bits &&
116touch ${INSTALL_PREFIX}/include/gnu/stubs.h
117
118# copy across threading headers
119cd ${SRC}/${PKGDIR}
120
121# Firstly we need to use the correct directory for our target
122# arch. All ix86 builds should point to i386, sparc/sparc32/sparc64
123# to point to sparc, powerpc/powerpc64 to powerpc etc...
124case ${TGT_ARCH} in
125 i?86 )
126 ARCH=i386
127 ;;
128 x86_64 )
129 ARCH=x86_64
130 TYPE=x86_64
131 ;;
132 sparc64* )
133 ARCH=sparc
134 TYPE=sparc64
135 ;;
136 sparc* )
137 ARCH=sparc
138 TYPE=sparc32
139 ;;
140 alpha )
141 ARCH=alpha
142 ;;
143 powerpc64 | ppc64 )
144 ARCH=powerpc
145 TYPE=powerpc64
146 ;;
147 powerpc | ppc )
148 ARCH=powerpc
149 TYPE=powerpc32
150 ;;
151 s390x )
152 ARCH=s390
153 TYPE=s390x
154 ;;
155 s390 )
156 ARCH=s390
157 TYPE=s390
158 ;;
159 mips* )
160 ARCH=mips
161 ;;
162esac
163
164if [ "${USE_NPTL}" = "Y" ]; then
165
166 #NPTL
167 cp nptl/sysdeps/pthread/pthread.h ${INSTALL_PREFIX}/include/
168 cp nptl/sysdeps/unix/sysv/linux/${ARCH}/bits/pthreadtypes.h \
169 ${INSTALL_PREFIX}/include/bits/
170
171 # On s390, powerpc and sparc we also need to get
172 # sysdeps/${ARCH}/${TGT_ARCH}/bits/wordsize.h
173
174 # As of 20040909 pthread.h pulls in bits/wordsize.h .
175 # TODO: investigate whether the correct wordsize.h gets copied
176 # across for a straight 64bit target (alpha) when doing this
177 # on a 32bit system. ( see sysdeps/wordsize-{32,64} )
178 if [ -f sysdeps/${ARCH}/${TYPE}/bits/wordsize.h ]; then
179 if [ ! -f ${INSTALL_PREFIX}/include/bits/wordsize.h ]; then
180 echo " - copying sysdeps/${ARCH}/${TYPE}/bits/wordsize.h"
181 cp sysdeps/${ARCH}/${TYPE}/bits/wordsize.h ${INSTALL_PREFIX}/include/bits/
182 fi
183 fi
184
185else
186
187 #Linuxthreads
188 cp linuxthreads/sysdeps/pthread/pthread.h ${INSTALL_PREFIX}/include/
189 cp linuxthreads/sysdeps/pthread/bits/pthreadtypes.h \
190 ${INSTALL_PREFIX}/include/bits/
191
192 # TODO: on hppa we'd probably want
193 # sysdeps/unix/sysv/linux/hppa/bits/initspin.h
194 # instead
195 cp linuxthreads/sysdeps/pthread/bits/initspin.h \
196 ${INSTALL_PREFIX}/include/bits/
197fi
Note: See TracBrowser for help on using the repository browser.