1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/glibc/glibc.conf
3 # Copyright (C) 2004 - 2021 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=$sysroot/usr --enable-hacker-mode \
17 --with-headers=$sysroot/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*'
26 [ $arch = "riscv" ] &&
27 var_append CPPFLAGS " " "-D__riscv_xlen=32 -D__riscv_flen=64" ||
28 var_append CPPFLAGS " " "-D__riscv_xlen=64 -D__riscv_flen=64"
29 var_append CPPFLAGS " " "-D__riscv_float_abi_double=1 -D__riscv_atomic=1"
31 var_append SYSGCC_WRAPPER_INSERT " " "$CPPFLAGS"
35 var_append confopt " " "--with-headers=$root/usr/include"
38 var_append confopt ' ' "--disable-multi-arch"
39 var_append confopt " " "--enable-kernel=2.6.32"
41 if [ $SDECFG_SOFTFLOAT -eq 1 ]; then
42 # Disable hardware floating point and use software floating point
43 var_append confopt ' ' '--without-fp'
45 var_append confopt ' ' '--with-fp'
48 # use at least "-O" when build without optimisation for debugging ...
49 var_remove GCC_WRAPPER_INSERT ' ' '-O0'
50 var_insert GCC_WRAPPER_INSERT ' ' '-O'
51 var_remove SYSGCC_WRAPPER_INSERT ' ' '-O0'
53 # hwcap broken w/o x86-64-v2
54 [[ "$arch" = x86* ]] && export libc_cv_include_x86_isa_level=no
56 # use $arch_target to also match glibc32 on x32
57 [[ "$arch_target" = i*86-* ]] && GCC_WRAPPER_INSERT="${GCC_WRAPPER_INSERT/-Os/-O2}"
60 var_remove GCC_WRAPPER_APPEND ' ' '-s'
61 var_append GCC_WRAPPER_APPEND ' ' '-fno-builtin-strlen'
63 # On Mips64 and ARM the following fails unless we build with: -fgnu89-inline
64 # "sysdeps/ieee754/dbl-64/s_copysign.c:27: error: redefinition of '__copysign'"
66 arm|mips*) var_insert GCC_WRAPPER_INSERT ' ' '-fgnu89-inline' ;;
69 # glibc does not like -ffast-math
70 var_remove GCC_WRAPPER_APPEND ' ' '-ffast-math'
71 var_remove GCC_WRAPPER_INSERT ' ' '-ffast-math'
73 # We must use an 'objdir' directory for building glibc
74 # Disable glibc internal debuging but build debuging and profile
75 # code so we can use this glibc to debug other programs.
77 var_append confopt " " "--with-gnu-binutils --build=${arch_build} --host=${arch_target}"
79 # toolchain needs some guidance when we do not yet have a compiler
80 if atstage toolchain; then
81 # t2 only auto adds it in the cross stage
82 var_append confopt ' ' "--cache-file=config.cache"
84 hook_add preconf 3 "echo 'libc_cv_forced_unwind=yes
86 libc_cv_gcc_exceptions=yes
89 libc_cv_asm_cfi_directive_sections=yes
90 ac_cv_header_cpuid_h=yes
91 libc_cv_mlong_double_128=yes
92 libc_cv_mlong_double_128ibm=yes # ppc
94 libc_cv_ppc_machine=yes
96 libc_cv_z_relro=yes # sparc64
97 libc_mips_float=hard # $SDECFG_SOFTFLOAT
98 libc_cv_no_gnu_attr_ok=yes # powerpc64le
99 libc_cv_target_power8_ok=yes # powerpc64le
100 libc_cv_gcc_builtin_tbegin=yes # s390
104 if ! atstage native; then
105 var_append confopt " " "--without-gd"
106 elif pkginstalled libgd; then
107 var_append confopt " " "--with-gd=/usr --with-gd-lib=/usr/lib --with-gd-include=/usr/include"
110 # build and install the obsolete RPC code
111 var_append extraconfopt " " "--enable-obsolete-rpc"
113 # control whether to include profiling support
114 if [ $SDECFG_PKG_GLIBC_ENABLE_PROFILE = 1 ]; then
115 var_append extraconfopt " " "--enable-profile"
117 var_append extraconfopt " " "--disable-profile"
120 var_remove_regex makeopt " " "prefix=.*"
121 var_remove_regex makeinstopt " " "prefix=.*"
122 var_append makeopt " " "slibdir=/\$slibdir"
123 var_append makeinstopt " " "slibdir=/\$slibdir install_root=\$root PERL=no"
126 for tarball in `match_source_file -p ports` \
127 `match_source_file -p linuxthread`
131 # rename without surrounding glibc-*-version
132 tarball=${tarball##*/}; tarball=${tarball#*-}; tarball=${tarball%%-*}
133 mv glibc-${tarball}-* ${tarball}
135 # remove CVS from the newly extracted files, glibc tries to
136 # automatically commit newly generated files :-!
137 find $tarball -name CVS | xargs rm -rfv
140 mkdir -p $root$includedir/gnu/
142 if [ $pkg == glibc ]; then
143 # touch is not enough to add it, "echo -n "" >>" neither?
144 addStub() { for f; do dd if=/dev/null of="$f" count=0; done }
145 addStub $root$includedir/gnu/stubs.h
146 if [ $slibdir != lib ]; then
147 addStub $root$includedir/gnu/stubs{,-32,-64}.h
148 addStub $root$includedir/gnu/stubs-o32_hard.h
149 if [ "$SDECFG_MIPS64_N32" = 1 ]; then
150 addStub $root$includedir/gnu/stubs-{n32,n64}_hard.h
158 if atstage toolchain; then
159 cp -v ../include/features.h $root$includedir
160 mkdir -p $includedir/{bits,gnu}
161 [ -e $root$includedir/bits/stdio_lim.h ] ||
162 touch $root$includedir/bits/stdio_lim.h
168 cp ../localedata/SUPPORTED $root/usr/share/i18n/
169 # at least prepare the locale dir
170 mkdir -p $root$libdir/locale
171 #eval $MAKE localedata/install-locales
172 cp ../crypt/README.ufc-crypt $root$docdir/README.crypt
174 # NSCD Init script and config
176 cp $base/package/*/glibc/{nscd,nsswitch}.conf $root/etc/
180 if [ "$SDECFG_MULTILIB" = 1 -a $slibdir != lib ]; then
181 cat > $root/etc/ld.so.conf <<-EOT
194 cat > $root/etc/ld.so.conf <<-EOT
203 # Move 'ldconfig' and 'sln' binaries
205 if [ -f "$root/usr/sbin/ldconfig" ]; then
206 mv -v $root/usr/sbin/ldconfig $root/sbin/ldconfig
208 if [ -f "$root/usr/sbin/sln" ]; then
209 mv -v $root/usr/sbin/sln $root/sbin/sln
212 # Create /lib/ld-lsb.so.1 symlink
214 if [ -f $root$slibdir/ld-linux-$arch_machine.so.2 ]; then
215 ln -vfs ld-linux-$arch_machine.so.2 $root$slibdir/ld-lsb.so.1
216 elif [ -f $root$slibdir/ld-linux.so.2 ]; then
217 ln -vfs ld-linux.so.2 $root$slibdir/ld-lsb.so.1
221 # in stage 0 we only extract the headers and all is a bit easier ...
222 if atstage toolchain; then
224 makeinstopt="-k cross-compiling=yes install-headers"
227 [[ $libdir == *lib ]] && slibdir=lib || slibdir="${libdir##*/}"
229 if atstage cross; then
230 # hotfix gclibc-2.24 <stdin>:1:19: fatal error: cstdlib: No such file or directory
234 hook_add prepatch 3 "glibc_prepatch"
235 hook_add postmake 5 "glibc_postmake"