Jaromir Capik d59907
set -vx
Jaromir Capik d59907
srpm glibc
Jaromir Capik d59907
Jaromir Capik d59907
# setup glibc
Jaromir Capik d59907
# This path MUST be relative, not absolute
Jaromir Capik d59907
GV=$(cd $SRC; echo glibc-2*)
Jaromir Capik d59907
GLIBCARGS="--prefix=/usr
Jaromir Capik d59907
	--with-headers=$ROOTFS/usr/include
Jaromir Capik d59907
	--enable-kernel=2.6.32
Jaromir Capik d59907
	--enable-bind-now
Jaromir Capik d59907
	--build $BUILD
Jaromir Capik d59907
	--host $TARGET
Jaromir Capik d59907
	--disable-profile
Jaromir Capik d59907
	--cache-file=config.cache
Jaromir Capik d59907
	--without-cvs
Jaromir Capik d59907
	--with-elf
Jaromir Capik d59907
	--without-gd
Jaromir Capik d59907
	--disable-sanity-checks
Jaromir Capik d59907
	--with-tls
Jaromir Capik d59907
	--with-__thread
Jaromir Capik d59907
	--enable-obsolete-rpc
Jaromir Capik d59907
	"
Jaromir Capik d59907
Jaromir Capik d59907
mcd $BUILDDIR/glibc-stage1
Jaromir Capik d59907
Jaromir Capik d59907
# prefill glibc cache
Jaromir Capik d59907
echo libc_cv_forced_unwind=yes > config.cache
Jaromir Capik d59907
echo libc_cv_c_cleanup=yes >> config.cache
Jaromir Capik 972d23
#echo libc_cv_ctors_header=yes >> config.cache
Jaromir Capik d59907
echo ac_cv_header_cpuid_h=yes >> config.cache
Jaromir Capik d59907
echo libc_cv_gcc_builtin_expect=yes >> config.cache
Jaromir Capik d59907
Jaromir Capik d59907
$SRC/$GV/configure $GLIBCARGS
Jaromir Capik d59907
notparallel
Jaromir Capik d59907
make DESTDIR=$ROOTFS $J ARCH=${KARCH} cross-compiling=yes install-headers
Jaromir Capik d59907
touch $ROOTFS/usr/include/gnu/stubs.h
Jaromir Capik d59907
touch $ROOTFS/usr/include/bits/stdio_lim.h
Jaromir Capik d59907
Jaromir Capik d59907
( cd $ROOTFS/usr/include/bits
Jaromir Capik d59907
  sed '/ifndef.*NO_LONG_DOUBLE/,/#endif/d' < mathdef.h > mathdef.h.new
Jaromir Capik d59907
  mv mathdef.h.new mathdef.h
Jaromir Capik d59907
)
Jaromir Capik d59907
Jaromir Capik d59907
# We also build just enough files to link libgcc.so.  The fake
Jaromir Capik d59907
# libc.so will never actually get used, but simplifies the boostrap.
Jaromir Capik d59907
make $J ARCH=${KARCH} cross-compiling=yes csu/subdir_lib
Jaromir Capik d59907
Jaromir Capik d59907
mkdirp $ROOTFS/usr/lib${SUFFIX}
Jaromir Capik d59907
for file in `cd csu; echo crt*.o`; do
Jaromir Capik d59907
    echo "" | $TARGET-as -o $ROOTFS/usr/lib${SUFFIX}/$file
Jaromir Capik d59907
done
Jaromir Capik d59907
$TARGET-gcc -nostdlib -nostartfiles -shared -x c /dev/null\
Jaromir Capik d59907
	 -o $ROOTFS/usr/lib${SUFFIX}/libc.so
Jaromir Capik d59907
Jaromir Capik 972d23
Jaromir Capik 972d23
# 32-bit multilib libgcc needs stub 32-bit libraries
Jaromir Capik 972d23
if [ ! "$TARGET32" = "" ]; then
Jaromir Capik d59907
Jaromir Capik d59907
  old_CC=$CC
Jaromir Capik d59907
  old_CXX=$CC
Jaromir Capik d59907
  export CC="$TARGET-gcc -m32"
Jaromir Capik d59907
  export CXX="$TARGET-g++ -m32"
Jaromir Capik 972d23
Jaromir Capik d59907
  # setup 32-bit glibc headers
Jaromir Capik d59907
  GLIBCARGS="--prefix=/usr
Jaromir Capik d59907
	--with-headers=$ROOTFS/usr/include
Jaromir Capik d59907
	--enable-kernel=2.6.32
Jaromir Capik d59907
	--enable-bind-now
Jaromir Capik d59907
	--build $BUILD
Jaromir Capik d59907
	--host $TARGET32
Jaromir Capik d59907
	--disable-profile
Jaromir Capik d59907
	--cache-file=config.cache
Jaromir Capik d59907
	--without-cvs
Jaromir Capik d59907
	--with-elf
Jaromir Capik d59907
	--without-gd
Jaromir Capik d59907
	--disable-sanity-checks
Jaromir Capik d59907
	--with-tls
Jaromir Capik d59907
	--with-__thread
Jaromir Capik d59907
	--enable-obsolete-rpc
Jaromir Capik d59907
	"
Jaromir Capik d59907
Jaromir Capik d59907
  mcd $BUILDDIR/glibc32-stage1
Jaromir Capik d59907
Jaromir Capik d59907
  # prefill glibc cache
Jaromir Capik d59907
  echo libc_cv_forced_unwind=yes > config.cache
Jaromir Capik d59907
  echo libc_cv_c_cleanup=yes >> config.cache
Jaromir Capik 972d23
  #echo libc_cv_ctors_header=yes >> config.cache
Jaromir Capik d59907
  echo ac_cv_header_cpuid_h=yes >> config.cache
Jaromir Capik d59907
  echo libc_cv_gcc_builtin_expect=yes >> config.cache
Jaromir Capik d59907
Jaromir Capik d59907
  $SRC/$GV/configure $GLIBCARGS
Jaromir Capik d59907
  notparallel
Jaromir Capik d59907
  make DESTDIR=$ROOTFS $J ARCH=${KARCH} cross-compiling=yes install-headers
Jaromir Capik d59907
  touch $ROOTFS/usr/include/gnu/stubs.h
Jaromir Capik d59907
  touch $ROOTFS/usr/include/bits/stdio_lim.h
Jaromir Capik d59907
Jaromir Capik d59907
  ( cd $ROOTFS/usr/include/bits
Jaromir Capik d59907
    sed '/ifndef.*NO_LONG_DOUBLE/,/#endif/d' < mathdef.h > mathdef.h.new
Jaromir Capik d59907
    mv mathdef.h.new mathdef.h
Jaromir Capik d59907
  )
Jaromir Capik d59907
Jaromir Capik d59907
  # We also build just enough files to link libgcc.so.  The fake
Jaromir Capik d59907
  # libc.so will never actually get used, but simplifies the boostrap.
Jaromir Capik d59907
  make $J ARCH=${KARCH} cross-compiling=yes csu/subdir_lib
Jaromir Capik d59907
Jaromir Capik d59907
  mkdirp $ROOTFS/usr/lib
Jaromir Capik d59907
  for file in `cd csu; echo crt*.o`; do
Jaromir Capik d59907
    echo "" | $TARGET-as --32 -o $ROOTFS/usr/lib/$file
Jaromir Capik d59907
  done
Jaromir Capik d59907
  $CC -m32 -nostdlib -nostartfiles -shared -x c /dev/null\
Jaromir Capik d59907
	-o $ROOTFS/usr/lib/libc.so
Jaromir Capik d59907
Jaromir Capik d59907
  CC=$old_CC
Jaromir Capik d59907
  CXX=$old_CXX
Jaromir Capik d59907
  export $CC
Jaromir Capik d59907
  export $CXX
Jaromir Capik d59907
fi