Adding STAGE1 bootstrap recipes

This commit is contained in:
Jaromir Capik 2015-06-18 19:50:16 +02:00
parent e63fda9e1a
commit d599077305
2 changed files with 219 additions and 0 deletions

100
STAGE1-glibc Normal file
View File

@ -0,0 +1,100 @@
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} cross-compiling=yes
make DESTDIR=$ROOTFS $J ARCH=${KARCH} 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
)
# If we are building x86_64, then the 32-bit multilib libgcc
# will also need 32-bit headers.
if [ "$TARGET" = "x86_64-linux-gnu" ]; then
old_CC=$CC
old_CXX=$CC
export CC="$TARGET-gcc -m32"
export CXX="$TARGET-g++ -m32"
TARGET32=i686-pc-linux-gnu
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} cross-compiling=yes
make DESTDIR=$ROOTFS $J ARCH=${KARCH} 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

119
STAGE1-glibc-headers Normal file
View File

@ -0,0 +1,119 @@
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
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 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
# If we are building x86_64, then the 32-bit multilib libgcc
# will also need stub 32-bit libraries.
if [ "$TARGET" = "x86_64-linux-gnu" ]; then
old_CC=$CC
old_CXX=$CC
export CC="$TARGET-gcc -m32"
export CXX="$TARGET-g++ -m32"
TARGET32="i686-pc-linux-gnu"
# setup 32-bit glibc headers
# 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 $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
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 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