OpenSDE Packages Database (without history before r20070)
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.

265 lines
7.3 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../glibc/glibc.conf
  5. # Copyright (C) 2006 - 2016 The OpenSDE Project
  6. # Copyright (C) 2004 - 2006 The T2 SDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-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
  18. # -ReneR
  19. confopt="--prefix=$base/build/$SDECFG_ID/usr \
  20. --with-headers=$base/build/$SDECFG_ID/usr/include \$extraconfopt"
  21. includedir="/../../usr/include"
  22. # MIPS injects -mabi - the host CC does not know about it for header gen
  23. var_append SYSCC_WRAPPER_REMOVE ' ' '-mabi*'
  24. var_append SYSCPP_WRAPPER_REMOVE ' ' '-mabi*'
  25. # if $HOSTCC is a gcc < 4.3 we need 'cpuid.h'
  26. if ! $HOSTCC -dumpversion | grep -q '^4\.[3-7]' ; then
  27. echo_warning "Old gcc detected: Working around cpuid.h support"
  28. var_append SYSCC_WRAPPER_APPEND ' ' "-I$confdir/include-old-gcc"
  29. fi
  30. else
  31. var_append confopt " " "--with-headers=$root/usr/include"
  32. fi
  33. # glibc does not like -ffast-math
  34. var_insert GCC_WRAPPER_REMOVE " " "-ffast-math"
  35. var_append confopt " " "--enable-kernel=2.6.32"
  36. # Disable glibc internal debuging but build debuging and profile
  37. # code so we can use this glibc to debug other programs.
  38. pkg_glibc_preconf() {
  39. configprefix='CFLAGS="$CFLAGS -g -DNDEBUG=1 -O2"'
  40. configscript="../configure"
  41. }
  42. hook_add preconf 3 "pkg_glibc_preconf"
  43. # We have to use an 'objdir' directory for building glibc and make its
  44. # name unique by appending $arch_target to distinguish while building
  45. # a multilib capable glibc using buildloops.
  46. pkg_glibc_objdir() {
  47. mkdir -p "objdir-$arch_target"
  48. cd "objdir-$arch_target"
  49. }
  50. hook_add preconf 9 "pkg_glibc_objdir"
  51. var_append confopt " " "--with-gnu-binutils --build=${arch_build} --host=${arch_target}"
  52. if pkginstalled libgd; then
  53. var_append confopt " " "--with-gd=/usr --with-gd-lib=/usr/lib --with-gd-include=/usr/include"
  54. fi
  55. # --enable-add-ons expects a comma seperated list of add-ons
  56. glibc_addons=""
  57. # enable some generic options
  58. var_append extraconfopt " " "--enable-bind-now"
  59. var_append extraconfopt " " "--enable-stackguard-randomization"
  60. var_append extraconfopt " " "--enable-lock-elision=yes"
  61. if [ $SDECFG_PKG_GLIBC_TLS = 1 ]; then
  62. var_append extraconfopt " " "--with-tls"
  63. var_append extraconfopt " " "--with-__thread"
  64. # cross-compile help
  65. if ! atstage native; then
  66. var_append configcache ' ' "libc_cv_forced_unwind=yes"
  67. var_append configcache ' ' "libc_cv_c_cleanup=yes"
  68. fi
  69. # help building/installing correct glibc headers at toolchain stage
  70. if atstage toolchain; then
  71. case "$arch" in
  72. x86) var_append configcache ' ' "libc_cv_386_tls=yes" ;;
  73. esac
  74. fi
  75. else
  76. var_append glibc_addons "," "linuxthreads"
  77. var_append extraconfopt " " "--without-__thread"
  78. var_append extraconfopt " " "--disable-sanity-checks"
  79. [[ $arch = mips* ]] && \
  80. var_append extraconfopt " " "--without-tls"
  81. fi
  82. # ckeck whether to enable libidn support
  83. if [ $SDECFG_PKG_GLIBC_LIBIDN = 1 ]; then
  84. var_append glibc_addons "," "libidn"
  85. fi
  86. var_append extraconfopt " " "--enable-add-ons=$glibc_addons"
  87. # build and install the obsolete RPC code for link-time usage
  88. var_append extraconfopt " " "--enable-obsolete-rpc"
  89. # control whether to include profiling support
  90. if [ $SDECFG_PKG_GLIBC_ENABLE_PROFILE = 1 ] ; then
  91. var_append extraconfopt " " "--enable-profile"
  92. else
  93. var_append extraconfopt " " "--disable-profile"
  94. fi
  95. var_append makeopt " " "slibdir=/\$slibdir"
  96. var_append makeinstopt " " "slibdir=/\$slibdir install_root=\$root"
  97. var_remove_regex makeopt " " "prefix=.*"
  98. var_remove_regex makeinstopt " " "prefix=.*"
  99. glibc_install_locales() {
  100. # install locales but not bulk please!
  101. #
  102. mkdir -pv $root$libdir/locale
  103. cp $confdir/locale.gen.txt $root$sysconfdir/locale.gen
  104. cp $confdir/locale-gen $root$bindir/locale-gen
  105. chmod +x $root$bindir/locale-gen
  106. sed -e '1,3d' -e 's|/| |g' -e 's|\\| |g' -e 's|^|#|g' \
  107. ../localedata/SUPPORTED >> $root$sysconfdir/locale.gen
  108. echo_status "Building locales"
  109. /bin/sh $root$bindir/locale-gen
  110. }
  111. glibc_prepatch() {
  112. mkdir -p $root$includedir/gnu/
  113. if [ $pkg == glibc ]; then
  114. touch $root$includedir/gnu/stubs.h
  115. if [ $slibdir = lib64 ]; then
  116. touch $root$includedir/gnu/stubs{-32,-64}.h
  117. fi
  118. fi
  119. }
  120. glibc_postmake() {
  121. if atstage toolchain; then
  122. cp -v ../include/features.h $root$includedir
  123. mkdir -p $root$includedir/{bits,gnu}
  124. [ -e $root$includedir/bits/stdio_lim.h ] ||
  125. touch $root$includedir/bits/stdio_lim.h
  126. return
  127. fi
  128. # Misc. stuff
  129. #
  130. if atstage native; then
  131. glibc_install_locales
  132. if [ "$SDECFG_PKG_GLIBC_TLS" != 1 ]; then
  133. # install linuxthread manpages
  134. #
  135. mkdir -p $root/usr/share/man/man3
  136. if [ -f /usr/bin/perl ]; then
  137. eval $MAKE -C ../linuxthreads/man \
  138. MANDIR=$root/usr/share/man/man3 all install
  139. fi
  140. # copy linuxthreads documentation
  141. #
  142. for x in ChangeLog Changes README FAQ.html Examples; do
  143. cp -a ../linuxthreads/$x \
  144. $docdir/$x.threads
  145. done
  146. fi
  147. # copy crypt documentation
  148. #
  149. cp ../crypt/README.ufc-crypt $docdir/README.crypt
  150. # NSCD Init script and config
  151. #
  152. cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/
  153. fi
  154. # Install ld.so.conf
  155. #
  156. # TODO
  157. # We should migrate to a more modular approach here, moving to package
  158. # based configuration in '/etc/ld.so.conf.d/$pkg.conf' and including all
  159. # dedicated conf files in a generic main 'ld.so.conf' like this:
  160. #
  161. # include /etc/ld.so.conf.d/*.conf
  162. #
  163. case $arch_machine in
  164. powerpc64|sparc64|x86_64|mips64)
  165. cat > $root/etc/ld.so.conf <<-EOT
  166. /lib64
  167. /lib
  168. /usr/lib64
  169. /usr/lib
  170. /usr/lib64/*/
  171. /usr/lib/*/
  172. /usr/*/lib64
  173. /usr/*/lib
  174. /opt/*/lib64
  175. /opt/*/lib
  176. /usr/local/lib64
  177. /usr/local/lib
  178. EOT
  179. if [ "$SDECFG_MULTILIB" == 1 ] ; then
  180. cat >> $root/etc/ld.so.conf <<-EOT
  181. /lib32
  182. /usr/lib32
  183. /usr/lib32/*/
  184. /usr/*/lib32
  185. /opt/*/lib32
  186. /usr/local/lib32
  187. EOT
  188. fi
  189. ;;
  190. *) cat > $root/etc/ld.so.conf <<-EOT
  191. /lib
  192. /usr/lib
  193. /usr/lib/*/
  194. /usr/*/lib
  195. /opt/*/lib
  196. /usr/local/lib
  197. EOT
  198. ;;
  199. esac
  200. # Move 'ldconfig' and 'sln' binaries
  201. #
  202. if [ -f "$root/usr/sbin/ldconfig" ] ; then
  203. mv -v $root/usr/sbin/ldconfig $root/sbin/ldconfig
  204. fi
  205. if [ -f "$root/usr/sbin/sln" ] ; then
  206. mv -v $root/usr/sbin/sln $root/sbin/sln
  207. fi
  208. # Create /lib/ld-lsb.so.1 symlink
  209. #
  210. if [ -f $root/$slibdir/ld-linux-$arch_machine.so.2 ] ; then
  211. ln -vfs ld-linux-$arch_machine.so.2 $root/$slibdir/ld-lsb.so.1
  212. elif [ -f $root/$slibdir/ld-linux.so.2 ] ; then
  213. ln -vfs ld-linux.so.2 $root/$slibdir/ld-lsb.so.1
  214. fi
  215. }
  216. # in stage 0 we only extract the headers and all is a bit easier ...
  217. if atstage toolchain; then
  218. makeopt=
  219. makeinstopt="-k cross-compiling=yes install-headers"
  220. fi
  221. [[ $libdir = *lib64 ]] && slibdir=lib64 || slibdir=lib
  222. hook_add prepatch 3 "glibc_prepatch"
  223. hook_add postmake 5 "glibc_postmake"
  224. # workaround for failing builds when building for i686 cpu family
  225. case $arch_machine in
  226. i686) var_append extraconfopt ' ' "--disable-multi-arch" ;;
  227. esac