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.

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