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.

275 lines
7.4 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 - 2012 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. # use at least "-O" when build without optimisation for debugging ...
  34. var_insert GCC_WRAPPER_INSERT " " "-O"
  35. # glibc does not like -ffast-math
  36. var_insert GCC_WRAPPER_REMOVE " " "-ffast-math"
  37. var_append confopt " " "--enable-kernel=2.6.18"
  38. # Disable glibc internal debuging but build debuging and profile
  39. # code so we can use this glibc to debug other programs.
  40. pkg_glibc_preconf(){
  41. configprefix='CFLAGS="$CFLAGS -g -DNDEBUG=1"'
  42. configscript="../configure"
  43. }
  44. hook_add preconf 3 "pkg_glibc_preconf"
  45. # We have to use an 'objdir' directory for building glibc and make its
  46. # name unique by appending $arch_target to distinguish while building
  47. # a multilib capable glibc using buildloops.
  48. pkg_glibc_objdir(){
  49. mkdir -p "objdir-$arch_target"
  50. cd "objdir-$arch_target"
  51. }
  52. hook_add preconf 9 "pkg_glibc_objdir"
  53. var_append confopt " " "--with-gnu-binutils --build=${arch_build} --host=${arch_target}"
  54. if pkginstalled libgd; then
  55. var_append confopt " " "--with-gd=/usr --with-gd-lib=/usr/lib --with-gd-include=/usr/include"
  56. fi
  57. # --enable-add-ons expects a comma seperated list of add-ons
  58. glibc_addons="ports"
  59. # ckeck whether to enable nptl if supported by the architecture
  60. if [ $SDECFG_PKG_GLIBC_TLS = 1 ]; then
  61. var_append glibc_addons "," "nptl"
  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. glibc_prepatch() {
  98. local tarball= tarname=
  99. local addon= addons="ports"
  100. ##[ "$SDECFG_PKG_GLIBC_TLS" = 1 ] || var_append addons ' ' 'linuxthreads'
  101. for addon in $addons; do
  102. tarball=$( match_source_file -p $addon )
  103. tarname=${tarball##*/}; tarname=${tarname%.tar.*}
  104. # extract each addon into the definitive folder
  105. mkdir -pv $addon
  106. ln -sv $addon $tarname
  107. tar -v --dereference ${taropt} $tarball
  108. rm $tarname
  109. done
  110. mkdir -p $root$includedir/gnu/
  111. if [ $pkg == glibc ]; then
  112. touch $root$includedir/gnu/stubs.h
  113. if [ $slibdir = lib64 ]; then
  114. touch $root$includedir/gnu/stubs{-32,-64}.h
  115. fi
  116. fi
  117. }
  118. glibc_postmake()
  119. {
  120. if atstage toolchain; then
  121. cp -v ../include/features.h $root$includedir
  122. mkdir -p $root$includedir/{bits,gnu}
  123. [ -e $root$includedir/bits/stdio_lim.h ] ||
  124. touch $root$includedir/bits/stdio_lim.h
  125. return
  126. fi
  127. ln -sf libbsd-compat.a $root/usr/$slibdir/libbsd.a
  128. # Misc. stuff
  129. #
  130. if atstage native; then
  131. # install locales
  132. #
  133. eval $MAKE localedata/install-locales
  134. cp ../localedata/SUPPORTED $root/usr/share/i18n/
  135. if [ "$SDECFG_PKG_GLIBC_TLS" != 1 ]; then
  136. # install linuxthread manpages
  137. #
  138. mkdir -p $root/usr/share/man/man3
  139. if [ -f /usr/bin/perl ]; then
  140. eval $MAKE -C ../linuxthreads/man \
  141. MANDIR=$root/usr/share/man/man3 all install
  142. fi
  143. # copy linuxthreads documentation
  144. #
  145. for x in ChangeLog Changes README FAQ.html Examples; do
  146. cp -a ../linuxthreads/$x \
  147. $docdir/$x.threads
  148. done
  149. fi
  150. # copy crypt documentation
  151. #
  152. cp ../crypt/README.ufc-crypt $docdir/README.crypt
  153. # NSCD Init script and config
  154. #
  155. cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/
  156. fi
  157. # Install ld.so.conf
  158. #
  159. # TODO
  160. # We should migrate to a more modular approach here, moving to package
  161. # based configuration in '/etc/ld.so.conf.d/$pkg.conf' and including all
  162. # dedicated conf files in a generic main 'ld.so.conf' like this:
  163. #
  164. # include /etc/ld.so.conf.d/*.conf
  165. #
  166. case $arch_machine in
  167. powerpc64|sparc64|x86_64|mips64)
  168. cat > $root/etc/ld.so.conf <<-EOT
  169. /lib64
  170. /lib
  171. /usr/lib64
  172. /usr/lib
  173. /usr/lib64/*/
  174. /usr/lib/*/
  175. /usr/*/lib64
  176. /usr/*/lib
  177. /opt/*/lib64
  178. /opt/*/lib
  179. /usr/local/lib64
  180. /usr/local/lib
  181. EOT
  182. if [ "$SDECFG_MULTILIB" == 1 ] ; then
  183. cat >> $root/etc/ld.so.conf <<-EOT
  184. /lib32
  185. /usr/lib32
  186. /usr/lib32/*/
  187. /usr/*/lib32
  188. /opt/*/lib32
  189. /usr/local/lib32
  190. EOT
  191. fi
  192. ;;
  193. *) cat > $root/etc/ld.so.conf <<-EOT
  194. /lib
  195. /usr/lib
  196. /usr/lib/*/
  197. /usr/*/lib
  198. /opt/*/lib
  199. /usr/local/lib
  200. EOT
  201. ;;
  202. esac
  203. # Move 'ldconfig' and 'sln' binaries
  204. #
  205. if [ -f "$root/usr/sbin/ldconfig" ] ; then
  206. mv -v $root/usr/sbin/ldconfig $root/sbin/ldconfig
  207. fi
  208. if [ -f "$root/usr/sbin/sln" ] ; then
  209. mv -v $root/usr/sbin/sln $root/sbin/sln
  210. fi
  211. # Create /lib/ld-lsb.so.1 symlink
  212. #
  213. if [ -f $root/$slibdir/ld-linux-$arch_machine.so.2 ] ; then
  214. ln -vfs ld-linux-$arch_machine.so.2 $root/$slibdir/ld-lsb.so.1
  215. elif [ -f $root/$slibdir/ld-linux.so.2 ] ; then
  216. ln -vfs ld-linux.so.2 $root/$slibdir/ld-lsb.so.1
  217. fi
  218. }
  219. # in stage 0 we only extract the headers and all is a bit easier ...
  220. if atstage toolchain; then
  221. makeopt=
  222. makeinstopt="-k cross-compiling=yes install-headers"
  223. fi
  224. [[ $libdir = *lib64 ]] && slibdir=lib64 || slibdir=lib
  225. #if atstage cross; then
  226. # var_append patchfiles " " $confdir/no_path_in_glibcso.diff
  227. #fi
  228. hook_add prepatch 3 "glibc_prepatch"
  229. hook_add postmake 5 "glibc_postmake"
  230. # workaround for failing builds when building for i686 cpu family
  231. case $arch_machine in
  232. i686) var_append extraconfopt ' ' "--disable-multi-arch" ;;
  233. esac