我想在lfs下参考以下的方式手工编译glibc:
# $Id: PKGBUILD,v 1.41 2005/11/23 18:50:25 judd Exp $
# Maintainer: judd <jvinet@zeroflux.org>
pkgname=glibc
pkgver=2.3.5
pkgrel=8
# glibc doesn't release very often, so we often use CVS snapshots to
# stay up-to-date with new features. Snapshots are available from Fedora
_snap=20050524T1606
_hdrver=2.6.12.0
pkgdesc="GNU C Library with NPTL and linuxthreads"
url="http://www.gnu.org/software/libc"
depends=()
source=(ftp://ftp.archlinux.org/other/glibc/glibc-${_snap}.tar.bz2
ftp://ftp.archlinux.org/other/glibc/glibc-fedora-${_snap}.tar.bz2
http://ep09.pld-linux.org/~mmazur/linux-libc-headers/linux-libc-headers-${_hdrver}.tar.bz2
glibc-fedora.patch
glibc-20050524-20050727.patch
glibc-zh_TW.patch
glibc-20050727-20050815.patch
nscd)
md5sums=('8543c324cdd8c43aea280fa3738f8186' 'ea77b628e06890d36248f2199c3cc1d5'
'eae2f562afe224ad50f65a6acfb4252c' 'c6768e173970d5ad04de1927baf1306f'
'29ec3c34425c0460b5d8073b0396b0fd' 'f12227b71659f1dd9b1ef7ee6d630b63'
'66442b650f6e1c6eb6aef543023972c6' 'b587ee3a70c9b3713099295609afde49')
build() {
# Kernel Headers
mkdir -p ${startdir}/pkg/usr/include
cp -r linux-libc-headers-${_hdrver}/include/linux ${startdir}/pkg/usr/include/linux
cp -r linux-libc-headers-${_hdrver}/include/asm-i386 ${startdir}/pkg/usr/include/asm
find ${startdir}/pkg -type d -exec chmod 755 {} \;
find ${startdir}/pkg -type f -exec chmod 644 {} \;
echo "" > ${startdir}/pkg/usr/include/linux/config.h
chown -R root.root ${startdir}/pkg/usr/include
cd ${startdir}/src/glibc-${_snap}
patch -E -Np1 -i ${startdir}/src/glibc-fedora.patch || return 1
patch -Np1 -i ${startdir}/src/glibc-20050524-20050727.patch || return 1
patch -Np1 -i ${startdir}/src/glibc-zh_TW.patch || return 1
patch -Np1 -i ${startdir}/src/glibc-20050727-20050815.patch || return 1
find . -type f -size 0 -o -name "*.orig" -exec rm -f {} \;
mkdir build-linuxthreads
cd build-linuxthreads
if echo '__thread int a;' | gcc -xc - -S -o /dev/null 2>/dev/null; then
sed -i -e 's/0 [|][|]/1 ||/' ../elf/tst-tls10.h ../linuxthreads/tst-tls1.h
fi
AddOns=`cd .. && echo */configure | sed -e 's!/configure!!g;s!\(linuxthreads\|nptl\|rtkaio\)\( \|$\)!!g;s! \+$!!;s! !,!g;s!^!,!;/^,\*$/d'`
CFLAGS="${CFLAGS} -DNDEBUG=1" ../configure --prefix=/usr \
--enable-add-ons=linuxthreads${AddOns} --without-cvs \
--enable-kernel=2.4.1 --disable-profile \
--with-headers=$startdir/pkg/usr/include \
--enable-bind-now --with-tls --without-__thread \
--build ${CHOST} --host ${CHOST}
make -r CFLAGS="${CFLAGS}" || return 1
make install_root=${startdir}/pkg install || return 1
make install_root=${startdir}/pkg localedata/install-locales || return 1
cd ..
mkdir build-nptl
cd build-nptl
CFLAGS="${CFLAGS} -DNDEBUG=1" ../configure --prefix=/usr \
--enable-add-ons=nptl${AddOns} --without-cvs \
--enable-kernel=2.6.6 --disable-profile \
--with-headers=$startdir/pkg/usr/include \
--enable-bind-now --with-tls --with-__thread \
--build ${CHOST} --host ${CHOST}
make -r CFLAGS="${CFLAGS}" || return 1
cd build-nptl
mkdir -p ${startdir}/pkg/lib/tls/
libcsofile=`basename ${startdir}/pkg/lib/libc-*.so`
cp -a libc.so ${startdir}/pkg/lib/tls/${libcsofile}
ln -sf ${libcsofile} ${startdir}/pkg/lib/tls/`ls libc.so.*`
libmsofile=`basename ${startdir}/pkg/lib/libm-*.so`
pushd math > /dev/null
cp -a libm.so ${startdir}/pkg/lib/tls/${libmsofile}
ln -sf ${libmsofile} ${startdir}/pkg/lib/tls/`ls libm.so.*`
popd > /dev/null
librtsofile=`basename ${startdir}/pkg/lib/librt-*.so`
pushd rt > /dev/null
cp -a librt.so ${startdir}/pkg/lib/tls/${librtsofile}
ln -sf ${librtsofile} ${startdir}/pkg/lib/tls/`ls librt.so.*`
popd > /dev/null
libthreaddbsofile=`basename ${startdir}/pkg/lib/libthread_db-*.so`
pushd nptl_db > /dev/null
cp -a libthread_db.so ${startdir}/pkg/lib/tls/${libthreaddbsofile}
ln -sf ${libthreaddbsofile} ${startdir}/pkg/lib/tls/`ls libthread_db.so.*`
popd > /dev/null
libpthreadsofile=libpthread-${pkgver}.so
pushd nptl > /dev/null
cp -a libpthread.so ${startdir}/pkg/lib/tls/${libpthreadsofile}
ln -sf ${libpthreadsofile} ${startdir}/lib/tls/`ls libpthread.so.*`
popd > /dev/null
mkdir -p ${startdir}/pkg/usr/lib/nptl
cp -a libc.a nptl/libpthread.a nptl/libpthread_nonshared.a rt/librt.a \
${startdir}/pkg/usr/lib/nptl
for lib in libc libpthread; do
sed -e "s:/lib/${lib}.so:/lib/tls/${lib}.so:g" \
-e "s:/usr/lib/${lib}_nonshared.a:/usr/lib/nptl/${lib}_nonshared.a:g" \
${startdir}/pkg/usr/lib/${lib}.so \
> ${startdir}/pkg/usr/lib/nptl/${lib}.so
chmod 755 ${startdir}/pkg/usr/lib/nptl/${lib}.so
done
ln -sf ../librt.so ${startdir}/pkg/usr/lib/nptl/librt.so
mkdir -p ${startdir}/pkg/nptl ${startdir}/pkg/usr/include/nptl
make install_root=${startdir}/pkg/nptl install-headers || return 1
pushd ${startdir}/pkg/nptl/usr/include > /dev/null
for i in `find . -type f`; do
if ! [[ -f ${startdir}/pkg/usr/include/${i} ]] \
|| ! cmp -s ${i} ${startdir}/pkg/usr/include/${i}; then
mkdir -p ${startdir}/pkg/usr/include/nptl/`dirname ${i}`
cp -a ${i} ${startdir}/pkg/usr/include/nptl/${i}
fi
done
popd > /dev/null
rm -rf ${startdir}/pkg/nptl
rm -rf ${startdir}/pkg/etc/ld.so.cache ${startdir}/pkg/etc/localtime
install -D -m644 ${startdir}/src/glibc-${_snap}/nscd/nscd.conf ${startdir}/pkg/etc/nscd.conf
install -D -m755 ${startdir}/src/nscd ${startdir}/pkg/etc/rc.d/nscd
sed -i -e 's/^\tserver-user/#\tserver-user/' ${startdir}/pkg/etc/nscd.conf || return 1
}
build段里有两个build内容(build-linuxthreads,build-nptl),它们是同时存在的吧,还是选择存在的?后面的cp ln等内容也看不明白,手工编译时如何操作?谢谢 |