|
|
|
@ -1,4 +1,4 @@ |
|
|
|
|
|
|
|
#!/bin/bash |
|
|
|
# --- ROCK-COPYRIGHT-NOTE-BEGIN --- |
|
|
|
# |
|
|
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
|
|
@ -21,533 +21,233 @@ |
|
|
|
# |
|
|
|
# --- ROCK-COPYRIGHT-NOTE-END --- |
|
|
|
|
|
|
|
forcefpic=0 |
|
|
|
|
|
|
|
pkg_glibc_version=${xpkg#glibc} |
|
|
|
pkg_glibc_target=${arch_target} |
|
|
|
pkg_glibc_host="$arch_target" |
|
|
|
pkg_glibc_cross="" |
|
|
|
pkg_glibc_headers_only=0 |
|
|
|
pkg_glibc_cc="" |
|
|
|
|
|
|
|
if [ "$ROCKCFG_MULTILIB" = 1 ] ; then |
|
|
|
if [[ "$xpkg" = *-32bit ]] ; then |
|
|
|
pkg_glibc_cc="$BUILD32" |
|
|
|
pkg_glibc_host="$arch_target32" |
|
|
|
else |
|
|
|
pkg_glibc_cc="$BUILD64" |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
prefix="usr" |
|
|
|
set_confopt |
|
|
|
|
|
|
|
case "$xpkg" in |
|
|
|
glibc??-cross-*) |
|
|
|
if [[ $xpkg = *25 ]] ; then |
|
|
|
echo_error "Cross package not yet supported by glibc25. Use glibc23!" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
if [[ $xpkg = *26 ]] ; then |
|
|
|
echo_error "Cross package not yet supported by glibc26. Use glibc23!" |
|
|
|
exit 1 |
|
|
|
fi |
|
|
|
pkg_glibc_cross="${xpkg#glibc*-cross-}" |
|
|
|
pkg_glibc_version=${pkg_glibc_version%-cross-*} |
|
|
|
pkg_glibc_target="${pkg_glibc_cross}-unknown-linux-gnu" |
|
|
|
echo_status "Preparing to build a cross-glibc package for $pkg_glibc_cross." |
|
|
|
pkg_glibc_cross="${xpkg#glibc*-cross-}" |
|
|
|
pkg_glibc_version=${pkg_glibc_version%-cross-*} |
|
|
|
pkg_glibc_host="${pkg_glibc_cross}-unknown-linux-gnu" |
|
|
|
|
|
|
|
prefix="$prefix/$pkg_glibc_host" |
|
|
|
set_confopt |
|
|
|
|
|
|
|
echo_status "Preparing to build a cross-glibc package for $pkg_glibc_cross." |
|
|
|
;; |
|
|
|
glibc??) |
|
|
|
glibc??|glibc??-32bit) |
|
|
|
pkg_glibc_version=${pkg_glibc_version%-??bit} |
|
|
|
;; |
|
|
|
*) |
|
|
|
echo_error "Not supported $pkg package name: $xpkg" |
|
|
|
exit 1 |
|
|
|
false |
|
|
|
;; |
|
|
|
esac |
|
|
|
|
|
|
|
pkg_glibc_linuxthreads=1 |
|
|
|
[ "$ROCKCFG_PKG_GLIBC23_LINUXTHREADS" = "0" ] && pkg_glibc_linuxthreads=0 |
|
|
|
|
|
|
|
# fall back to linuxthreads for cross glibcs |
|
|
|
[ -n "$pkg_glibc_cross" ] && pkg_glibc_linuxthreads=1 |
|
|
|
|
|
|
|
[ "${pkg_glibc_version}" = "25" -o "${pkg_glibc_version}" = "26" ] && pkg_glibc_linuxthreads=0 |
|
|
|
|
|
|
|
# Give a more descriptive error message than the one that would happen during the build. |
|
|
|
kernel_mainline="`uname -r | cut -f-2 -d'.'`" |
|
|
|
if [ $pkg_glibc_linuxthreads = 0 -a "$kernel_mainline" != "2.6" ] ; then |
|
|
|
echo_error 'You are running a kernel of the $kernel_mainline series.' |
|
|
|
echo_error 'Glibc with NPTL support cannot be built on $kernel_mainline kernels.' |
|
|
|
echo_error 'Boot a 2.6 kernel to build Glibc with NPTL support or build Glibc' |
|
|
|
echo_error 'with old threading support (linuxthreads) instead.' |
|
|
|
abort |
|
|
|
fi |
|
|
|
|
|
|
|
#--------------------------------- |
|
|
|
if [ $pkg_glibc_version = 22 ]; then |
|
|
|
|
|
|
|
glibc_custmain() { |
|
|
|
cat > configparms <<- EOF |
|
|
|
prefix = /usr |
|
|
|
slibdir = /lib |
|
|
|
sysconfdir = /etc |
|
|
|
install_root = $root |
|
|
|
CC = $CC |
|
|
|
BUILD_CC = $BUILDCC |
|
|
|
AR = $AR |
|
|
|
RANLIB = $RANLIB |
|
|
|
EOF |
|
|
|
|
|
|
|
# Disable glibc internal debuging but build debuging and profile |
|
|
|
# code so we can use this glibc to debug other programs. |
|
|
|
CFLAGS="$CFLAGS -g -DNDEBUG=1" ./configure --with-gnu-binutils \ |
|
|
|
--enable-add-ons --enable-profile \ |
|
|
|
--with-headers=$root/usr/include \ |
|
|
|
--with-gd=/usr \ |
|
|
|
--with-gd-lib=/usr/lib \ |
|
|
|
--with-gd-include=/usr/include \ |
|
|
|
--build=${arch_build} ${arch_target} |
|
|
|
|
|
|
|
echo $BUILDCC elf/sln.c -o elf/dyn_sln |
|
|
|
$BUILDCC elf/sln.c -o elf/dyn_sln |
|
|
|
eval $MAKE symbolic-link-prog=elf/dyn_sln all install |
|
|
|
|
|
|
|
# Misc. stuff |
|
|
|
# |
|
|
|
if [ "$crossnative" = native ] ; then |
|
|
|
[ $stagelevel -gt 1 ] && eval $MAKE install-locales -C localedata |
|
|
|
# otherwise we risk the hosts /usr/lib/locale/locale-archive being overwritten |
|
|
|
mkdir -p $root/usr/share/man/man3 |
|
|
|
if [ -f /usr/bin/perl ] ; then |
|
|
|
eval $MAKE -C linuxthreads/man \ |
|
|
|
MANDIR=$root/usr/share/man/man3 all install |
|
|
|
fi |
|
|
|
fi |
|
|
|
ln -sf libbsd-compat.a $root/usr/lib/libbsd.a |
|
|
|
|
|
|
|
# copy linuxthreads and crypt documentation |
|
|
|
# |
|
|
|
cp linuxthreads/ChangeLog $docdir/ChangeLog.threads |
|
|
|
cp linuxthreads/Changes $docdir/Changes.threads |
|
|
|
cp linuxthreads/README $docdir/README.threads |
|
|
|
cp linuxthreads/FAQ.html $docdir/FAQ-threads.html |
|
|
|
cp -r linuxthreads/Examples $docdir/examples.threads |
|
|
|
cp crypt/README.ufc-crypt $docdir/README.crypt |
|
|
|
|
|
|
|
# NSCD Init script and config |
|
|
|
# |
|
|
|
cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/ |
|
|
|
install_init nscd $confdir/nscd.init |
|
|
|
|
|
|
|
# No absolute path in libc.so if cross-compileing |
|
|
|
# |
|
|
|
if [ $crossnative = cross ] ; then |
|
|
|
libcso=$root/usr/lib/libc.so |
|
|
|
for x in 1 2 3 4 5 ; do |
|
|
|
sed -i 's,/[a-z/]*/,,' $libcso |
|
|
|
done |
|
|
|
fi |
|
|
|
|
|
|
|
# Install ld.so.conf |
|
|
|
# |
|
|
|
{ |
|
|
|
echo "/usr/lib" |
|
|
|
echo "/usr/X11/lib" |
|
|
|
echo "/usr/local/lib" |
|
|
|
echo "/opt/*/lib" |
|
|
|
} > $root/etc/ld.so.conf |
|
|
|
if [ -f $root/usr/sbin/ldconfig ] ; then |
|
|
|
ln -sf ../usr/sbin/ldconfig $root/sbin/ |
|
|
|
fi |
|
|
|
} |
|
|
|
patchfiles="`ls $confdir/glibc$pkg_glibc_version/*.patch \ |
|
|
|
$confdir/glibc$pkg_glibc_version/*.patch.$arch 2>/dev/null | tr '\n' ' '` $patchfiles" |
|
|
|
|
|
|
|
if [ $stagelevel -le 2 ]; then |
|
|
|
patchfiles="`ls $patchfiles $confdir/glibc$pkg_glibc_version/*.patch.cross \ |
|
|
|
$confdir/glibc$pkg_glibc_version/*.patch.cross.$arch 2>/dev/null | tr '\n' ' '`" |
|
|
|
fi |
|
|
|
#--------------------------------- |
|
|
|
|
|
|
|
|
|
|
|
#--------------------------------- |
|
|
|
if [ $pkg_glibc_version = 23 ]; then |
|
|
|
|
|
|
|
glibc_custmain() { |
|
|
|
# check whether profiling is enabled |
|
|
|
if [ $ROCKCFG_PKG_GLIBC_ENABLE_PROFILE = 1 ] ; then |
|
|
|
G_PROFILE=--enable-profile |
|
|
|
else |
|
|
|
G_PROFILE=--disable-profile |
|
|
|
fi |
|
|
|
|
|
|
|
# Let's use an 'objdir' directory for building glibc |
|
|
|
mkdir -p objdir; cd objdir |
|
|
|
|
|
|
|
# NPTL doesn't work with plain i386 CPUs |
|
|
|
if [ $pkg_glibc_linuxthreads = 1 ]; then |
|
|
|
temp_arch_target="$arch_target" |
|
|
|
temp_arch_build="$arch_build" |
|
|
|
configure_without_tls="--without-tls" |
|
|
|
else |
|
|
|
temp_arch_target="${arch_target/i386/i486}" |
|
|
|
temp_arch_build="${arch_build/i386/i486}" |
|
|
|
configure_without_tls="" |
|
|
|
fi |
|
|
|
|
|
|
|
# Disable glibc internal debuging but build debuging and profile |
|
|
|
# code so we can use this glibc to debug other programs. |
|
|
|
create_config_cache >> config.cache |
|
|
|
CFLAGS="$CFLAGS -g -DNDEBUG=1" ../configure --prefix=$root/$prefix \ |
|
|
|
--with-gnu-binutils --enable-add-ons"$ADDONS" $G_PROFILE \ |
|
|
|
--with-headers=$root/$prefix/include --with-gd=/$prefix \ |
|
|
|
--with-gd-lib=/$prefix/lib --with-gd-include=/$prefix/include \ |
|
|
|
$configure_without_tls --cache-file=config.cache \ |
|
|
|
--build=${temp_arch_build} --host=${temp_arch_target} |
|
|
|
|
|
|
|
eval $MAKE prefix=/usr slibdir=/lib sysconfdir=/etc all |
|
|
|
if [ -z "$pkg_glibc_cross" ] |
|
|
|
then |
|
|
|
eval $MAKE prefix=/$prefix slibdir=/lib \ |
|
|
|
sysconfdir=/etc install_root=$root install |
|
|
|
else |
|
|
|
eval $MAKE prefix=/$prefix install_root=$root install |
|
|
|
fi |
|
|
|
ln -sf libbsd-compat.a $root/$prefix/lib/libbsd.a |
|
|
|
|
|
|
|
# install locales |
|
|
|
# |
|
|
|
if [ $stagelevel -gt 1 ] ; then |
|
|
|
# otherwise we risk the hosts /usr/lib/locale/locale-archive being overwritten |
|
|
|
eval $MAKE localedata/install-locales |
|
|
|
cp ../localedata/SUPPORTED $root/usr/share/i18n/ |
|
|
|
fi |
|
|
|
|
|
|
|
# copy crypt documentation |
|
|
|
# |
|
|
|
cp ../crypt/README.ufc-crypt $docdir/README.crypt |
|
|
|
configscript="../glibc-*/configure" |
|
|
|
if [ $stagelevel -eq 0 ] ; then |
|
|
|
pkg_glibc_headers_only=1 |
|
|
|
|
|
|
|
# NSCD Init script and config |
|
|
|
# |
|
|
|
cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/ |
|
|
|
install_init nscd $confdir/nscd.init |
|
|
|
configprefix="CC=gcc" |
|
|
|
confopt="--prefix=/$prefix --build=${CLFS_HOST} --host=${CLFS_TARGET} \ |
|
|
|
--with-headers=${CLFS}/$prefix/include --cache-file=config.cache" |
|
|
|
|
|
|
|
# Misc. stuff |
|
|
|
# |
|
|
|
if [ $stagelevel -gt 1 -a -z "$pkg_glibc_cross" ] |
|
|
|
then |
|
|
|
# install linuxthread manpages |
|
|
|
# |
|
|
|
mkdir -p $root/usr/share/man/man3 |
|
|
|
if [ -f /usr/bin/perl -a $pkg_glibc_linuxthreads = 1 ] ; then |
|
|
|
eval $MAKE -C ../linuxthreads/man \ |
|
|
|
MANDIR=$root/usr/share/man/man3 all install |
|
|
|
fi |
|
|
|
|
|
|
|
# copy linuxthreads documentation |
|
|
|
# |
|
|
|
if [ $pkg_glibc_linuxthreads = 1 ]; then |
|
|
|
cp ../linuxthreads/ChangeLog $docdir/ChangeLog.threads |
|
|
|
cp ../linuxthreads/Changes $docdir/Changes.threads |
|
|
|
cp ../linuxthreads/README $docdir/README.threads |
|
|
|
cp ../linuxthreads/FAQ.html $docdir/FAQ-threads.html |
|
|
|
cp -r ../linuxthreads/Examples $docdir/examples.threads |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
# No wrong absolute path in *.so linker scripts |
|
|
|
# |
|
|
|
if [ -d $root/ROCK/tools.cross -a -z "$pkg_glibc_cross" ]; then |
|
|
|
rm -f $root/ROCK/tools.cross/$arch_target/lib/libc.so |
|
|
|
rm -f $root/ROCK/tools.cross/$arch_target/lib/libpthread.so |
|
|
|
sed 's,/[^ ]*/,,g' $root/$prefix/lib/libc.so > $root/ROCK/tools.cross/$arch_target/lib/libc.so |
|
|
|
sed 's,/[^ ]*/,,g' $root/$prefix/lib/libpthread.so > $root/ROCK/tools.cross/$arch_target/lib/libpthread.so |
|
|
|
fi |
|
|
|
|
|
|
|
# Install ld.so.conf |
|
|
|
# |
|
|
|
if [ ! -f $root/etc/ld.so.conf -a -z "$pkg_glibc_cross" ] |
|
|
|
then |
|
|
|
{ echo "/usr/lib" ; echo "/usr/X11/lib" |
|
|
|
echo "/usr/local/lib" ; echo "/opt/*/lib" |
|
|
|
} > $root/etc/ld.so.conf |
|
|
|
makeopt="" |
|
|
|
makeinstopt="install-headers" |
|
|
|
else |
|
|
|
if [ $stagelevel -eq 1 ] ; then |
|
|
|
var_append patchfiles " " "$confdir/glibc$pkg_glibc_version/glibc-*-cross_hacks-*.patch.diff" |
|
|
|
fi |
|
|
|
|
|
|
|
# Move 'ldconfig' and 'sln' binaries |
|
|
|
# |
|
|
|
if [ -z "$pkg_glibc_cross" ] |
|
|
|
then |
|
|
|
if [ -f "$root/usr/sbin/ldconfig" ]; then |
|
|
|
mv -v $root/usr/sbin/ldconfig $root/sbin/ldconfig |
|
|
|
fi |
|
|
|
if [ -f "$root/usr/sbin/sln" ]; then |
|
|
|
mv -v $root/usr/sbin/sln $root/sbin/sln |
|
|
|
fi |
|
|
|
if [ $stagelevel -eq 1 ] ; then |
|
|
|
export CC="${CLFS_TARGET}-gcc $pkg_glibc_cc" |
|
|
|
export AR="${CLFS_TARGET}-ar" |
|
|
|
export RANLIB="${CLFS_TARGET}-ranlib" |
|
|
|
fi |
|
|
|
|
|
|
|
# Create /lib/ld-lsb.so.1 symlink |
|
|
|
# |
|
|
|
if [ -z "$pkg_glibc_cross" ] |
|
|
|
then |
|
|
|
if [ -f $root/lib/ld-linux-$arch_machine.so.2 ]; then |
|
|
|
ln -vfs ld-linux-$arch_machine.so.2 $root/lib/ld-lsb.so.1 |
|
|
|
elif [ -f $root/lib/ld-linux.so.2 ]; then |
|
|
|
ln -vfs ld-linux.so.2 $root/lib/ld-lsb.so.1 |
|
|
|
fi |
|
|
|
confopt="prefix=/$prefix --build=${CLFS_HOST} --host=$pkg_glibc_host \$extraconfopt" |
|
|
|
var_append extraconfopt " " "--disable-profile --enable-add-ons \ |
|
|
|
--with-tls --enable-kernel=2.6.0 --with-__thread --cache-file=config.cache" |
|
|
|
if [ $stagelevel -le 2 ] ; then |
|
|
|
var_append extraconfopt " " "--with-binutils=${CLFS}/$cross_tools/bin \ |
|
|
|
--with-headers=${CLFS}/$prefix/include" |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
makeopt="" |
|
|
|
makeinstopt="install" |
|
|
|
fi |
|
|
|
#--------------------------------- |
|
|
|
|
|
|
|
#--------------------------------- |
|
|
|
if [ $pkg_glibc_version = 25 -o $pkg_glibc_version = 26 ]; then |
|
|
|
|
|
|
|
glibc_custmain() { |
|
|
|
# check whether profiling is enabled |
|
|
|
if [ $ROCKCFG_PKG_GLIBC_ENABLE_PROFILE = 1 ] ; then |
|
|
|
G_PROFILE=--enable-profile |
|
|
|
else |
|
|
|
G_PROFILE=--disable-profile |
|
|
|
fi |
|
|
|
|
|
|
|
# Let's use an 'objdir' directory for building glibc |
|
|
|
mkdir -p objdir; cd objdir |
|
|
|
|
|
|
|
# NPTL doesn't work with plain i386 CPUs |
|
|
|
temp_arch_target="${arch_target/i386/i486}" |
|
|
|
temp_arch_build="${arch_build/i386/i486}" |
|
|
|
configure_without_tls="" |
|
|
|
|
|
|
|
# Disable glibc internal debuging but build debuging and profile |
|
|
|
# code so we can use this glibc to debug other programs. |
|
|
|
create_config_cache >> config.cache |
|
|
|
CFLAGS="$CFLAGS -g -DNDEBUG=1" ../configure --prefix=$root/$prefix \ |
|
|
|
--with-gnu-binutils --enable-add-ons"$ADDONS" $G_PROFILE \ |
|
|
|
--with-headers=$root/$prefix/include --with-gd=/$prefix \ |
|
|
|
--with-gd-lib=/$prefix/lib --with-gd-include=/$prefix/include \ |
|
|
|
$configure_without_tls --cache-file=config.cache \ |
|
|
|
--build=${temp_arch_build} --host=${temp_arch_target} |
|
|
|
|
|
|
|
# No wrong absolute path in *.so linker scripts |
|
|
|
# this must be called from glibc makefile right after installing usr/lib/libc.so |
|
|
|
# |
|
|
|
if [ -d $root/ROCK/tools.cross -a -z "$pkg_glibc_cross" ]; then |
|
|
|
export ROCK_FIXUP_CROSS_LIBC_SO=$builddir/fixup-cross-libc-so.sh |
|
|
|
cat << EOT > $builddir/fixup-cross-libc-so.sh |
|
|
|
if [ -f $root/$prefix/lib/libc.so ]; then |
|
|
|
echo "Fixing $root/ROCK/tools.cross/$arch_target/lib/libc.so." |
|
|
|
rm -f $root/ROCK/tools.cross/$arch_target/lib/libc.so |
|
|
|
sed 's,/[^ ]*/,,g' $root/$prefix/lib/libc.so > $root/ROCK/tools.cross/$arch_target/lib/libc.so |
|
|
|
fi |
|
|
|
if [ -f $root/$prefix/lib/libpthread.so ]; then |
|
|
|
echo "Fixing $root/ROCK/tools.cross/$arch_target/lib/libpthread.so." |
|
|
|
rm -f $root/ROCK/tools.cross/$arch_target/lib/libpthread.so |
|
|
|
sed 's,/[^ ]*/,,g' $root/$prefix/lib/libpthread.so > $root/ROCK/tools.cross/$arch_target/lib/libpthread.so |
|
|
|
fi |
|
|
|
EOT |
|
|
|
chmod +x $builddir/fixup-cross-libc-so.sh |
|
|
|
fi |
|
|
|
|
|
|
|
eval $MAKE prefix=/usr slibdir=/lib sysconfdir=/etc all |
|
|
|
eval $MAKE prefix=/$prefix slibdir=/lib \ |
|
|
|
sysconfdir=/etc install_root=$root install |
|
|
|
|
|
|
|
ln -sf libbsd-compat.a $root/$prefix/lib/libbsd.a |
|
|
|
$builddir/fixup-cross-libc-so.sh |
|
|
|
|
|
|
|
# install locales |
|
|
|
# |
|
|
|
if [ $stagelevel -gt 1 ] ; then |
|
|
|
# otherwise we risk the hosts /usr/lib/locale/locale-archive being overwritten |
|
|
|
eval $MAKE localedata/install-locales |
|
|
|
cp ../localedata/SUPPORTED $root/usr/share/i18n/ |
|
|
|
fi |
|
|
|
|
|
|
|
# copy crypt documentation |
|
|
|
# |
|
|
|
cp ../crypt/README.ufc-crypt $docdir/README.crypt |
|
|
|
if [ "$pkg_glibc_cross" ] ; then |
|
|
|
var_insert patchfiles " " "$confdir/glibc$pkg_glibc_version/glibc-*-libgcc_eh-*.patch.cross" |
|
|
|
|
|
|
|
# NSCD Init script and config |
|
|
|
# |
|
|
|
cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/ |
|
|
|
install_init nscd $confdir/nscd.init |
|
|
|
arch_target="$pkg_glibc_host" |
|
|
|
arch_machine="${arch_target##-*}" |
|
|
|
|
|
|
|
# Install ld.so.conf |
|
|
|
# |
|
|
|
if [ ! -f $root/etc/ld.so.conf ] |
|
|
|
if [ -z "$( type -p $pkg_glibc_host-gcc )" ] |
|
|
|
then |
|
|
|
{ echo "/usr/lib" ; echo "/usr/X11/lib" |
|
|
|
echo "/usr/local/lib" ; echo "/opt/*/lib" |
|
|
|
} > $root/etc/ld.so.conf |
|
|
|
fi |
|
|
|
|
|
|
|
# Move 'ldconfig' and 'sln' binaries |
|
|
|
# |
|
|
|
if [ -f "$root/usr/sbin/ldconfig" ]; then |
|
|
|
mv -v $root/usr/sbin/ldconfig $root/sbin/ldconfig |
|
|
|
fi |
|
|
|
if [ -f "$root/usr/sbin/sln" ]; then |
|
|
|
mv -v $root/usr/sbin/sln $root/sbin/sln |
|
|
|
fi |
|
|
|
|
|
|
|
# Create /lib/ld-lsb.so.1 symlink |
|
|
|
# |
|
|
|
if [ -f $root/lib/ld-linux-$arch_machine.so.2 ]; then |
|
|
|
ln -vfs ld-linux-$arch_machine.so.2 $root/lib/ld-lsb.so.1 |
|
|
|
elif [ -f $root/lib/ld-linux.so.2 ]; then |
|
|
|
ln -vfs ld-linux.so.2 $root/lib/ld-lsb.so.1 |
|
|
|
echo_status "Building only cross-headers because there is no cross-gcc (yet)." |
|
|
|
pkg_glibc_headers_only=1 |
|
|
|
makeinstopt="install-headers" |
|
|
|
else |
|
|
|
export CC=$pkg_glibc_host-gcc |
|
|
|
export AR=$pkg_glibc_host-ar |
|
|
|
export RANLIB=$pkg_glibc_host-ranlib |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
fi |
|
|
|
#--------------------------------- |
|
|
|
|
|
|
|
glibc_prepatch() { |
|
|
|
if [ $pkg_glibc_linuxthreads = 1 -a -f $archdir/*linuxthreads*.tar.bz2 ]; then |
|
|
|
tar $taropt $archdir/*linuxthreads*.tar.bz2 |
|
|
|
fi |
|
|
|
if [ "${pkg_glibc_version}" = "25" -o "${pkg_glibc_version}" = "26" ] ; then |
|
|
|
echo "extracting glibc-ports" |
|
|
|
tar $taropt $archdir/glibc-ports-*.tar.bz2 |
|
|
|
hook_add prepatch 5 "glibc_prepatch" |
|
|
|
glibc_prepatch () { |
|
|
|
echo Extracting $archdir/glibc-ports-*.tar.bz2 ... |
|
|
|
tar -xf $archdir/glibc-ports-*.tar.bz2 |
|
|
|
mv -v glibc-ports-* ports |
|
|
|
|
|
|
|
if [ $stagelevel -ge 3 ] ; then |
|
|
|
echo Extracting $archdir/glibc-libidn-*.tar.bz2 ... |
|
|
|
tar -xf $archdir/glibc-libidn-*.tar.bz2 |
|
|
|
mv -v glibc-libidn-* libidn |
|
|
|
fi |
|
|
|
} |
|
|
|
|
|
|
|
glibc_stage0() { |
|
|
|
if [ $pkg_glibc_version = 25 -o $pkg_glibc_version = 26 ] |
|
|
|
then |
|
|
|
mkdir -p objdir; cd objdir |
|
|
|
|
|
|
|
confopt="${confopt% --target=*}" |
|
|
|
custmain="glibc_custmain" |
|
|
|
glibc_custmain () { |
|
|
|
if [ $pkg_glibc_headers_only = 1 ] ; then |
|
|
|
cp configure{,.orig} |
|
|
|
sed -e 's/3.4/3.[0-9]/g' configure.orig > configure |
|
|
|
|
|
|
|
var_append confopt " " "--enable-add-ons"$ADDONS" --build=\$arch_build \ |
|
|
|
--host=\$arch_target" |
|
|
|
# more configure hacks: tls support everywhere |
|
|
|
for x in $( find .. -name configure | xargs grep libc_cv_.*_tls | \ |
|
|
|
sed -r 's,.*(libc_cv),\1,; s,(_tls).*,\1,' | sort -u; ) |
|
|
|
do eval "export $x=yes"; done |
|
|
|
|
|
|
|
# in stage 0 we do not have the cross compiler yet. |
|
|
|
# some configure checks which would fail without |
|
|
|
# a working cross compiler in stage 0.. |
|
|
|
export libc_cv_mlong_double_128=yes |
|
|
|
export libc_cv_mlong_double_128ibm=yes |
|
|
|
export libc_cv_mabi_ibmlongdouble=yes |
|
|
|
export libc_cv_ppc_machine=yes |
|
|
|
|
|
|
|
# more configure hacks: tls support everywhere |
|
|
|
for x in $( find .. -name configure | xargs grep libc_cv_.*_tls | \ |
|
|
|
sed -r 's,.*(libc_cv),\1,; s,(_tls).*,\1,' | sort -u; ) |
|
|
|
do eval "export $x=yes"; done |
|
|
|
|
|
|
|
# due to assembler check - and we do not yet have as ... |
|
|
|
if [ $arch = hppa ]; then |
|
|
|
var_append confopt " " "--enable-hacker-mode" |
|
|
|
fi |
|
|
|
|
|
|
|
eval "../configure --enable-add-ons"$ADDONS" $confopt" |
|
|
|
|
|
|
|
make -k cross-compiling=yes install-headers || true |
|
|
|
cp -v ../include/features.h $root/$prefix/include |
|
|
|
fi |
|
|
|
if [ $pkg_glibc_version = 23 ] |
|
|
|
then |
|
|
|
# .cross patches don't get applied automagically if we build a -cross- pkg |
|
|
|
# maybe add $confdir/glibc23/*.patch.${pkg_glibc_cross:0:3} to the for loop ? |
|
|
|
if [ -n "$pkg_glibc_cross" ] ; then |
|
|
|
for i in $confdir/glibc23/*.patch.cross |
|
|
|
do |
|
|
|
echo "Applying patch $i..." |
|
|
|
patch -p1 < $i ; |
|
|
|
done |
|
|
|
fi |
|
|
|
|
|
|
|
# for mips*, tries to add -mabi. for headers, we don't have a compiler allowing that yet |
|
|
|
# if cross-compiling. the values of _MIPS_SIM can be found in sysdeps/mips/sgidefs.h |
|
|
|
if [ \( $arch = mips -a $crossnative = cross \) -o -n "$pkg_glibc_cross" ] ; then |
|
|
|
patch -p1 < $confdir/glibc23/no-mabi-mips64.cross.diff |
|
|
|
mv sysdeps/mips/mips32/Makefile sysdeps/mips/mips32/Makefile-x |
|
|
|
echo "CC += -D_MIPS_SZPTR=32 -D_MIPS_SIM=1" > sysdeps/mips/mips32/Makefile |
|
|
|
mv sysdeps/mips/mips64/n32/Makefile sysdeps/mips/mips64/n32/Makefile-x |
|
|
|
echo "CC += -D_MIPS_SZPTR=64 -D_MIPS_SIM=2" > sysdeps/mips/mips64/n32/Makefile |
|
|
|
echo "long-double-fcts = yes" >> sysdeps/mips/mips64/n32/Makefile |
|
|
|
mv sysdeps/mips/mips64/n64/Makefile sysdeps/mips/mips64/n64/Makefile-x |
|
|
|
echo "CC += -D_MIPS_SZPTR=64 -D_MIPS_SIM=3" > sysdeps/mips/mips64/n64/Makefile |
|
|
|
echo "long-double-fcts = yes" >> sysdeps/mips/mips64/n64/Makefile |
|
|
|
fi |
|
|
|
|
|
|
|
mkdir -p objdir; cd objdir |
|
|
|
|
|
|
|
confopt="${confopt% --target=*}" |
|
|
|
|
|
|
|
var_append confopt " " "--enable-add-ons"$ADDONS" --build=\$arch_build \ |
|
|
|
--host=\$arch_target" |
|
|
|
mkdir -v ../objdir ; cd ../objdir |
|
|
|
|
|
|
|
# due to assembler check - and we do not yet have as ... |
|
|
|
[ $arch = hppa ] && var_append confopt " " "--enable-hacker-mode" |
|
|
|
|
|
|
|
eval "../configure --enable-add-ons"$ADDONS" $confopt" |
|
|
|
|
|
|
|
make -k cross-compiling=yes install-headers || true |
|
|
|
cp -v ../include/features.h $root/$prefix/include |
|
|
|
if [ $stagelevel -le 2 -o "$pkg_glibc_cross" ] ; then |
|
|
|
echo "libc_cv_forced_unwind=yes" > config.cache |
|
|
|
echo "libc_cv_c_cleanup=yes" >> config.cache |
|
|
|
fi |
|
|
|
if [ $pkg_glibc_version = 22 ] |
|
|
|
then |
|
|
|
eval "./configure --enable-add-ons $confopt" |
|
|
|
make cross-compiling=yes install-headers |
|
|
|
cp -v include/features.h $root/$prefix/include |
|
|
|
|
|
|
|
if [ -z "$pkg_glibc_cross" ] ; then |
|
|
|
echo "slibdir=/$multilib" >> configparms |
|
|
|
fi |
|
|
|
echo "install_root=$instroot" >> configparms |
|
|
|
|
|
|
|
mkdir -p $root/$prefix/include/gnu |
|
|
|
touch $root/$prefix/include/gnu/stubs.h |
|
|
|
cp -v bits/stdio_lim.h $root/$prefix/include/bits |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
patchfiles="`ls $confdir/glibc$pkg_glibc_version/*.patch \ |
|
|
|
$confdir/glibc$pkg_glibc_version/*.patch.$arch 2>/dev/null | tr '\n' ' '` $patchfiles" |
|
|
|
|
|
|
|
if [ $pkg_glibc_linuxthreads = 1 ]; then |
|
|
|
patchfiles="`ls $confdir/glibc$pkg_glibc_version/*.patch-linuxthreads | tr '\n' ' '` $patchfiles" |
|
|
|
fi |
|
|
|
|
|
|
|
if [ $stagelevel -le 1 ]; then |
|
|
|
patchfiles="`ls $patchfiles $confdir/glibc$pkg_glibc_version/*.patch.cross \ |
|
|
|
$confdir/glibc$pkg_glibc_version/*.patch.cross.$arch 2>/dev/null | tr '\n' ' '`" |
|
|
|
fi |
|
|
|
eval_config_command $( eval echo $confopt ) |
|
|
|
|
|
|
|
if [ $pkg_glibc_headers_only = 0 ] ; then |
|
|
|
eval $MAKE $makeopt |
|
|
|
fi |
|
|
|
|
|
|
|
if [ $pkg_glibc_version = 22 ] ; then |
|
|
|
# auto-detect for the old glibc |
|
|
|
ADDONS="" |
|
|
|
else |
|
|
|
# new glibc is using NPTL per default, set to linuxthreads if needed |
|
|
|
if [ $pkg_glibc_linuxthreads = 1 ]; then |
|
|
|
ADDONS="=linuxthreads" |
|
|
|
else |
|
|
|
ADDONS="" |
|
|
|
if [ $stagelevel -eq 3 ] ; then |
|
|
|
make -k check 2>&1 | tee glibc-check-log |
|
|
|
grep Error glibc-check-log || true |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
eval $MAKE $makeinstopt |
|
|
|
|
|
|
|
threadsver="$ver" |
|
|
|
prepatch="glibc_prepatch" |
|
|
|
if [ $pkg_glibc_headers_only = 1 ] ; then |
|
|
|
mkdir -p $root/$prefix/include/bits |
|
|
|
cp -v bits/stdio_lim.h ${CLFS}/$prefix/include/bits/ |
|
|
|
mkdir -p $root/$prefix/include/gnu |
|
|
|
touch ${CLFS}/$prefix/include/gnu/stubs.h |
|
|
|
|
|
|
|
if [ -z "$pkg_glibc_cross" ] |
|
|
|
then |
|
|
|
if [ $stagelevel -eq 0 ] |
|
|
|
then |
|
|
|
custmain="glibc_stage0" |
|
|
|
else |
|
|
|
custmain="glibc_custmain" |
|
|
|
fi |
|
|
|
else |
|
|
|
if [ $pkg_glibc_version = 22 ]; then |
|
|
|
echo_error "Cross-packages are not supported for glibc22!" |
|
|
|
exit 1 |
|
|
|
case "$arch" in |
|
|
|
x86) |
|
|
|
if [ "$ROCKCFG_X86_BITS" = 64 ] ; then |
|
|
|
pkg_glibc_arch=x86_64 |
|
|
|
else |
|
|
|
pkg_glibc_arch=i386 |
|
|
|
fi ;; |
|
|
|
*) pkg_glibc_arch="$arch" ;; |
|
|
|
esac |
|
|
|
if [ -e ../glibc-*/nptl/sysdeps/unix/sysv/linux/$arch/bits/pthreadtypes.h ] |
|
|
|
then |
|
|
|
cp -v ../glibc-*/nptl/sysdeps/unix/sysv/linux/$arch/bits/pthreadtypes.h \ |
|
|
|
${CLFS}/$prefix/include/bits |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
arch_target="$pkg_glibc_target" |
|
|
|
arch_machine="${arch_target/-*/}" |
|
|
|
prefix="$prefix/$pkg_glibc_target" |
|
|
|
set_confopt |
|
|
|
if [[ $stagelevel -ge 1 && -z "$pkg_glibc_cross" && "$xpkg" != *-32bit ]] ; then |
|
|
|
# make localedata/install-locales |
|
|
|
|
|
|
|
if [ -z "$( type -p $pkg_glibc_target-gcc )" ] |
|
|
|
then |
|
|
|
echo_status "Building only cross-headers because there is no cross-gcc (yet)." |
|
|
|
custmain="glibc_stage0" |
|
|
|
else |
|
|
|
export CC=$pkg_glibc_target-gcc |
|
|
|
export AS=$pkg_glibc_target-as |
|
|
|
export LD=$pkg_glibc_target-ld |
|
|
|
export AR=$pkg_glibc_target-ar |
|
|
|
export NM=$pkg_glibc_target-nm |
|
|
|
export GASP=$pkg_glibc_target-gasp |
|
|
|
export STRIP=$pkg_glibc_target-strip |
|
|
|
export RANLIB=$pkg_glibc_target-ranlib |
|
|
|
export CFLAGS="-O2" |
|
|
|
custmain="glibc_custmain" |
|
|
|
mkdir -pv ${CLFS}/usr/lib/locale |
|
|
|
export I18NPATH=${PWD}/localedata |
|
|
|
export GCONV_PATH=${PWD}/iconvdata |
|
|
|
if [ $stagelevel -eq 1 ] ; then |
|
|
|
LOCALEDEF=localedef-native |
|
|
|
else |
|
|
|
LOCALEDEF=localedef |
|
|
|
fi |
|
|
|
export LOCALEDEF="${PWD}/locale/$LOCALEDEF |
|
|
|
--alias-file=../intl/locale.alias" |
|
|
|
|
|
|
|
cd ../glibc-*/localedata |
|
|
|
${LOCALEDEF} -i locales/de_DE -f charmaps/ISO-8859-1 --prefix=${CLFS} de_DE |
|
|
|
${LOCALEDEF} -i locales/de_DE@euro -f charmaps/ISO-8859-15 \ |
|
|
|
--prefix=${CLFS} de_DE@euro |
|
|
|
${LOCALEDEF} -i locales/en_HK -f charmaps/ISO-8859-1 --prefix=${CLFS} en_HK |
|
|
|
${LOCALEDEF} -i locales/en_PH -f charmaps/ISO-8859-1 --prefix=${CLFS} en_PH |
|
|
|
${LOCALEDEF} -i locales/en_US -f charmaps/ISO-8859-1 --prefix=${CLFS} en_US |
|
|
|
${LOCALEDEF} -i locales/es_MX -f charmaps/ISO-8859-1 --prefix=${CLFS} es_MX |
|
|
|
${LOCALEDEF} -i locales/fa_IR -f charmaps/UTF-8 --prefix=${CLFS} fa_IR |
|
|
|
${LOCALEDEF} -i locales/fr_FR -f charmaps/ISO-8859-1 --prefix=${CLFS} fr_FR |
|
|
|
${LOCALEDEF} -i locales/fr_FR@euro -f charmaps/ISO-8859-15 \ |
|
|
|
--prefix=${CLFS} fr_FR@euro |
|
|
|
${LOCALEDEF} -i locales/it_IT -f charmaps/ISO-8859-1 --prefix=${CLFS} it_IT |
|
|
|
${LOCALEDEF} -i locales/ja_JP -f charmaps/EUC-JP --prefix=${CLFS} ja_JP |
|
|
|
unset I18NPATH GCONV_PATH LOCALEDEF |
|
|
|
|
|
|
|
cp -av $confdir/{ld.so,nsswitch}.conf $sysconfdir/ |
|
|
|
|
|
|
|
cp -v --remove-destination $datadir/zoneinfo/Factory \ |
|
|
|
$sysconfdir/localtime |
|
|
|
fi |
|
|
|
|
|
|
|
if [[ "$xpkg" = *-32bit ]] ; then |
|
|
|
# -32bit and -64bit differ by these files, in addition to lib and lib64 dirs; |
|
|
|
# -32bit installs: |
|
|
|
# usr/bin/lddlibc4 |
|
|
|
# libexec/getconf/POSIX_V6_ILP32_OFF32 |
|
|
|
# libexec/getconf/POSIX_V6_ILP32_OFFBIG |
|
|
|
# include/gnu/stubs-32.h |
|
|
|
# include/sys/vm86.h |
|
|
|
# -64bit installs: |
|
|
|
# include/gnu/stubs-64.h |
|
|
|
cp -av $dummydir/lib/* $root/$multilib/ |
|
|
|
cp -av $dummydir/usr/lib/* $root/usr/$multilib/ |
|
|
|
cp -av $bindir/lddlibc4 $root/usr/bin/ |
|
|
|
mkdir -vp $root/usr/include/{gnu,sys} |
|
|
|
cp -av $includedir/gnu/stubs-32.h $root/usr/include/gnu/ |
|
|
|
cp -av $includedir/sys/vm86.h $root/usr/include/sys/ |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
if [ $stagelevel -eq 1 -a -f $confdir/glibc$pkg_glibc_version/no_path_in_glibcso.diff ] |
|
|
|
then |
|
|
|
var_append patchfiles " " $confdir/glibc$pkg_glibc_version/no_path_in_glibcso.diff |
|
|
|
fi |
|
|
|
|
|
|
|
} |