Blob Blame Raw
srpm glibc

# setup glibc
# This path MUST be relative, not absolute
GV=$(cd $SRC; echo glibc-2*)

if [ "$TARGET_ARCH" == "armv7hl" ]; then
  # rtkaio not supported on ARM
  rm -rf $SRC/$GV/rtkaio
fi

GLIBCARGS="--prefix=/usr
	--with-headers=$ROOTFS/usr/include
	--enable-kernel=2.6.32
	--enable-bind-now
	--build $BUILD
	--host $TARGET
	--disable-profile
	--cache-file=config.cache
	--without-cvs
	--with-elf
	--without-gd
	--disable-sanity-checks
	--with-tls
	--with-__thread
	--enable-obsolete-rpc
	"

mcd $BUILDDIR/glibc

# prefill glibc cache
echo libc_cv_forced_unwind=yes > config.cache
echo libc_cv_c_cleanup=yes >> config.cache
#echo libc_cv_ctors_header=yes >> config.cache
echo ac_cv_header_cpuid_h=yes >> config.cache
echo libc_cv_gcc_builtin_expect=yes >> config.cache

$SRC/$GV/configure $GLIBCARGS
notparallel
make $J ARCH=${KARCH} BUILD_CC=gcc cross-compiling=yes
make DESTDIR=$ROOTFS $J ARCH=${KARCH} BUILD_CC=gcc cross-compiling=yes install

( cd $ROOTFS/usr/include/bits
  sed '/ifndef.*NO_LONG_DOUBLE/,/#endif/d' < mathdef.h > mathdef.h.new
  mv mathdef.h.new mathdef.h
)

# 32-bit multilib libgcc needs 32-bit headers
if [ ! "$TARGET32" = "" ]; then

  old_CC=$CC
  old_CXX=$CC
  export CC="$TARGET-gcc -m32"
  export CXX="$TARGET-g++ -m32"

  GLIBCARGS="--prefix=/usr
	--with-headers=$ROOTFS/usr/include
	--enable-kernel=2.6.32
	--enable-bind-now
	--build $BUILD
	--host $TARGET32
	--disable-profile
	--cache-file=config.cache
	--without-cvs
	--with-elf
	--without-gd
	--disable-sanity-checks
	--with-tls
	--with-__thread
	--enable-obsolete-rpc
	"

  mcd $BUILDDIR/glibc32

  # prefill glibc cache
  echo libc_cv_forced_unwind=yes > config.cache
  echo libc_cv_c_cleanup=yes >> config.cache
  echo libc_cv_ctors_header=yes >> config.cache
  echo ac_cv_header_cpuid_h=yes >> config.cache
  echo libc_cv_gcc_builtin_expect=yes >> config.cache

  $SRC/$GV/configure $GLIBCARGS
  notparallel
  make $J ARCH=${KARCH} BUILD_CC=gcc cross-compiling=yes
  make DESTDIR=$ROOTFS $J ARCH=${KARCH} BUILD_CC=gcc cross-compiling=yes install

  ( cd $ROOTFS/usr/include/bits
    sed '/ifndef.*NO_LONG_DOUBLE/,/#endif/d' < mathdef.h > mathdef.h.new
    mv mathdef.h.new mathdef.h
  )

  CC=$old_CC
  CXX=$old_CXX
  export $CC
  export $CXX

fi