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.

368 lines
11 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 *.so linker scripts
  163. #
  164. if [ -d $root/ROCK/tools.cross ]; then
  165. rm -f $root/ROCK/tools.cross/$arch_target/lib/libc.so
  166. rm -f $root/ROCK/tools.cross/$arch_target/lib/libpthread.so
  167. sed 's,/[^ ]*/,,g' $root/$prefix/lib/libc.so > $root/ROCK/tools.cross/$arch_target/lib/libc.so
  168. sed 's,/[^ ]*/,,g' $root/$prefix/lib/libpthread.so > $root/ROCK/tools.cross/$arch_target/lib/libpthread.so
  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. if [ $pkg_glibc_version = 23 ] ; then
  209. # add hppa patch if needed
  210. if [ "$arch" = hppa ]; then
  211. tar --use-compress-program=bzip2 -Oxf $archdir/glibc-hppa*.bz2 > $archdir/glibc-hppa-patches.diff
  212. var_append patchfiles " " "$archdir/glibc-hppa-patches.diff"
  213. fi
  214. fi
  215. }
  216. glibc_stage0() {
  217. if [ $pkg_glibc_version = 23 ]
  218. then
  219. # .cross patches don't get applied automagically if we build a -cross- pkg
  220. # maybe add $confdir/glibc23/*.patch.${pkg_glibc_cross:0:3} to the for loop ?
  221. if [ -n "$pkg_glibc_cross" ] ; then
  222. for i in $confdir/glibc23/*.patch.cross
  223. do
  224. echo "Applying patch $i..."
  225. patch -p1 < $i ;
  226. done
  227. fi
  228. # for mips*, tries to add -mabi. for headers, we don't have a compiler allowing that yet
  229. # if cross-compiling. the values of _MIPS_SIM can be found in sysdeps/mips/sgidefs.h
  230. if [ \( $arch = mips -a $crossnative = cross \) -o -n "$pkg_glibc_cross" ] ; then
  231. patch -p1 < $confdir/glibc23/no-mabi-mips64.cross.diff
  232. mv sysdeps/mips/mips32/Makefile sysdeps/mips/mips32/Makefile-x
  233. echo "CC += -D_MIPS_SZPTR=32 -D_MIPS_SIM=1" > sysdeps/mips/mips32/Makefile
  234. mv sysdeps/mips/mips64/n32/Makefile sysdeps/mips/mips64/n32/Makefile-x
  235. echo "CC += -D_MIPS_SZPTR=64 -D_MIPS_SIM=2" > sysdeps/mips/mips64/n32/Makefile
  236. echo "long-double-fcts = yes" >> sysdeps/mips/mips64/n32/Makefile
  237. mv sysdeps/mips/mips64/n64/Makefile sysdeps/mips/mips64/n64/Makefile-x
  238. echo "CC += -D_MIPS_SZPTR=64 -D_MIPS_SIM=3" > sysdeps/mips/mips64/n64/Makefile
  239. echo "long-double-fcts = yes" >> sysdeps/mips/mips64/n64/Makefile
  240. fi
  241. mkdir -p objdir; cd objdir
  242. confopt="${confopt% --target=*}"
  243. var_append confopt " " "--enable-add-ons"$ADDONS" --build=\$arch_build \
  244. --host=\$arch_target"
  245. # due to assembler check - and we do not yet have as ...
  246. [ $arch = hppa ] && var_append confopt " " "--enable-hacker-mode"
  247. eval "../configure --enable-add-ons"$ADDONS" $confopt"
  248. make -k cross-compiling=yes install-headers || true
  249. cp -v ../include/features.h $root/$prefix/include
  250. fi
  251. if [ $pkg_glibc_version = 22 ]
  252. then
  253. eval "./configure --enable-add-ons $confopt"
  254. make cross-compiling=yes install-headers
  255. cp -v include/features.h $root/$prefix/include
  256. fi
  257. mkdir -p $root/$prefix/include/gnu
  258. touch $root/$prefix/include/gnu/stubs.h
  259. cp -v bits/stdio_lim.h $root/$prefix/include/bits
  260. }
  261. patchfiles="`ls $confdir/glibc$pkg_glibc_version/*.patch \
  262. $confdir/glibc$pkg_glibc_version/*.patch.$arch 2>/dev/null | tr '\n' ' '` $patchfiles"
  263. if [ $stagelevel -le 1 ]; then
  264. patchfiles="`ls $patchfiles $confdir/glibc$pkg_glibc_version/*.patch.cross \
  265. $confdir/glibc$pkg_glibc_version/*.patch.cross.$arch 2>/dev/null | tr '\n' ' '`"
  266. fi
  267. if [ $pkg_glibc_version = 22 ] ; then
  268. # auto-detect for the old glibc
  269. ADDONS=""
  270. else
  271. # prevent the utilisation of nptl (...) - and enable it later
  272. # if a 2.5/6 kernel is used
  273. ADDONS="=linuxthreads"
  274. fi
  275. threadsver="$ver"
  276. prepatch="glibc_prepatch"
  277. if [ -z "$pkg_glibc_cross" ]
  278. then
  279. if [ $stagelevel -eq 0 ]
  280. then
  281. custmain="glibc_stage0"
  282. else
  283. custmain="glibc_custmain"
  284. fi
  285. else
  286. if [ $pkg_glibc_version = 22 ]; then
  287. echo_error "Cross-packages are not supported for glibc22!"
  288. exit 1
  289. fi
  290. arch_target="$pkg_glibc_target"
  291. arch_machine="${arch_target/-*/}"
  292. prefix="$prefix/$pkg_glibc_target"
  293. set_confopt
  294. if [ -z "$( type -p $pkg_glibc_target-gcc )" ]
  295. then
  296. echo_status "Building only cross-headers because there is no cross-gcc (yet)."
  297. custmain="glibc_stage0"
  298. else
  299. export CC=$pkg_glibc_target-gcc
  300. export AS=$pkg_glibc_target-as
  301. export LD=$pkg_glibc_target-ld
  302. export AR=$pkg_glibc_target-ar
  303. export NM=$pkg_glibc_target-nm
  304. export GASP=$pkg_glibc_target-gasp
  305. export STRIP=$pkg_glibc_target-strip
  306. export RANLIB=$pkg_glibc_target-ranlib
  307. export CFLAGS="-O2"
  308. custmain="glibc_custmain"
  309. fi
  310. fi
  311. if [ $stagelevel -eq 1 -a -f $confdir/glibc$pkg_glibc_version/no_path_in_glibcso.diff ]
  312. then
  313. var_append patchfiles " " $confdir/glibc$pkg_glibc_version/no_path_in_glibcso.diff
  314. fi