mirror of the now-defunct rocklinux.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

359 lines
11 KiB

# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/base/glibc/glibc.conf
# ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. A copy of the GNU General Public
# License can be found at Documentation/COPYING.
#
# Many people helped and are helping developing ROCK Linux. Please
# have a look at http://www.rocklinux.org/ and the Documentation/TEAM
# file for details.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
pkg_glibc_version=${xpkg#glibc}
pkg_glibc_target=${arch_target}
pkg_glibc_cross=""
case "$xpkg" in
glibc??-cross-*)
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."
;;
glibc??)
;;
*)
echo_error "Not supported $pkg package name: $xpkg"
exit 1
;;
esac
#---------------------------------
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
eval $MAKE install-locales -C localedata
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
}
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
# 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 --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 \
--without-tls --build=${arch_build} --host=${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
# Misc. stuff
#
if [ $stagelevel -gt 1 -a -z "$pkg_glibc_cross" ]
then
# install locales and linuxthread manpages
#
eval $MAKE localedata/install-locales
cp ../localedata/SUPPORTED $root/usr/share/i18n/
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
# 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
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
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
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
fi
}
fi
#---------------------------------
glibc_prepatch() {
if [ -f $archdir/*linuxthreads*.tar.bz2 ]; then
tar $taropt $archdir/*linuxthreads*.tar.bz2
fi
}
glibc_stage0() {
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"
# 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
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
fi
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 [ $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
if [ $pkg_glibc_version = 22 ] ; then
# auto-detect for the old glibc
ADDONS=""
else
# prevent the utilisation of nptl (...) - and enable it later
# if a 2.5/6 kernel is used
ADDONS="=linuxthreads"
fi
threadsver="$ver"
prepatch="glibc_prepatch"
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
fi
arch_target="$pkg_glibc_target"
arch_machine="${arch_target/-*/}"
prefix="$prefix/$pkg_glibc_target"
set_confopt
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"
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
[ $stagelevel -ne 1 ] && var_remove patchfiles "$confdir/glibc$pkg_glibc_version/gcc_eh.patch.cross"
[ -n "$pkg_glibc_cross" ] && var_append patchfiles " " "$confdir/glibc$pkg_glibc_version/gcc_eh.patch.cross"