1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: architecture/sparc/package/*/glibc.conf
3 # Copyright (C) 2004 - 2022 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License version 2.
10 # --- T2-COPYRIGHT-NOTE-END ---
12 # overwrite prefix to not point to the tools, but the real root for the headers
13 if atstage toolchain; then
14 # hack due to sane variable not available and prefix is tools prefix
16 confopt="--prefix=$base/build/$SDECFG_ID/usr \
17 --with-headers=$base/build/$SDECFG_ID/usr/include \$extraconfopt"
18 includedir="/../../usr/include"
20 # MIPS injects -mabi - the host CC does not know about it for header gen
21 var_append SYSCC_WRAPPER_REMOVE ' ' '-mabi*'
22 var_append SYSCPP_WRAPPER_REMOVE ' ' '-mabi*'
24 var_append confopt " " "--with-headers=$root/usr/include"
27 var_append confopt ' ' "--disable-multi-arch"
28 var_append confopt " " "--enable-kernel=2.6.16"
30 if [ $SDECFG_SOFTFLOAT -eq 1 ]; then
31 # Disable hardware floating point and use software floating point
32 var_append confopt ' ' '--without-fp'
34 var_append confopt ' ' '--with-fp'
37 # use at least "-O" when build without optimisation for debugging ...
38 var_remove GCC_WRAPPER_INSERT ' ' '-O0'
39 var_insert GCC_WRAPPER_INSERT ' ' '-O'
40 var_remove SYSGCC_WRAPPER_INSERT ' ' '-O0'
43 var_remove GCC_WRAPPER_APPEND ' ' '-s'
44 var_append GCC_WRAPPER_APPEND ' ' '-fno-builtin-strlen'
47 # On Mips64 and ARM the following fails unless we build with: -fgnu89-inline
48 # "sysdeps/ieee754/dbl-64/s_copysign.c:27: error: redefinition of '__copysign'"
50 arm|mips*) var_insert GCC_WRAPPER_INSERT ' ' '-fgnu89-inline' ;;
53 # glibc does not like -ffast-math
54 var_remove GCC_WRAPPER_APPEND ' ' '-ffast-math'
55 var_remove GCC_WRAPPER_INSERT ' ' '-ffast-math'
57 # We must use an 'objdir' directory for building glibc
58 # Disable glibc internal debuging but build debuging and profile
59 # code so we can use this glibc to debug other programs.
61 configprefix='CFLAGS="$CFLAGS -g -DNDEBUG=1"'
63 var_append confopt " " "--with-gnu-binutils --build=${arch_build} --host=${arch_target}"
65 # toolchain needs some guidance when we do not yet have a compiler
66 if atstage toolchain; then
67 # t2 only auto adds it in the cross stage
68 var_append confopt ' ' "--cache-file=./config.cache"
70 hook_add preconf 3 "echo 'libc_cv_forced_unwind=yes
72 libc_cv_gcc_exceptions=yes
75 libc_cv_asm_cfi_directive_sections=yes
76 ac_cv_header_cpuid_h=yes
77 libc_cv_mlong_double_128=yes
78 libc_cv_mlong_double_128ibm=yes # ppc
80 libc_cv_ppc_machine=yes
81 libc_cv_z_relro=yes # sparc64
82 #libc_mips_abi=soft # mips
83 libc_mips_float=hard # $SDECFG_SOFTFLOAT
87 if ! atstage native; then
88 var_append confopt " " "--without-gd"
89 elif pkginstalled libgd; then
90 var_append confopt " " "--with-gd=/usr --with-gd-lib=/usr/lib --with-gd-include=/usr/include"
93 var_append extraconfopt " " "--with-tls --with-__thread" #,libidn
95 # build and install the obsolete RPC code
96 var_append extraconfopt " " "--enable-obsolete-rpc"
100 # control whether to include profiling support
101 if [ $SDECFG_PKG_GLIBC_ENABLE_PROFILE = 1 ] ; then
102 var_append extraconfopt " " "--enable-profile"
104 var_append extraconfopt " " "--disable-profile"
107 var_remove_regex makeopt " " "prefix=.*"
108 var_remove_regex makeinstopt " " "prefix=.*"
109 var_append makeopt " " "slibdir=/\$slibdir"
110 var_append makeinstopt " " "slibdir=/\$slibdir install_root=\$root"
113 for tarball in `match_source_file -p ports` \
114 `match_source_file -p linuxthread`
118 # rename without surrounding glibc-*-version
119 tarball=${tarball##*/}; tarball=${tarball#*-}; tarball=${tarball%%-*}
120 mv glibc-${tarball}-* ${tarball}
122 # remove CVS from the newly extracted files, glibc tries to
123 # automatically commit newly generated files :-!
124 find $tarball -name CVS | xargs rm -rfv
127 mkdir -p $root$includedir/gnu/
129 if [ $pkg == glibc ]; then
130 # touch is not enough to add it, "echo -n "" >>" neither
131 addStub() { for f; do dd if=/dev/null of="$f" count=0; done }
132 addStub $root$includedir/gnu/stubs.h
133 if [ $slibdir != lib ]; then
134 addStub $root$includedir/gnu/stubs{,-32,-64}.h
141 if atstage toolchain; then
142 cp -v ../include/features.h $root$includedir
143 mkdir -p $includedir/{bits,gnu}
144 [ -e $root$includedir/bits/stdio_lim.h ] ||
145 touch $root$includedir/bits/stdio_lim.h
149 ln -sf libbsd-compat.a $root/usr/$slibdir/libbsd.a
153 if atstage native; then
154 # install locales and linuxthread manpages
155 eval $MAKE localedata/install-locales
156 cp ../localedata/SUPPORTED $root/usr/share/i18n/
158 if [ $SDECFG_PKG_GLIBC_TLS != 1 ]; then
159 mkdir -p $root/usr/share/man/man3
160 if [ -f /usr/bin/perl ] ; then
161 eval $MAKE -C ../linuxthreads/man \
162 MANDIR=$root/usr/share/man/man3 all install
165 # copy linuxthreads and crypt documentation
166 cp ../linuxthreads/ChangeLog $docdir/ChangeLog.threads
167 cp ../linuxthreads/Changes $docdir/Changes.threads
168 cp ../linuxthreads/README $docdir/README.threads
169 cp ../linuxthreads/FAQ.html $docdir/FAQ-threads.html
170 cp -r ../linuxthreads/Examples $docdir/examples.threads
173 # at least prepare the locale dir
174 mkdir -p $root$libdir/locale
176 cp ../crypt/README.ufc-crypt $root$docdir/README.crypt
178 # NSCD Init script and config
180 cp $base/package/*/glibc/{nscd,nsswitch}.conf $root/etc/
184 if [ $slibdir != lib ] ; then
185 cat > $root/etc/ld.so.conf <<-EOT
198 cat > $root/etc/ld.so.conf <<-EOT
207 # Move 'ldconfig' and 'sln' binaries
209 if [ -f "$root/usr/sbin/ldconfig" ] ; then
210 mv -v $root/usr/sbin/ldconfig $root/sbin/ldconfig
212 if [ -f "$root/usr/sbin/sln" ] ; then
213 mv -v $root/usr/sbin/sln $root/sbin/sln
216 # Create /lib/ld-lsb.so.1 symlink
218 if [ -f $root/$slibdir/ld-linux-$arch_machine.so.2 ] ; then
219 ln -vfs ld-linux-$arch_machine.so.2 $root/$slibdir/ld-lsb.so.1
220 elif [ -f $root/$slibdir/ld-linux.so.2 ] ; then
221 ln -vfs ld-linux.so.2 $root/$slibdir/ld-lsb.so.1
225 # in stage 0 we only extract the headers and all is a bit easier ...
226 if atstage toolchain; then
228 makeinstopt="-k cross-compiling=yes install-headers"
231 [[ $libdir == *lib ]] && slibdir=lib || slibdir="${libdir##*/}"
233 #if atstage cross; then
234 # var_append patchfiles " " $confdir/no_path_in_glibcso.diff
237 hook_add prepatch 3 "glibc_prepatch"
238 hook_add postmake 5 "glibc_postmake"