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.

336 lines
9.2 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 - 2004 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. #---------------------------------
  40. if [ $pkg_glibc_version = 22 ]; then
  41. glibc_custmain() {
  42. cat > configparms <<- EOF
  43. prefix = /usr
  44. slibdir = /lib
  45. sysconfdir = /etc
  46. install_root = $root
  47. CC = $CC
  48. BUILD_CC = $BUILDCC
  49. AR = $AR
  50. RANLIB = $RANLIB
  51. EOF
  52. # Disable glibc internal debuging but build debuging and profile
  53. # code so we can use this glibc to debug other programs.
  54. CFLAGS="$CFLAGS -g -DNDEBUG=1" ./configure --with-gnu-binutils \
  55. --enable-add-ons --enable-profile \
  56. --with-headers=$root/usr/include/linux \
  57. --with-gd=/usr \
  58. --with-gd-lib=/usr/lib \
  59. --with-gd-include=/usr/include \
  60. --build=${arch_build} ${arch_target}
  61. echo $BUILDCC elf/sln.c -o elf/dyn_sln
  62. $BUILDCC elf/sln.c -o elf/dyn_sln
  63. eval $MAKE symbolic-link-prog=elf/dyn_sln all install
  64. # Misc. stuff
  65. #
  66. if [ "$crossnative" = native ] ; then
  67. eval $MAKE install-locales -C localedata
  68. mkdir -p $root/usr/share/man/man3
  69. if [ -f /usr/bin/perl ] ; then
  70. eval $MAKE -C linuxthreads/man \
  71. MANDIR=$root/usr/share/man/man3 all install
  72. fi
  73. fi
  74. ln -sf libbsd-compat.a $root/usr/lib/libbsd.a
  75. # copy linuxthreads and crypt documentation
  76. #
  77. cp linuxthreads/ChangeLog $docdir/ChangeLog.threads
  78. cp linuxthreads/Changes $docdir/Changes.threads
  79. cp linuxthreads/README $docdir/README.threads
  80. cp linuxthreads/FAQ.html $docdir/FAQ-threads.html
  81. cp -r linuxthreads/Examples $docdir/examples.threads
  82. cp crypt/README.ufc-crypt $docdir/README.crypt
  83. # NSCD Init script and config
  84. #
  85. cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/
  86. install_init nscd $confdir/nscd.init
  87. # No absolute path in libc.so if cross-compileing
  88. #
  89. if [ $crossnative = cross ] ; then
  90. libcso=$root/usr/lib/libc.so
  91. for x in 1 2 3 4 5 ; do
  92. sed -i 's,/[a-z/]*/,,' $libcso
  93. done
  94. fi
  95. # Install ld.so.conf
  96. #
  97. {
  98. echo "/usr/lib"
  99. echo "/usr/X11/lib"
  100. echo "/usr/local/lib"
  101. echo "/opt/*/lib"
  102. } > $root/etc/ld.so.conf
  103. if [ -f $root/usr/sbin/ldconfig ] ; then
  104. ln -sf ../usr/sbin/ldconfig $root/sbin/
  105. fi
  106. }
  107. fi
  108. #---------------------------------
  109. #---------------------------------
  110. if [ $pkg_glibc_version = 23 ]; then
  111. glibc_custmain() {
  112. # check whether profiling is enabled
  113. if [ $ROCKCFG_PKG_GLIBC_ENABLE_PROFILE = 1 ] ; then
  114. G_PROFILE=--enable-profile
  115. else
  116. G_PROFILE=--disable-profile
  117. fi
  118. # Let's use an 'objdir' directory for building glibc
  119. mkdir -p objdir; cd objdir
  120. # Disable glibc internal debuging but build debuging and profile
  121. # code so we can use this glibc to debug other programs.
  122. CFLAGS="$CFLAGS -g -DNDEBUG=1" ../configure --prefix=$root/$prefix \
  123. --with-gnu-binutils --enable-add-ons"$ADDONS" $G_PROFILE \
  124. --with-headers=$root/$prefix/include --with-gd=/$prefix \
  125. --with-gd-lib=/$prefix/lib --with-gd-include=/$prefix/include \
  126. --build=${arch_build} --host=${arch_target}
  127. eval $MAKE prefix=/usr slibdir=/lib sysconfdir=/etc all
  128. if [ -z "$pkg_glibc_cross" ]
  129. then
  130. eval $MAKE prefix=/$prefix slibdir=/lib \
  131. sysconfdir=/etc install_root=$root install
  132. else
  133. eval $MAKE prefix=/$prefix install_root=$root install
  134. fi
  135. ln -sf libbsd-compat.a $root/$prefix/lib/libbsd.a
  136. # Misc. stuff
  137. #
  138. if [ $stagelevel -gt 1 -a -z "$pkg_glibc_cross" ]
  139. then
  140. # install locales and linuxthread manpages
  141. #
  142. eval $MAKE localedata/install-locales
  143. cp ../localedata/SUPPORTED $root/usr/share/i18n/
  144. mkdir -p $root/usr/share/man/man3
  145. if [ -f /usr/bin/perl ] ; then
  146. eval $MAKE -C ../linuxthreads/man \
  147. MANDIR=$root/usr/share/man/man3 all install
  148. fi
  149. # copy linuxthreads and crypt documentation
  150. #
  151. cp ../linuxthreads/ChangeLog $docdir/ChangeLog.threads
  152. cp ../linuxthreads/Changes $docdir/Changes.threads
  153. cp ../linuxthreads/README $docdir/README.threads
  154. cp ../linuxthreads/FAQ.html $docdir/FAQ-threads.html
  155. cp -r ../linuxthreads/Examples $docdir/examples.threads
  156. cp ../crypt/README.ufc-crypt $docdir/README.crypt
  157. # NSCD Init script and config
  158. #
  159. cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/
  160. install_init nscd $confdir/nscd.init
  161. fi
  162. # No wrong absolute path in libc.so
  163. #
  164. if [ $stagelevel -le 1 ]
  165. then
  166. libcso=$root/$prefix/lib/libc.so
  167. sed 's,/[^ ]*/,,g' < $libcso > $libcso.new
  168. mv $libcso.new $libcso
  169. fi
  170. # Install ld.so.conf
  171. #
  172. if [ ! -f $root/etc/ld.so.conf -a -z "$pkg_glibc_cross" ]
  173. then
  174. { echo "/usr/lib" ; echo "/usr/X11/lib"
  175. echo "/usr/local/lib" ; echo "/opt/*/lib"
  176. } > $root/etc/ld.so.conf
  177. fi
  178. # Move 'ldconfig' and 'sln' binaries
  179. #
  180. if [ -z "$pkg_glibc_cross" ]
  181. then
  182. if [ -f "$root/usr/sbin/ldconfig" ]; then
  183. mv -v $root/usr/sbin/ldconfig $root/sbin/ldconfig
  184. fi
  185. if [ -f "$root/usr/sbin/sln" ]; then
  186. mv -v $root/usr/sbin/sln $root/sbin/sln
  187. fi
  188. fi
  189. # Create /lib/ld-lsb.so.1 symlink
  190. #
  191. if [ -z "$pkg_glibc_cross" ]
  192. then
  193. if [ -f $root/lib/ld-linux-$arch_machine.so.2 ]; then
  194. ln -vfs ld-linux-$arch_machine.so.2 $root/lib/ld-lsb.so.1
  195. elif [ -f $root/lib/ld-linux.so.2 ]; then
  196. ln -vfs ld-linux.so.2 $root/lib/ld-lsb.so.1
  197. fi
  198. fi
  199. }
  200. fi
  201. #---------------------------------
  202. glibc_prepatch() {
  203. tarball="`echo $desc_D | grep linuxthreads | \
  204. sed 's/.* \(.*\.linuxthreads.*\) .*/\1/'`"
  205. if [ "$tarball" ] ; then
  206. tar $taropt $archdir/$tarball
  207. fi
  208. }
  209. glibc_stage0() {
  210. if [ $pkg_glibc_version = 23 ]
  211. then
  212. mkdir -p objdir; cd objdir
  213. confopt="${confopt% --target=*}"
  214. var_append confopt " " "--enable-add-ons"$ADDONS" --build=\$arch_build \
  215. --host=\$arch_target"
  216. # due to assembler check - and we do not yet have as ...
  217. [ $arch = hppa ] && var_append confopt " " "--enable-hacker-mode"
  218. eval "../configure --enable-add-ons"$ADDONS" $confopt"
  219. make -k cross-compiling=yes install-headers || true
  220. cp -v ../include/features.h $root/$prefix/include
  221. fi
  222. if [ $pkg_glibc_version = 22 ]
  223. then
  224. eval "./configure --enable-add-ons $confopt"
  225. make cross-compiling=yes install-headers
  226. cp -v include/features.h $root/$prefix/include
  227. fi
  228. mkdir -p $root/$prefix/include/gnu
  229. touch $root/$prefix/include/gnu/stubs.h
  230. cp -v bits/stdio_lim.h $root/$prefix/include/bits
  231. }
  232. patchfiles="`ls $confdir/glibc$pkg_glibc_version/*.patch \
  233. $confdir/glibc$pkg_glibc_version/*.patch.$arch 2>/dev/null | tr '\n' ' '` $patchfiles"
  234. if [ $stagelevel -le 1 ]; then
  235. patchfiles="`ls $patchfiles $confdir/glibc$pkg_glibc_version/*.patch.cross \
  236. $confdir/glibc$pkg_glibc_version/*.patch.cross.$arch 2>/dev/null | tr '\n' ' '`"
  237. fi
  238. if [ $pkg_glibc_version = 22 ] ; then
  239. # auto-detect for the old glibc
  240. ADDONS=""
  241. else
  242. # prevent the utilisation of nptl (...) - and enable it later
  243. # if a 2.5/6 kernel is used
  244. ADDONS="=linuxthreads"
  245. fi
  246. threadsver="$ver"
  247. prepatch="glibc_prepatch"
  248. if [ -z "$pkg_glibc_cross" ]
  249. then
  250. if [ $stagelevel -eq 0 ]
  251. then
  252. custmain="glibc_stage0"
  253. else
  254. custmain="glibc_custmain"
  255. fi
  256. else
  257. if [ $pkg_glibc_version = 22 ]; then
  258. echo_error "Cross-packages are not supported for glibc22!"
  259. exit 1
  260. fi
  261. arch_target="$pkg_glibc_target"
  262. arch_machine="${arch_target/-*/}"
  263. prefix="$prefix/$pkg_glibc_target"
  264. set_confopt
  265. if [ -z "$( type -p $pkg_glibc_target-gcc )" ]
  266. then
  267. echo_status "Building only cross-headers because there is no cross-gcc (yet)."
  268. custmain="glibc_stage0"
  269. else
  270. export CC=$pkg_glibc_target-gcc
  271. export AS=$pkg_glibc_target-as
  272. export LD=$pkg_glibc_target-ld
  273. export AR=$pkg_glibc_target-ar
  274. export NM=$pkg_glibc_target-nm
  275. export GASP=$pkg_glibc_target-gasp
  276. export STRIP=$pkg_glibc_target-strip
  277. export RANLIB=$pkg_glibc_target-ranlib
  278. export CFLAGS="-O2"
  279. custmain="glibc_custmain"
  280. fi
  281. fi
  282. if [ $stagelevel -eq 1 -a -f $confdir/glibc$pkg_glibc_version/no_path_in_glibcso.diff ]
  283. then
  284. var_append patchfiles " " $confdir/glibc$pkg_glibc_version/no_path_in_glibcso.diff
  285. fi