2015-06-18 17:50:55 +00:00
|
|
|
set -vx
|
|
|
|
srpm glibc
|
|
|
|
|
|
|
|
# setup glibc
|
|
|
|
# This path MUST be relative, not absolute
|
|
|
|
GV=$(cd $SRC; echo glibc-2*)
|
|
|
|
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-stage1
|
|
|
|
|
|
|
|
# prefill glibc cache
|
|
|
|
echo libc_cv_forced_unwind=yes > config.cache
|
|
|
|
echo libc_cv_c_cleanup=yes >> config.cache
|
2015-11-05 16:54:43 +00:00
|
|
|
#echo libc_cv_ctors_header=yes >> config.cache
|
2015-06-18 17:50:55 +00:00
|
|
|
echo ac_cv_header_cpuid_h=yes >> config.cache
|
|
|
|
echo libc_cv_gcc_builtin_expect=yes >> config.cache
|
|
|
|
|
|
|
|
$SRC/$GV/configure $GLIBCARGS
|
|
|
|
notparallel
|
|
|
|
make DESTDIR=$ROOTFS $J ARCH=${KARCH} cross-compiling=yes install-headers
|
|
|
|
touch $ROOTFS/usr/include/gnu/stubs.h
|
|
|
|
touch $ROOTFS/usr/include/bits/stdio_lim.h
|
|
|
|
|
|
|
|
( cd $ROOTFS/usr/include/bits
|
|
|
|
sed '/ifndef.*NO_LONG_DOUBLE/,/#endif/d' < mathdef.h > mathdef.h.new
|
|
|
|
mv mathdef.h.new mathdef.h
|
|
|
|
)
|
|
|
|
|
|
|
|
# We also build just enough files to link libgcc.so. The fake
|
|
|
|
# libc.so will never actually get used, but simplifies the boostrap.
|
|
|
|
make $J ARCH=${KARCH} cross-compiling=yes csu/subdir_lib
|
|
|
|
|
|
|
|
mkdirp $ROOTFS/usr/lib${SUFFIX}
|
|
|
|
for file in `cd csu; echo crt*.o`; do
|
|
|
|
echo "" | $TARGET-as -o $ROOTFS/usr/lib${SUFFIX}/$file
|
|
|
|
done
|
|
|
|
$TARGET-gcc -nostdlib -nostartfiles -shared -x c /dev/null\
|
|
|
|
-o $ROOTFS/usr/lib${SUFFIX}/libc.so
|
|
|
|
|
2015-11-05 16:54:43 +00:00
|
|
|
|
|
|
|
# 32-bit multilib libgcc needs stub 32-bit libraries
|
|
|
|
if [ ! "$TARGET32" = "" ]; then
|
2015-06-18 17:50:55 +00:00
|
|
|
|
|
|
|
old_CC=$CC
|
|
|
|
old_CXX=$CC
|
|
|
|
export CC="$TARGET-gcc -m32"
|
|
|
|
export CXX="$TARGET-g++ -m32"
|
2015-11-05 16:54:43 +00:00
|
|
|
|
2015-06-18 17:50:55 +00:00
|
|
|
# setup 32-bit glibc headers
|
|
|
|
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-stage1
|
|
|
|
|
|
|
|
# prefill glibc cache
|
|
|
|
echo libc_cv_forced_unwind=yes > config.cache
|
|
|
|
echo libc_cv_c_cleanup=yes >> config.cache
|
2015-11-05 16:54:43 +00:00
|
|
|
#echo libc_cv_ctors_header=yes >> config.cache
|
2015-06-18 17:50:55 +00:00
|
|
|
echo ac_cv_header_cpuid_h=yes >> config.cache
|
|
|
|
echo libc_cv_gcc_builtin_expect=yes >> config.cache
|
|
|
|
|
|
|
|
$SRC/$GV/configure $GLIBCARGS
|
|
|
|
notparallel
|
|
|
|
make DESTDIR=$ROOTFS $J ARCH=${KARCH} cross-compiling=yes install-headers
|
|
|
|
touch $ROOTFS/usr/include/gnu/stubs.h
|
|
|
|
touch $ROOTFS/usr/include/bits/stdio_lim.h
|
|
|
|
|
|
|
|
( cd $ROOTFS/usr/include/bits
|
|
|
|
sed '/ifndef.*NO_LONG_DOUBLE/,/#endif/d' < mathdef.h > mathdef.h.new
|
|
|
|
mv mathdef.h.new mathdef.h
|
|
|
|
)
|
|
|
|
|
|
|
|
# We also build just enough files to link libgcc.so. The fake
|
|
|
|
# libc.so will never actually get used, but simplifies the boostrap.
|
|
|
|
make $J ARCH=${KARCH} cross-compiling=yes csu/subdir_lib
|
|
|
|
|
|
|
|
mkdirp $ROOTFS/usr/lib
|
|
|
|
for file in `cd csu; echo crt*.o`; do
|
|
|
|
echo "" | $TARGET-as --32 -o $ROOTFS/usr/lib/$file
|
|
|
|
done
|
|
|
|
$CC -m32 -nostdlib -nostartfiles -shared -x c /dev/null\
|
|
|
|
-o $ROOTFS/usr/lib/libc.so
|
|
|
|
|
|
|
|
CC=$old_CC
|
|
|
|
CXX=$old_CXX
|
|
|
|
export $CC
|
|
|
|
export $CXX
|
|
|
|
fi
|