#
# install kernel headers first so that gcc doesn't fail to find them if
# glibc decides to compile stuff during 'make install', which it does in 2.4
#
install  -d  ${INSTALL_ROOT}/usr/include  &&
cd  $GLIBC_HEADERS_DIR/usr/include        &&

if [  !  "$GLIBC_NPTL"  =  "y"  ];  then
  echo  "installing asm-generic headers"                &&
  install  -d  ${INSTALL_ROOT}/usr/include/asm-generic  &&
  cp  -fa  asm-generic/*  ${INSTALL_ROOT}/usr/include/asm-generic
fi  &&

echo  "installing glibc linux headers"               &&
for dir in *
do
  install  -d  ${INSTALL_ROOT}/usr/include/$dir       &&
  cp  -fa  $dir/*  ${INSTALL_ROOT}/usr/include/$dir 
done

cd $SOURCE_DIRECTORY.bld  &&

#
# glibc only installs these if the file differs
#
for  i  in  ${INSTALL_ROOT}/usr/include/bits/syscall.h  \
            ${INSTALL_ROOT}/usr/include/gnu/stubs.h     \
            ${INSTALL_ROOT}/usr/include/gnu/stubs-32.h  \
            ${INSTALL_ROOT}/usr/include/gnu/stubs-64.h; do
  if  [  -f  $i  ];  then
    rm  -vf  $i
  fi
done  &&
#
# End syscall.h and stubs.h fix
#

#
# install
#
make  install install_root="${INSTALL_ROOT}" &&
if [[ ${SMGL_COMPAT_ARCHS[1]} == x86_64 ]]; then
  [ -d /lib64 -a ! -f /lib64/ld-linux-x86-64.so.2 -a -f /lib/ld-linux-x86-64.so.2 ] &&
    ln -s $TRACK_ROOT/lib/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2
  true  # see bug 8626 for info about this conditional
fi &&
(  ldconfig  ||  true  )  &&

#
# In case this is a "new" system, setup INSTALL_ROOT/etc/ld.so.conf
#
if  !  grep  -q  "/usr/lib"  $INSTALL_ROOT/etc/ld.so.conf;  then
  echo  "/usr/lib"  >>  $INSTALL_ROOT/etc/ld.so.conf
fi  &&

if [[ $INIT_INSTALLED ]]; then
  install_config_file "$SPELL_DIRECTORY/init.d/nscd.conf" \
                      "$INSTALL_ROOT/etc/sysconfig/nscd"
fi &&

install_config_file  $SOURCE_DIRECTORY/nscd/nscd.conf  \
                     $INSTALL_ROOT/etc/nscd.conf
