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.
328 lines
9.1 KiB
328 lines
9.1 KiB
# --- SDE-COPYRIGHT-NOTE-BEGIN --- |
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
# |
|
# Filename: package/.../glibc/glibc.conf |
|
# Copyright (C) 2006 - 2012 The OpenSDE Project |
|
# Copyright (C) 2004 - 2006 The T2 SDE Project |
|
# |
|
# More information can be found in the files COPYING and README. |
|
# |
|
# 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; version 2 of the License. A copy of the |
|
# GNU General Public License can be found in the file COPYING. |
|
# --- SDE-COPYRIGHT-NOTE-END --- |
|
|
|
# copy/create some needed header files |
|
pkg_glibc_postmake_headers() { |
|
mkdir -p $includedir/{bits,gnu} |
|
cp -v ../include/features.h $root$includedir |
|
[ -e $root$includedir/bits/stdio_lim.h ] || |
|
touch $root$includedir/bits/stdio_lim.h |
|
[ -e $root$includedir/gnu/stubs.h ] || |
|
touch $root$includedir/gnu/stubs.h |
|
|
|
# on multilib enabled builds create a stubs header file for each ABI |
|
# TODO |
|
# check if that approach is the right one or if we only have to |
|
# create an empty stubs header for each additional ABI besides |
|
# the default ABI |
|
if [ "$SDECFG_MULTILIB" == 1 ] ; then |
|
for x in $arch_abis; do |
|
[ -e $root$includedir/gnu/stubs-$x.h ] || |
|
touch $root$includedir/gnu/stubs-$x.h |
|
done |
|
fi |
|
} |
|
|
|
# overwrite prefix to not point to the tools, but the real root for the headers |
|
if atstage toolchain; then |
|
# hack due to sane variable not available and prefix is tools prefix |
|
# -ReneR |
|
confopt="--prefix=$base/build/$SDECFG_ID/usr \ |
|
--with-headers=$base/build/$SDECFG_ID/usr/include \$extraconfopt" |
|
includedir="/../../usr/include" |
|
|
|
# MIPS injects -mabi - the host CC does not know about it for header gen |
|
var_append SYSCC_WRAPPER_REMOVE ' ' '-mabi*' |
|
var_append SYSCPP_WRAPPER_REMOVE ' ' '-mabi*' |
|
|
|
# if $HOSTCC is a gcc < 4.3 we need 'cpuid.h' |
|
if ! $HOSTCC -dumpversion | grep -q '^4\.[345]' ; then |
|
echo_warning "Old gcc detected: Working around cpuid.h support" |
|
var_append SYSCC_WRAPPER_APPEND ' ' "-I$confdir/include-old-gcc" |
|
fi |
|
|
|
hook_add postmake 5 'pkg_glibc_postmake_headers' |
|
else |
|
var_append extraconfopt " " "--with-headers=$root/usr/include" |
|
|
|
if [ "$SDECFG_MULTILIB" == 1 ] ; then |
|
# set the ABI for each buildloop |
|
hook_add preconf 3 'multilib_abi_loop $buildloop' |
|
else |
|
abi="$SDECFG_ABI_DEFAULT" |
|
fi |
|
|
|
if ! [ $buildloop -eq $buildloops ]; then |
|
# as long as we did not reached the last loop we have to chdir |
|
# back to the top-level source directory before we enter the |
|
# next loop. |
|
hook_add postmake 9 'cd .. ; pwd' |
|
fi |
|
|
|
# set slibdir according to the ABI we build |
|
hook_add preconf 4 'pkg_glibc_abi_preconf $abi' |
|
fi |
|
|
|
# function to set slibdir depending on the ABI given as argument |
|
pkg_glibc_abi_preconf() { |
|
slibdir="lib$1" |
|
|
|
# architecture specific compiler flags for 32bit ABIs |
|
if [ "$1" = "32" ]; then |
|
case "$arch" in |
|
x86-64) |
|
var_append CC_WRAPPER_INSERT ' ' "-march=$( cut -d- -f1 <<< $arch_target )" |
|
var_append CXX_WRAPPER_INSERT ' ' "-march=$( cut -d- -f1 <<< $arch_target )" |
|
;; |
|
esac |
|
fi |
|
|
|
# applies to all additional ABIs while building multilib |
|
if [ $buildloop -ge 2 ]; then |
|
# only install libraries and no programs |
|
hook_add premake 5 "echo 'build-programs=no' > configparms" |
|
var_remove makeinstopt ' ' 'install' |
|
var_append makeinstopt ' ' 'install-lib-all' |
|
# filter out some unwanted header files |
|
var_append INSTALL_WRAPPER_FILTER "|" \ |
|
"sed -e 's,.*usr/include/.*\.h,/tmp/removed.h,'" |
|
else |
|
# only run postmake while building the default ABI |
|
if atstage native; then |
|
hook_add postmake 5 'pkg_glibc_postmake' |
|
fi |
|
fi |
|
} |
|
|
|
# use at least "-O" when build without optimisation for debugging ... |
|
var_insert GCC_WRAPPER_INSERT " " "-O" |
|
# glibc does not like -ffast-math |
|
var_insert GCC_WRAPPER_REMOVE " " "-ffast-math" |
|
|
|
var_append extraconfopt " " "--enable-kernel=2.6.18" |
|
|
|
# Disable glibc internal debuging but build debuging and profile |
|
# code so we can use this glibc to debug other programs. |
|
pkg_glibc_preconf(){ |
|
configprefix='CFLAGS="$CFLAGS -g -DNDEBUG=1"' |
|
configscript="../configure" |
|
|
|
# workaround for failing builds when building for i686 cpu family |
|
case $arch_machine in |
|
i686) var_append extraconfopt ' ' "--disable-multi-arch" ;; |
|
esac |
|
} |
|
hook_add preconf 3 "pkg_glibc_preconf" |
|
|
|
# We have to use an 'objdir' directory for building glibc and make its |
|
# name unique by appending $arch_target to distinguish while building |
|
# a multilib capable glibc using buildloops. |
|
pkg_glibc_objdir(){ |
|
mkdir -p "objdir-$abi" |
|
cd "objdir-$abi" |
|
} |
|
hook_add preconf 9 "pkg_glibc_objdir" |
|
|
|
var_append extraconfopt " " "--with-gnu-binutils --build=${arch_build} --host=${arch_target}" |
|
|
|
if pkginstalled libgd; then |
|
var_append extraconfopt " " "--with-gd=/usr --with-gd-lib=/usr/lib --with-gd-include=/usr/include" |
|
fi |
|
|
|
# --enable-add-ons expects a comma seperated list of add-ons |
|
glibc_addons="ports" |
|
|
|
# ckeck whether to enable nptl if supported by the architecture |
|
if [ $SDECFG_PKG_GLIBC_TLS = 1 ]; then |
|
var_append glibc_addons "," "nptl" |
|
var_append extraconfopt " " "--with-tls" |
|
var_append extraconfopt " " "--with-__thread" |
|
|
|
# cross-compile help |
|
if ! atstage native; then |
|
var_append configcache ' ' "libc_cv_forced_unwind=yes" |
|
var_append configcache ' ' "libc_cv_c_cleanup=yes" |
|
fi |
|
|
|
# help building/installing correct glibc headers at toolchain stage |
|
if atstage toolchain; then |
|
case "$arch" in |
|
x86) var_append configcache ' ' "libc_cv_386_tls=yes" ;; |
|
esac |
|
fi |
|
else |
|
var_append glibc_addons "," "linuxthreads" |
|
var_append extraconfopt " " "--without-__thread" |
|
var_append extraconfopt " " "--disable-sanity-checks" |
|
|
|
[[ $arch = mips* ]] && \ |
|
var_append extraconfopt " " "--without-tls" |
|
fi |
|
|
|
# ckeck whether to enable libidn support |
|
if [ $SDECFG_PKG_GLIBC_LIBIDN = 1 ]; then |
|
var_append glibc_addons "," "libidn" |
|
fi |
|
|
|
var_append extraconfopt " " "--enable-add-ons=$glibc_addons" |
|
|
|
# control whether to include profiling support |
|
if [ $SDECFG_PKG_GLIBC_ENABLE_PROFILE = 1 ] ; then |
|
var_append extraconfopt " " "--enable-profile" |
|
else |
|
var_append extraconfopt " " "--disable-profile" |
|
fi |
|
|
|
var_append makeopt " " "slibdir=/\$slibdir" |
|
var_append makeinstopt " " "slibdir=/\$slibdir install_root=\$root" |
|
|
|
glibc_prepatch() { |
|
local tarball= tarname= |
|
local addon= addons="ports" |
|
|
|
##[ "$SDECFG_PKG_GLIBC_TLS" = 1 ] || var_append addons ' ' 'linuxthreads' |
|
|
|
for addon in $addons; do |
|
tarball=$( match_source_file -p $addon ) |
|
tarname=${tarball##*/}; tarname=${tarname%.tar.*} |
|
|
|
# extract each addon into the definitive folder |
|
mkdir -pv $addon |
|
ln -sv $addon $tarname |
|
tar -v --dereference ${taropt} $tarball |
|
rm $tarname |
|
done |
|
} |
|
|
|
pkg_glibc_postmake() |
|
{ |
|
ln -sf libbsd-compat.a $root/usr/$slibdir/libbsd.a |
|
|
|
# Misc. stuff |
|
# |
|
if atstage native; then |
|
|
|
# install locales when building the default ABI or create |
|
# a symlink for the other selected ABIs |
|
if [ "$abi" == "$SDECFG_ABI_DEFAULT" ]; then |
|
eval $MAKE localedata/install-locales |
|
cp ../localedata/SUPPORTED $root/usr/share/i18n/ |
|
else |
|
ln -sf ../lib/locale $root$libdir/locale |
|
fi |
|
|
|
if [ "$SDECFG_PKG_GLIBC_TLS" != 1 ]; then |
|
# install linuxthread manpages |
|
# |
|
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 documentation |
|
# |
|
for x in ChangeLog Changes README FAQ.html Examples; do |
|
cp -a ../linuxthreads/$x \ |
|
$docdir/$x.threads |
|
done |
|
fi |
|
|
|
# copy crypt documentation |
|
# |
|
cp ../crypt/README.ufc-crypt $docdir/README.crypt |
|
|
|
# NSCD Init script and config |
|
# |
|
cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/ |
|
fi |
|
|
|
# Install ld.so.conf |
|
# |
|
# TODO |
|
# We should migrate to a more modular approach here, moving to package |
|
# based configuration in '/etc/ld.so.conf.d/$pkg.conf' and including all |
|
# dedicated conf files in a generic main 'ld.so.conf' like this: |
|
# |
|
# include /etc/ld.so.conf.d/*.conf |
|
# |
|
case $arch_machine in |
|
powerpc64|sparc64|x86_64|mips64) |
|
cat > $root/etc/ld.so.conf <<-EOT |
|
/lib64 |
|
/lib |
|
/usr/lib64 |
|
/usr/lib |
|
/usr/lib64/*/ |
|
/usr/lib/*/ |
|
/usr/*/lib64 |
|
/usr/*/lib |
|
/opt/*/lib64 |
|
/opt/*/lib |
|
/usr/local/lib64 |
|
/usr/local/lib |
|
EOT |
|
if [ "$SDECFG_MULTILIB" == 1 ] ; then |
|
cat >> $root/etc/ld.so.conf <<-EOT |
|
/lib32 |
|
/usr/lib32 |
|
/usr/lib32/*/ |
|
/usr/*/lib32 |
|
/opt/*/lib32 |
|
/usr/local/lib32 |
|
EOT |
|
fi |
|
;; |
|
*) cat > $root/etc/ld.so.conf <<-EOT |
|
/lib |
|
/usr/lib |
|
/usr/lib/*/ |
|
/usr/*/lib |
|
/opt/*/lib |
|
/usr/local/lib |
|
EOT |
|
;; |
|
esac |
|
|
|
# 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/$slibdir/ld-linux-$arch_machine.so.2 ] ; then |
|
ln -vfs ld-linux-$arch_machine.so.2 $root/$slibdir/ld-lsb.so.1 |
|
elif [ -f $root/$slibdir/ld-linux.so.2 ] ; then |
|
ln -vfs ld-linux.so.2 $root/$slibdir/ld-lsb.so.1 |
|
fi |
|
} |
|
|
|
# in stage 0 we only extract the headers and all is a bit easier ... |
|
if atstage toolchain; then |
|
makeopt= |
|
makeinstopt="-k cross-compiling=yes install-headers" |
|
fi |
|
|
|
#if atstage cross; then |
|
# var_append patchfiles " " $confdir/no_path_in_glibcso.diff |
|
#fi |
|
|
|
hook_add prepatch 3 "glibc_prepatch" |
|
|
|
|