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.

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