mirror of the now-defunct rocklinux.org
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.

405 lines
12 KiB

  1. # --- ROCK-COPYRIGHT-NOTE-BEGIN ---
  2. #
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. # Please add additional copyright information _after_ the line containing
  5. # the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
  6. # the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
  7. #
  8. # ROCK Linux: rock-src/package/base/glibc/glibc.conf
  9. # ROCK Linux is Copyright (C) 1998 - 2006 Clifford Wolf
  10. #
  11. # This program is free software; you can redistribute it and/or modify
  12. # it under the terms of the GNU General Public License as published by
  13. # the Free Software Foundation; either version 2 of the License, or
  14. # (at your option) any later version. A copy of the GNU General Public
  15. # License can be found at Documentation/COPYING.
  16. #
  17. # Many people helped and are helping developing ROCK Linux. Please
  18. # have a look at http://www.rocklinux.org/ and the Documentation/TEAM
  19. # file for details.
  20. #
  21. # --- ROCK-COPYRIGHT-NOTE-END ---
  22. pkg_glibc_version=${xpkg#glibc}
  23. pkg_glibc_target=${arch_target}
  24. pkg_glibc_cross=""
  25. case "$xpkg" in
  26. glibc??-cross-*)
  27. pkg_glibc_cross="${xpkg#glibc*-cross-}"
  28. pkg_glibc_version=${pkg_glibc_version%-cross-*}
  29. pkg_glibc_target="${pkg_glibc_cross}-unknown-linux-gnu"
  30. echo_status "Preparing to build a cross-glibc package for $pkg_glibc_cross."
  31. ;;
  32. glibc??)
  33. ;;
  34. *)
  35. echo_error "Not supported $pkg package name: $xpkg"
  36. exit 1
  37. ;;
  38. esac
  39. pkg_glibc_linuxthreads=1
  40. [ "$ROCKCFG_PKG_GLIBC23_LINUXTHREADS" = "0" ] && pkg_glibc_linuxthreads=0
  41. # fall back to linuxthreads for cross glibcs
  42. [ -n "$pkg_glibc_cross" ] && pkg_glibc_linuxthreads=1
  43. # Give a more descriptive error message than the one that would happen during the build.
  44. kernel_mainline="`uname -r | cut -f-2 -d'.'`"
  45. if [ $pkg_glibc_linuxthreads = 0 -a "$kernel_mainline" != "2.6" ] ; then
  46. echo_error 'You are running a kernel of the $kernel_mainline series.'
  47. echo_error 'Glibc with NPTL support cannot be built on $kernel_mainline kernels.'
  48. echo_error 'Boot a 2.6 kernel to build Glibc with NPTL support or build Glibc'
  49. echo_error 'with old threading support (linuxthreads) instead.'
  50. abort
  51. fi
  52. #---------------------------------
  53. if [ $pkg_glibc_version = 22 ]; then
  54. glibc_custmain() {
  55. cat > configparms <<- EOF
  56. prefix = /usr
  57. slibdir = /lib
  58. sysconfdir = /etc
  59. install_root = $root
  60. CC = $CC
  61. BUILD_CC = $BUILDCC
  62. AR = $AR
  63. RANLIB = $RANLIB
  64. EOF
  65. # Disable glibc internal debuging but build debuging and profile
  66. # code so we can use this glibc to debug other programs.
  67. CFLAGS="$CFLAGS -g -DNDEBUG=1" ./configure --with-gnu-binutils \
  68. --enable-add-ons --enable-profile \
  69. --with-headers=$root/usr/include \
  70. --with-gd=/usr \
  71. --with-gd-lib=/usr/lib \
  72. --with-gd-include=/usr/include \
  73. --build=${arch_build} ${arch_target}
  74. echo $BUILDCC elf/sln.c -o elf/dyn_sln
  75. $BUILDCC elf/sln.c -o elf/dyn_sln
  76. eval $MAKE symbolic-link-prog=elf/dyn_sln all install
  77. # Misc. stuff
  78. #
  79. if [ "$crossnative" = native ] ; then
  80. [ $stagelevel -gt 1 ] && eval $MAKE install-locales -C localedata
  81. # otherwise we risk the hosts /usr/lib/locale/locale-archive being overwritten
  82. mkdir -p $root/usr/share/man/man3
  83. if [ -f /usr/bin/perl ] ; then
  84. eval $MAKE -C linuxthreads/man \
  85. MANDIR=$root/usr/share/man/man3 all install
  86. fi
  87. fi
  88. ln -sf libbsd-compat.a $root/usr/lib/libbsd.a
  89. # copy linuxthreads and crypt documentation
  90. #
  91. cp linuxthreads/ChangeLog $docdir/ChangeLog.threads
  92. cp linuxthreads/Changes $docdir/Changes.threads
  93. cp linuxthreads/README $docdir/README.threads
  94. cp linuxthreads/FAQ.html $docdir/FAQ-threads.html
  95. cp -r linuxthreads/Examples $docdir/examples.threads
  96. cp crypt/README.ufc-crypt $docdir/README.crypt
  97. # NSCD Init script and config
  98. #
  99. cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/
  100. install_init nscd $confdir/nscd.init
  101. # No absolute path in libc.so if cross-compileing
  102. #
  103. if [ $crossnative = cross ] ; then
  104. libcso=$root/usr/lib/libc.so
  105. for x in 1 2 3 4 5 ; do
  106. sed -i 's,/[a-z/]*/,,' $libcso
  107. done
  108. fi
  109. # Install ld.so.conf
  110. #
  111. {
  112. echo "/usr/lib"
  113. echo "/usr/X11/lib"
  114. echo "/usr/local/lib"
  115. echo "/opt/*/lib"
  116. } > $root/etc/ld.so.conf
  117. if [ -f $root/usr/sbin/ldconfig ] ; then
  118. ln -sf ../usr/sbin/ldconfig $root/sbin/
  119. fi
  120. }
  121. fi
  122. #---------------------------------
  123. #---------------------------------
  124. if [ $pkg_glibc_version = 23 ]; then
  125. glibc_custmain() {
  126. # check whether profiling is enabled
  127. if [ $ROCKCFG_PKG_GLIBC_ENABLE_PROFILE = 1 ] ; then
  128. G_PROFILE=--enable-profile
  129. else
  130. G_PROFILE=--disable-profile
  131. fi
  132. # Let's use an 'objdir' directory for building glibc
  133. mkdir -p objdir; cd objdir
  134. # NPTL doesn't work with plain i386 CPUs
  135. if [ $pkg_glibc_linuxthreads = 1 ]; then
  136. temp_arch_target="$arch_target"
  137. temp_arch_build="$arch_build"
  138. configure_without_tls="--without-tls"
  139. else
  140. temp_arch_target="${arch_target/i386/i486}"
  141. temp_arch_build="${arch_build/i386/i486}"
  142. configure_without_tls=""
  143. fi
  144. # Disable glibc internal debuging but build debuging and profile
  145. # code so we can use this glibc to debug other programs.
  146. create_config_cache >> config.cache
  147. CFLAGS="$CFLAGS -g -DNDEBUG=1" ../configure --prefix=$root/$prefix \
  148. --with-gnu-binutils --enable-add-ons"$ADDONS" $G_PROFILE \
  149. --with-headers=$root/$prefix/include --with-gd=/$prefix \
  150. --with-gd-lib=/$prefix/lib --with-gd-include=/$prefix/include \
  151. $configure_without_tls --cache-file=config.cache \
  152. --build=${temp_arch_build} --host=${temp_arch_target}
  153. eval $MAKE prefix=/usr slibdir=/lib sysconfdir=/etc all
  154. if [ -z "$pkg_glibc_cross" ]
  155. then
  156. eval $MAKE prefix=/$prefix slibdir=/lib \
  157. sysconfdir=/etc install_root=$root install
  158. else
  159. eval $MAKE prefix=/$prefix install_root=$root install
  160. fi
  161. ln -sf libbsd-compat.a $root/$prefix/lib/libbsd.a
  162. # install locales
  163. #
  164. if [ $stagelevel -gt 1 ] ; then
  165. # otherwise we risk the hosts /usr/lib/locale/locale-archive being overwritten
  166. eval $MAKE localedata/install-locales
  167. cp ../localedata/SUPPORTED $root/usr/share/i18n/
  168. fi
  169. # copy crypt documentation
  170. #
  171. cp ../crypt/README.ufc-crypt $docdir/README.crypt
  172. # NSCD Init script and config
  173. #
  174. cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/
  175. install_init nscd $confdir/nscd.init
  176. # Misc. stuff
  177. #
  178. if [ $stagelevel -gt 1 -a -z "$pkg_glibc_cross" ]
  179. then
  180. # install linuxthread manpages
  181. #
  182. mkdir -p $root/usr/share/man/man3
  183. if [ -f /usr/bin/perl -a $pkg_glibc_linuxthreads = 1 ] ; then
  184. eval $MAKE -C ../linuxthreads/man \
  185. MANDIR=$root/usr/share/man/man3 all install
  186. fi
  187. # copy linuxthreads documentation
  188. #
  189. if [ $pkg_glibc_linuxthreads = 1 ]; then
  190. cp ../linuxthreads/ChangeLog $docdir/ChangeLog.threads
  191. cp ../linuxthreads/Changes $docdir/Changes.threads
  192. cp ../linuxthreads/README $docdir/README.threads
  193. cp ../linuxthreads/FAQ.html $docdir/FAQ-threads.html
  194. cp -r ../linuxthreads/Examples $docdir/examples.threads
  195. fi
  196. fi
  197. # No wrong absolute path in *.so linker scripts
  198. #
  199. if [ -d $root/ROCK/tools.cross -a -z "$pkg_glibc_cross" ]; then
  200. rm -f $root/ROCK/tools.cross/$arch_target/lib/libc.so
  201. rm -f $root/ROCK/tools.cross/$arch_target/lib/libpthread.so
  202. sed 's,/[^ ]*/,,g' $root/$prefix/lib/libc.so > $root/ROCK/tools.cross/$arch_target/lib/libc.so
  203. sed 's,/[^ ]*/,,g' $root/$prefix/lib/libpthread.so > $root/ROCK/tools.cross/$arch_target/lib/libpthread.so
  204. fi
  205. # Install ld.so.conf
  206. #
  207. if [ ! -f $root/etc/ld.so.conf -a -z "$pkg_glibc_cross" ]
  208. then
  209. { echo "/usr/lib" ; echo "/usr/X11/lib"
  210. echo "/usr/local/lib" ; echo "/opt/*/lib"
  211. } > $root/etc/ld.so.conf
  212. fi
  213. # Move 'ldconfig' and 'sln' binaries
  214. #
  215. if [ -z "$pkg_glibc_cross" ]
  216. then
  217. if [ -f "$root/usr/sbin/ldconfig" ]; then
  218. mv -v $root/usr/sbin/ldconfig $root/sbin/ldconfig
  219. fi
  220. if [ -f "$root/usr/sbin/sln" ]; then
  221. mv -v $root/usr/sbin/sln $root/sbin/sln
  222. fi
  223. fi
  224. # Create /lib/ld-lsb.so.1 symlink
  225. #
  226. if [ -z "$pkg_glibc_cross" ]
  227. then
  228. if [ -f $root/lib/ld-linux-$arch_machine.so.2 ]; then
  229. ln -vfs ld-linux-$arch_machine.so.2 $root/lib/ld-lsb.so.1
  230. elif [ -f $root/lib/ld-linux.so.2 ]; then
  231. ln -vfs ld-linux.so.2 $root/lib/ld-lsb.so.1
  232. fi
  233. fi
  234. }
  235. fi
  236. #---------------------------------
  237. glibc_prepatch() {
  238. if [ $pkg_glibc_linuxthreads = 1 -a -f $archdir/*linuxthreads*.tar.bz2 ]; then
  239. tar $taropt $archdir/*linuxthreads*.tar.bz2
  240. fi
  241. }
  242. glibc_stage0() {
  243. if [ $pkg_glibc_version = 23 ]
  244. then
  245. # .cross patches don't get applied automagically if we build a -cross- pkg
  246. # maybe add $confdir/glibc23/*.patch.${pkg_glibc_cross:0:3} to the for loop ?
  247. if [ -n "$pkg_glibc_cross" ] ; then
  248. for i in $confdir/glibc23/*.patch.cross
  249. do
  250. echo "Applying patch $i..."
  251. patch -p1 < $i ;
  252. done
  253. fi
  254. # for mips*, tries to add -mabi. for headers, we don't have a compiler allowing that yet
  255. # if cross-compiling. the values of _MIPS_SIM can be found in sysdeps/mips/sgidefs.h
  256. if [ \( $arch = mips -a $crossnative = cross \) -o -n "$pkg_glibc_cross" ] ; then
  257. patch -p1 < $confdir/glibc23/no-mabi-mips64.cross.diff
  258. mv sysdeps/mips/mips32/Makefile sysdeps/mips/mips32/Makefile-x
  259. echo "CC += -D_MIPS_SZPTR=32 -D_MIPS_SIM=1" > sysdeps/mips/mips32/Makefile
  260. mv sysdeps/mips/mips64/n32/Makefile sysdeps/mips/mips64/n32/Makefile-x
  261. echo "CC += -D_MIPS_SZPTR=64 -D_MIPS_SIM=2" > sysdeps/mips/mips64/n32/Makefile
  262. echo "long-double-fcts = yes" >> sysdeps/mips/mips64/n32/Makefile
  263. mv sysdeps/mips/mips64/n64/Makefile sysdeps/mips/mips64/n64/Makefile-x
  264. echo "CC += -D_MIPS_SZPTR=64 -D_MIPS_SIM=3" > sysdeps/mips/mips64/n64/Makefile
  265. echo "long-double-fcts = yes" >> sysdeps/mips/mips64/n64/Makefile
  266. fi
  267. mkdir -p objdir; cd objdir
  268. confopt="${confopt% --target=*}"
  269. var_append confopt " " "--enable-add-ons"$ADDONS" --build=\$arch_build \
  270. --host=\$arch_target"
  271. # due to assembler check - and we do not yet have as ...
  272. [ $arch = hppa ] && var_append confopt " " "--enable-hacker-mode"
  273. eval "../configure --enable-add-ons"$ADDONS" $confopt"
  274. make -k cross-compiling=yes install-headers || true
  275. cp -v ../include/features.h $root/$prefix/include
  276. fi
  277. if [ $pkg_glibc_version = 22 ]
  278. then
  279. eval "./configure --enable-add-ons $confopt"
  280. make cross-compiling=yes install-headers
  281. cp -v include/features.h $root/$prefix/include
  282. fi
  283. mkdir -p $root/$prefix/include/gnu
  284. touch $root/$prefix/include/gnu/stubs.h
  285. cp -v bits/stdio_lim.h $root/$prefix/include/bits
  286. }
  287. patchfiles="`ls $confdir/glibc$pkg_glibc_version/*.patch \
  288. $confdir/glibc$pkg_glibc_version/*.patch.$arch 2>/dev/null | tr '\n' ' '` $patchfiles"
  289. if [ $pkg_glibc_linuxthreads = 1 ]; then
  290. patchfiles="`ls $confdir/glibc$pkg_glibc_version/*.patch-linuxthreads | tr '\n' ' '` $patchfiles"
  291. fi
  292. if [ $stagelevel -le 1 ]; then
  293. patchfiles="`ls $patchfiles $confdir/glibc$pkg_glibc_version/*.patch.cross \
  294. $confdir/glibc$pkg_glibc_version/*.patch.cross.$arch 2>/dev/null | tr '\n' ' '`"
  295. fi
  296. if [ $pkg_glibc_version = 22 ] ; then
  297. # auto-detect for the old glibc
  298. ADDONS=""
  299. else
  300. # new glibc is using NPTL per default, set to linuxthreads if needed
  301. if [ $pkg_glibc_linuxthreads = 1 ]; then
  302. ADDONS="=linuxthreads"
  303. else
  304. ADDONS=""
  305. fi
  306. fi
  307. threadsver="$ver"
  308. prepatch="glibc_prepatch"
  309. if [ -z "$pkg_glibc_cross" ]
  310. then
  311. if [ $stagelevel -eq 0 ]
  312. then
  313. custmain="glibc_stage0"
  314. else
  315. custmain="glibc_custmain"
  316. fi
  317. else
  318. if [ $pkg_glibc_version = 22 ]; then
  319. echo_error "Cross-packages are not supported for glibc22!"
  320. exit 1
  321. fi
  322. arch_target="$pkg_glibc_target"
  323. arch_machine="${arch_target/-*/}"
  324. prefix="$prefix/$pkg_glibc_target"
  325. set_confopt
  326. if [ -z "$( type -p $pkg_glibc_target-gcc )" ]
  327. then
  328. echo_status "Building only cross-headers because there is no cross-gcc (yet)."
  329. custmain="glibc_stage0"
  330. else
  331. export CC=$pkg_glibc_target-gcc
  332. export AS=$pkg_glibc_target-as
  333. export LD=$pkg_glibc_target-ld
  334. export AR=$pkg_glibc_target-ar
  335. export NM=$pkg_glibc_target-nm
  336. export GASP=$pkg_glibc_target-gasp
  337. export STRIP=$pkg_glibc_target-strip
  338. export RANLIB=$pkg_glibc_target-ranlib
  339. export CFLAGS="-O2"
  340. custmain="glibc_custmain"
  341. fi
  342. fi
  343. if [ $stagelevel -eq 1 -a -f $confdir/glibc$pkg_glibc_version/no_path_in_glibcso.diff ]
  344. then
  345. var_append patchfiles " " $confdir/glibc$pkg_glibc_version/no_path_in_glibcso.diff
  346. fi