1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by scripts/Create-CopyPatch.
4 # T2 SDE: architecture/sparc/package/*/glibc.conf
5 # Copyright (C) 2004 - 2021 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; version 2 of the License. A copy of the
12 # GNU General Public License can be found in the file COPYING.
13 # --- T2-COPYRIGHT-NOTE-END ---
15 # overwrite prefix to not point to the tools, but the real root for the headers
16 if atstage toolchain; then
17 # hack due to sane variable not available and prefix is tools prefix
19 confopt="--prefix=$base/build/$SDECFG_ID/usr \
20 --with-headers=$base/build/$SDECFG_ID/usr/include \$extraconfopt"
21 includedir="/../../usr/include"
23 # MIPS injects -mabi - the host CC does not know about it for header gen
24 var_append SYSCC_WRAPPER_REMOVE ' ' '-mabi*'
25 var_append SYSCPP_WRAPPER_REMOVE ' ' '-mabi*'
27 var_append confopt " " "--with-headers=$root/usr/include"
30 var_append confopt ' ' "--disable-multi-arch"
31 var_append confopt " " "--enable-kernel=2.6.16"
33 if [ $SDECFG_SOFTFLOAT -eq 1 ]; then
34 # Disable hardware floating point and use software floating point
35 var_append confopt ' ' '--without-fp'
37 var_append confopt ' ' '--with-fp'
40 # use at least "-O" when build without optimisation for debugging ...
41 var_remove GCC_WRAPPER_INSERT ' ' '-O0'
42 var_insert GCC_WRAPPER_INSERT ' ' '-O'
43 var_remove SYSGCC_WRAPPER_INSERT ' ' '-O0'
46 var_remove GCC_WRAPPER_APPEND ' ' '-s'
47 var_append GCC_WRAPPER_APPEND ' ' '-fno-builtin-strlen'
50 # On Mips64 and ARM the following fails unless we build with: -fgnu89-inline
51 # "sysdeps/ieee754/dbl-64/s_copysign.c:27: error: redefinition of '__copysign'"
53 arm|mips*) var_insert GCC_WRAPPER_INSERT ' ' '-fgnu89-inline' ;;
56 # glibc does not like -ffast-math
57 var_remove GCC_WRAPPER_APPEND ' ' '-ffast-math'
58 var_remove GCC_WRAPPER_INSERT ' ' '-ffast-math'
60 # We must use an 'objdir' directory for building glibc
61 # Disable glibc internal debuging but build debuging and profile
62 # code so we can use this glibc to debug other programs.
64 hook_add preconf 3 "mkdir -p objdir; cd objdir"
65 configprefix='CFLAGS="$CFLAGS -g -DNDEBUG=1"'
66 configscript="../configure"
68 var_append confopt " " "--with-gnu-binutils --build=${arch_build} --host=${arch_target}"
70 # toolchain needs some guidance when we do not yet have a compiler
71 if atstage toolchain; then
72 # t2 only auto adds it in the cross stage
73 var_append confopt ' ' "--cache-file=./config.cache"
75 hook_add preconf 3 "echo 'libc_cv_forced_unwind=yes
77 libc_cv_gcc_exceptions=yes
80 libc_cv_asm_cfi_directive_sections=yes
81 ac_cv_header_cpuid_h=yes
82 libc_cv_mlong_double_128=yes
83 libc_cv_mlong_double_128ibm=yes # ppc
85 libc_cv_ppc_machine=yes
86 libc_cv_z_relro=yes # sparc64
87 #libc_mips_abi=soft # mips
88 libc_mips_float=hard # $SDECFG_SOFTFLOAT
92 if ! atstage native; then
93 var_append confopt " " "--without-gd"
94 elif pkginstalled libgd; then
95 var_append confopt " " "--with-gd=/usr --with-gd-lib=/usr/lib --with-gd-include=/usr/include"
98 var_append extraconfopt " " "--with-tls --with-__thread" #,libidn
100 # build and install the obsolete RPC code
101 var_append extraconfopt " " "--enable-obsolete-rpc"
105 # control whether to include profiling support
106 if [ $SDECFG_PKG_GLIBC_ENABLE_PROFILE = 1 ] ; then
107 var_append extraconfopt " " "--enable-profile"
109 var_append extraconfopt " " "--disable-profile"
112 var_remove_regex makeopt " " "prefix=.*"
113 var_remove_regex makeinstopt " " "prefix=.*"
114 var_append makeopt " " "slibdir=/\$slibdir"
115 var_append makeinstopt " " "slibdir=/\$slibdir install_root=\$root"
118 for tarball in `match_source_file -p ports` \
119 `match_source_file -p linuxthread`
123 # rename without surrounding glibc-*-version
124 tarball=${tarball##*/}; tarball=${tarball#*-}; tarball=${tarball%%-*}
125 mv glibc-${tarball}-* ${tarball}
127 # remove CVS from the newly extracted files, glibc tries to
128 # automatically commit newly generated files :-!
129 find $tarball -name CVS | xargs rm -rfv
132 mkdir -p $root$includedir/gnu/
134 if [ $pkg == glibc ]; then
135 # touch is not enough to add it, "echo -n "" >>" neither
136 addStub() { for f; do dd if=/dev/null of="$f" count=0; done }
137 addStub $root$includedir/gnu/stubs.h
138 if [ $slibdir != lib ]; then
139 addStub $root$includedir/gnu/stubs{,-32,-64}.h
146 if atstage toolchain; then
147 cp -v ../include/features.h $root$includedir
148 mkdir -p $includedir/{bits,gnu}
149 [ -e $root$includedir/bits/stdio_lim.h ] ||
150 touch $root$includedir/bits/stdio_lim.h
154 ln -sf libbsd-compat.a $root/usr/$slibdir/libbsd.a
158 if atstage native; then
159 # install locales and linuxthread manpages
160 eval $MAKE localedata/install-locales
161 cp ../localedata/SUPPORTED $root/usr/share/i18n/
163 if [ $SDECFG_PKG_GLIBC_TLS != 1 ]; then
164 mkdir -p $root/usr/share/man/man3
165 if [ -f /usr/bin/perl ] ; then
166 eval $MAKE -C ../linuxthreads/man \
167 MANDIR=$root/usr/share/man/man3 all install
170 # copy linuxthreads and crypt documentation
171 cp ../linuxthreads/ChangeLog $docdir/ChangeLog.threads
172 cp ../linuxthreads/Changes $docdir/Changes.threads
173 cp ../linuxthreads/README $docdir/README.threads
174 cp ../linuxthreads/FAQ.html $docdir/FAQ-threads.html
175 cp -r ../linuxthreads/Examples $docdir/examples.threads
178 # at least prepare the locale dir
179 mkdir -p $root$libdir/locale
181 cp ../crypt/README.ufc-crypt $root$docdir/README.crypt
183 # NSCD Init script and config
185 cp $confdir/{nscd,nsswitch}.conf $root/etc/
189 if [ $slibdir != lib ] ; then
190 cat > $root/etc/ld.so.conf <<-EOT
203 cat > $root/etc/ld.so.conf <<-EOT
212 # Move 'ldconfig' and 'sln' binaries
214 if [ -f "$root/usr/sbin/ldconfig" ] ; then
215 mv -v $root/usr/sbin/ldconfig $root/sbin/ldconfig
217 if [ -f "$root/usr/sbin/sln" ] ; then
218 mv -v $root/usr/sbin/sln $root/sbin/sln
221 # Create /lib/ld-lsb.so.1 symlink
223 if [ -f $root/$slibdir/ld-linux-$arch_machine.so.2 ] ; then
224 ln -vfs ld-linux-$arch_machine.so.2 $root/$slibdir/ld-lsb.so.1
225 elif [ -f $root/$slibdir/ld-linux.so.2 ] ; then
226 ln -vfs ld-linux.so.2 $root/$slibdir/ld-lsb.so.1
230 # in stage 0 we only extract the headers and all is a bit easier ...
231 if atstage toolchain; then
233 makeinstopt="-k cross-compiling=yes install-headers"
236 [[ $libdir == *lib ]] && slibdir=lib || slibdir="${libdir##*/}"
238 #if atstage cross; then
239 # var_append patchfiles " " $confdir/no_path_in_glibcso.diff
242 hook_add prepatch 3 "glibc_prepatch"
243 hook_add postmake 5 "glibc_postmake"