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.

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