mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

248 lines
7.4 KiB

#!/bin/bash
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/glibc/glibc.conf
# ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
forcefpic=0
pkg_glibc_version=${xpkg#glibc}
pkg_glibc_host="$arch_target"
pkg_glibc_cross=""
pkg_glibc_headers_only=0
pkg_glibc_cc=""
if [ "$ROCKCFG_MULTILIB" = 1 ] ; then
if [[ "$xpkg" = *-32bit ]] ; then
pkg_glibc_cc="$BUILD32"
pkg_glibc_host="$arch_target32"
else
pkg_glibc_cc="$BUILD64"
fi
fi
prefix="usr"
set_confopt
case "$xpkg" in
glibc??-cross-*)
pkg_glibc_cross="${xpkg#glibc*-cross-}"
pkg_glibc_version=${pkg_glibc_version%-cross-*}
pkg_glibc_host="${pkg_glibc_cross}-unknown-linux-gnu"
prefix="$prefix/$pkg_glibc_host"
set_confopt
echo_status "Preparing to build a cross-glibc package for $pkg_glibc_cross."
;;
glibc??|glibc??-32bit)
pkg_glibc_version=${pkg_glibc_version%-??bit}
;;
*)
echo_error "Not supported $pkg package name: $xpkg"
false
;;
esac
patchfiles="`ls $confdir/glibc$pkg_glibc_version/*.patch \
$confdir/glibc$pkg_glibc_version/*.patch.$arch 2>/dev/null | tr '\n' ' '` $patchfiles"
if [ $stagelevel -le 2 ]; then
patchfiles="`ls $patchfiles $confdir/glibc$pkg_glibc_version/*.patch.cross \
$confdir/glibc$pkg_glibc_version/*.patch.cross.$arch 2>/dev/null | tr '\n' ' '`"
fi
configscript="../glibc-*/configure"
if [ $stagelevel -eq 0 ] ; then
pkg_glibc_headers_only=1
configprefix="CC=gcc"
confopt="--prefix=/$prefix --build=${CLFS_HOST} --host=${CLFS_TARGET} \
--with-headers=${CLFS}/$prefix/include --cache-file=config.cache"
makeopt=""
makeinstopt="install-headers"
else
if [ $stagelevel -eq 1 ] ; then
export CC="${CLFS_TARGET}-gcc $pkg_glibc_cc"
export AR="${CLFS_TARGET}-ar"
export RANLIB="${CLFS_TARGET}-ranlib"
fi
confopt="prefix=/$prefix --build=${CLFS_HOST} --host=$pkg_glibc_host \$extraconfopt"
var_append extraconfopt " " "--disable-profile --enable-add-ons \
--with-tls --enable-kernel=2.6.0 --with-__thread --cache-file=config.cache"
if [ $stagelevel -le 2 ] ; then
var_append extraconfopt " " "--with-binutils=${CLFS}/$cross_tools/bin \
--with-headers=${CLFS}/$prefix/include"
fi
makeopt=""
makeinstopt="install"
fi
if [ "$pkg_glibc_cross" ] ; then
arch_target="$pkg_glibc_host"
arch_machine="${arch_target##-*}"
if [ -z "$( type -p $pkg_glibc_host-gcc )" ]
then
echo_status "Building only cross-headers because there is no cross-gcc (yet)."
pkg_glibc_headers_only=1
makeinstopt="install-headers"
else
export CC=$pkg_glibc_host-gcc
export AR=$pkg_glibc_host-ar
export RANLIB=$pkg_glibc_host-ranlib
fi
fi
# Fix for mips when building glibc headers.
if [[ "$pkg_glibc_host" == mips* ]] ; then
if [ $pkg_glibc_headers_only = 1 ] ; then
var_append patchfiles " " "$confdir/glibc$pkg_glibc_version/glibc-*-mips-mabi-stage0.diff"
fi
fi
hook_add prepatch 5 "glibc_prepatch"
glibc_prepatch () {
echo Extracting $archdir/glibc-ports-*.tar.bz2 ...
tar -xf $archdir/glibc-ports-*.tar.bz2
mv -v glibc-ports-* ports
if [ $stagelevel -ge 3 ] ; then
echo Extracting $archdir/glibc-libidn-*.tar.bz2 ...
tar -xf $archdir/glibc-libidn-*.tar.bz2
mv -v glibc-libidn-* libidn
fi
}
custmain="glibc_custmain"
glibc_custmain () {
if [ $pkg_glibc_headers_only = 1 ] ; then
cp configure{,.orig}
sed -e 's/3.4/3.[0-9]/g' configure.orig > configure
# more configure hacks: tls support everywhere
for x in $( find .. -name configure | xargs grep libc_cv_.*_tls | \
sed -r 's,.*(libc_cv),\1,; s,(_tls).*,\1,' | sort -u; )
do eval "export $x=yes"; done
export libc_cv_mlong_double_128=yes
export libc_cv_mlong_double_128ibm=yes
export libc_cv_mabi_ibmlongdouble=yes
export libc_cv_ppc_machine=yes
fi
mkdir -v ../objdir ; cd ../objdir
if [ $stagelevel -le 2 -o "$pkg_glibc_cross" ] ; then
echo "libc_cv_forced_unwind=yes" > config.cache
echo "libc_cv_c_cleanup=yes" >> config.cache
fi
if [ -z "$pkg_glibc_cross" ] ; then
echo "slibdir=/$multilib" >> configparms
fi
echo "install_root=$instroot" >> configparms
eval_config_command $( eval echo $confopt )
if [ $pkg_glibc_headers_only = 0 ] ; then
eval $MAKE $makeopt
fi
if [ "$ROCKCFG_DO_CHECK" = 1 -a $stagelevel -ge 3 ] ; then
make -k check 2>&1 | tee glibc-check-log
grep Error glibc-check-log || true
fi
eval $MAKE $makeinstopt
if [ $pkg_glibc_headers_only = 1 ] ; then
mkdir -p $root/$prefix/include/bits
cp -v bits/stdio_lim.h ${CLFS}/$prefix/include/bits/
mkdir -p $root/$prefix/include/gnu
touch ${CLFS}/$prefix/include/gnu/stubs.h
case "$arch" in
x86)
if [ "$ROCKCFG_X86_BITS" = 64 ] ; then
pkg_glibc_arch=x86_64
else
pkg_glibc_arch=i386
fi ;;
*) pkg_glibc_arch="$arch" ;;
esac
if [ -e ../glibc-*/nptl/sysdeps/unix/sysv/linux/$arch/bits/pthreadtypes.h ]
then
cp -v ../glibc-*/nptl/sysdeps/unix/sysv/linux/$arch/bits/pthreadtypes.h \
${CLFS}/$prefix/include/bits
fi
elif [[ "$xpkg" != *-32bit ]] ; then
ln -sf libbsd-compat.a $libdir/libbsd.a
# copy crypt documentation
#
cp -v ../glibc-*/crypt/README.ufc-crypt $docdir/README.crypt
# NSCD Init script and config
#
cp $confdir/nscd.conf $confdir/nsswitch.conf $sysconfdir/
install_init nscd $confdir/nscd.init
cp -av $confdir/{ld.so,nsswitch}.conf $sysconfdir/
if [ -f $datadir/zoneinfo/Factory ] ; then
cp -v --remove-destination $datadir/zoneinfo/Factory \
$sysconfdir/localtime
fi
# Create /lib/ld-lsb.so.1 symlink
#
if [ -f $root/$multilib/ld-linux-$arch_machine.so.2 ]; then
ln -vfs ld-linux-$arch_machine.so.2 $root/$multilib/ld-lsb.so.1
elif [ -f $root/$multilib/ld-linux.so.2 ]; then
ln -vfs ld-linux.so.2 $root/$multilib/ld-lsb.so.1
fi
if [ $stagelevel -ge 3 -a -z "$pkg_glibc_cross" ] ; then
# otherwise we risk the hosts /usr/lib/locale/locale-archive being overwritten
eval $MAKE localedata/install-locales
cp -v ../glibc-*/localedata/SUPPORTED $root/usr/share/i18n/
fi
elif [[ "$xpkg" = *-32bit ]] ; then
# -32bit and -64bit differ by these files, in addition to lib and lib64 dirs;
# -32bit installs:
# usr/bin/lddlibc4
# libexec/getconf/POSIX_V6_ILP32_OFF32
# libexec/getconf/POSIX_V6_ILP32_OFFBIG
# include/gnu/stubs-32.h
# include/sys/vm86.h
# -64bit installs:
# include/gnu/stubs-64.h
cp -av $dummydir/lib/* $root/$multilib/
cp -av $dummydir/usr/lib/* $root/usr/$multilib/
cp -av $bindir/lddlibc4 $root/usr/bin/
mkdir -vp $root/usr/include/{gnu,sys}
cp -av $includedir/gnu/stubs-32.h $root/usr/include/gnu/
cp -av $includedir/sys/vm86.h $root/usr/include/sys/
fi
}