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.

517 lines
16 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. if [[ $xpkg = *24 ]] ; then
  28. echo_error "Cross package not yet supported by glibc24. Use glibc23!"
  29. exit 1
  30. fi
  31. pkg_glibc_cross="${xpkg#glibc*-cross-}"
  32. pkg_glibc_version=${pkg_glibc_version%-cross-*}
  33. pkg_glibc_target="${pkg_glibc_cross}-unknown-linux-gnu"
  34. echo_status "Preparing to build a cross-glibc package for $pkg_glibc_cross."
  35. ;;
  36. glibc??)
  37. ;;
  38. *)
  39. echo_error "Not supported $pkg package name: $xpkg"
  40. exit 1
  41. ;;
  42. esac
  43. pkg_glibc_linuxthreads=1
  44. [ "$ROCKCFG_PKG_GLIBC23_LINUXTHREADS" = "0" ] && pkg_glibc_linuxthreads=0
  45. [[ $xpkg = *24 ]] && pkg_glibc_linuxthreads=0
  46. # fall back to linuxthreads for cross glibcs
  47. [ -n "$pkg_glibc_cross" ] && pkg_glibc_linuxthreads=1
  48. # Give a more descriptive error message than the one that would happen during the build.
  49. kernel_mainline="`uname -r | cut -f-2 -d'.'`"
  50. if [ $pkg_glibc_linuxthreads = 0 -a "$kernel_mainline" != "2.6" ] ; then
  51. echo_error 'You are running a kernel of the $kernel_mainline series.'
  52. echo_error 'Glibc with NPTL support cannot be built on $kernel_mainline kernels.'
  53. echo_error 'Boot a 2.6 kernel to build Glibc with NPTL support or build Glibc'
  54. echo_error 'with old threading support (linuxthreads) instead.'
  55. abort
  56. fi
  57. #---------------------------------
  58. if [ $pkg_glibc_version = 22 ]; then
  59. glibc_custmain() {
  60. cat > configparms <<- EOF
  61. prefix = /usr
  62. slibdir = /lib
  63. sysconfdir = /etc
  64. install_root = $root
  65. CC = $CC
  66. BUILD_CC = $BUILDCC
  67. AR = $AR
  68. RANLIB = $RANLIB
  69. EOF
  70. # Disable glibc internal debuging but build debuging and profile
  71. # code so we can use this glibc to debug other programs.
  72. CFLAGS="$CFLAGS -g -DNDEBUG=1" ./configure --with-gnu-binutils \
  73. --enable-add-ons --enable-profile \
  74. --with-headers=$root/usr/include \
  75. --with-gd=/usr \
  76. --with-gd-lib=/usr/lib \
  77. --with-gd-include=/usr/include \
  78. --build=${arch_build} ${arch_target}
  79. echo $BUILDCC elf/sln.c -o elf/dyn_sln
  80. $BUILDCC elf/sln.c -o elf/dyn_sln
  81. eval $MAKE symbolic-link-prog=elf/dyn_sln all install
  82. # Misc. stuff
  83. #
  84. if [ "$crossnative" = native ] ; then
  85. [ $stagelevel -gt 1 ] && eval $MAKE install-locales -C localedata
  86. # otherwise we risk the hosts /usr/lib/locale/locale-archive being overwritten
  87. mkdir -p $root/usr/share/man/man3
  88. if [ -f /usr/bin/perl ] ; then
  89. eval $MAKE -C linuxthreads/man \
  90. MANDIR=$root/usr/share/man/man3 all install
  91. fi
  92. fi
  93. ln -sf libbsd-compat.a $root/usr/lib/libbsd.a
  94. # copy linuxthreads and crypt documentation
  95. #
  96. cp linuxthreads/ChangeLog $docdir/ChangeLog.threads
  97. cp linuxthreads/Changes $docdir/Changes.threads
  98. cp linuxthreads/README $docdir/README.threads
  99. cp linuxthreads/FAQ.html $docdir/FAQ-threads.html
  100. cp -r linuxthreads/Examples $docdir/examples.threads
  101. cp crypt/README.ufc-crypt $docdir/README.crypt
  102. # NSCD Init script and config
  103. #
  104. cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/
  105. install_init nscd $confdir/nscd.init
  106. # No absolute path in libc.so if cross-compileing
  107. #
  108. if [ $crossnative = cross ] ; then
  109. libcso=$root/usr/lib/libc.so
  110. for x in 1 2 3 4 5 ; do
  111. sed -i 's,/[a-z/]*/,,' $libcso
  112. done
  113. fi
  114. # Install ld.so.conf
  115. #
  116. {
  117. echo "/usr/lib"
  118. echo "/usr/X11/lib"
  119. echo "/usr/local/lib"
  120. echo "/opt/*/lib"
  121. } > $root/etc/ld.so.conf
  122. if [ -f $root/usr/sbin/ldconfig ] ; then
  123. ln -sf ../usr/sbin/ldconfig $root/sbin/
  124. fi
  125. }
  126. fi
  127. #---------------------------------
  128. #---------------------------------
  129. if [ $pkg_glibc_version = 23 ]; then
  130. glibc_custmain() {
  131. # check whether profiling is enabled
  132. if [ $ROCKCFG_PKG_GLIBC_ENABLE_PROFILE = 1 ] ; then
  133. G_PROFILE=--enable-profile
  134. else
  135. G_PROFILE=--disable-profile
  136. fi
  137. # Let's use an 'objdir' directory for building glibc
  138. mkdir -p objdir; cd objdir
  139. # NPTL doesn't work with plain i386 CPUs
  140. if [ $pkg_glibc_linuxthreads = 1 ]; then
  141. temp_arch_target="$arch_target"
  142. temp_arch_build="$arch_build"
  143. configure_without_tls="--without-tls"
  144. else
  145. temp_arch_target="${arch_target/i386/i486}"
  146. temp_arch_build="${arch_build/i386/i486}"
  147. configure_without_tls=""
  148. fi
  149. # Disable glibc internal debuging but build debuging and profile
  150. # code so we can use this glibc to debug other programs.
  151. create_config_cache >> config.cache
  152. CFLAGS="$CFLAGS -g -DNDEBUG=1" ../configure --prefix=$root/$prefix \
  153. --with-gnu-binutils --enable-add-ons"$ADDONS" $G_PROFILE \
  154. --with-headers=$root/$prefix/include --with-gd=/$prefix \
  155. --with-gd-lib=/$prefix/lib --with-gd-include=/$prefix/include \
  156. $configure_without_tls --cache-file=config.cache \
  157. --build=${temp_arch_build} --host=${temp_arch_target}
  158. eval $MAKE prefix=/usr slibdir=/lib sysconfdir=/etc all
  159. if [ -z "$pkg_glibc_cross" ]
  160. then
  161. eval $MAKE prefix=/$prefix slibdir=/lib \
  162. sysconfdir=/etc install_root=$root install
  163. else
  164. eval $MAKE prefix=/$prefix install_root=$root install
  165. fi
  166. ln -sf libbsd-compat.a $root/$prefix/lib/libbsd.a
  167. # install locales
  168. #
  169. if [ $stagelevel -gt 1 ] ; then
  170. # otherwise we risk the hosts /usr/lib/locale/locale-archive being overwritten
  171. eval $MAKE localedata/install-locales
  172. cp ../localedata/SUPPORTED $root/usr/share/i18n/
  173. fi
  174. # copy crypt documentation
  175. #
  176. cp ../crypt/README.ufc-crypt $docdir/README.crypt
  177. # NSCD Init script and config
  178. #
  179. cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/
  180. install_init nscd $confdir/nscd.init
  181. # Misc. stuff
  182. #
  183. if [ $stagelevel -gt 1 -a -z "$pkg_glibc_cross" ]
  184. then
  185. # install linuxthread manpages
  186. #
  187. mkdir -p $root/usr/share/man/man3
  188. if [ -f /usr/bin/perl -a $pkg_glibc_linuxthreads = 1 ] ; then
  189. eval $MAKE -C ../linuxthreads/man \
  190. MANDIR=$root/usr/share/man/man3 all install
  191. fi
  192. # copy linuxthreads documentation
  193. #
  194. if [ $pkg_glibc_linuxthreads = 1 ]; then
  195. cp ../linuxthreads/ChangeLog $docdir/ChangeLog.threads
  196. cp ../linuxthreads/Changes $docdir/Changes.threads
  197. cp ../linuxthreads/README $docdir/README.threads
  198. cp ../linuxthreads/FAQ.html $docdir/FAQ-threads.html
  199. cp -r ../linuxthreads/Examples $docdir/examples.threads
  200. fi
  201. fi
  202. # No wrong absolute path in *.so linker scripts
  203. #
  204. if [ -d $root/ROCK/tools.cross -a -z "$pkg_glibc_cross" ]; then
  205. rm -f $root/ROCK/tools.cross/$arch_target/lib/libc.so
  206. rm -f $root/ROCK/tools.cross/$arch_target/lib/libpthread.so
  207. sed 's,/[^ ]*/,,g' $root/$prefix/lib/libc.so > $root/ROCK/tools.cross/$arch_target/lib/libc.so
  208. sed 's,/[^ ]*/,,g' $root/$prefix/lib/libpthread.so > $root/ROCK/tools.cross/$arch_target/lib/libpthread.so
  209. fi
  210. # Install ld.so.conf
  211. #
  212. if [ ! -f $root/etc/ld.so.conf -a -z "$pkg_glibc_cross" ]
  213. then
  214. { echo "/usr/lib" ; echo "/usr/X11/lib"
  215. echo "/usr/local/lib" ; echo "/opt/*/lib"
  216. } > $root/etc/ld.so.conf
  217. fi
  218. # Move 'ldconfig' and 'sln' binaries
  219. #
  220. if [ -z "$pkg_glibc_cross" ]
  221. then
  222. if [ -f "$root/usr/sbin/ldconfig" ]; then
  223. mv -v $root/usr/sbin/ldconfig $root/sbin/ldconfig
  224. fi
  225. if [ -f "$root/usr/sbin/sln" ]; then
  226. mv -v $root/usr/sbin/sln $root/sbin/sln
  227. fi
  228. fi
  229. # Create /lib/ld-lsb.so.1 symlink
  230. #
  231. if [ -z "$pkg_glibc_cross" ]
  232. then
  233. if [ -f $root/lib/ld-linux-$arch_machine.so.2 ]; then
  234. ln -vfs ld-linux-$arch_machine.so.2 $root/lib/ld-lsb.so.1
  235. elif [ -f $root/lib/ld-linux.so.2 ]; then
  236. ln -vfs ld-linux.so.2 $root/lib/ld-lsb.so.1
  237. fi
  238. fi
  239. }
  240. fi
  241. #---------------------------------
  242. #---------------------------------
  243. if [ $pkg_glibc_version = 24 ]; then
  244. glibc_custmain() {
  245. # check whether profiling is enabled
  246. if [ $ROCKCFG_PKG_GLIBC_ENABLE_PROFILE = 1 ] ; then
  247. G_PROFILE=--enable-profile
  248. else
  249. G_PROFILE=--disable-profile
  250. fi
  251. # Let's use an 'objdir' directory for building glibc
  252. mkdir -p objdir; cd objdir
  253. # NPTL doesn't work with plain i386 CPUs
  254. temp_arch_target="${arch_target/i386/i486}"
  255. temp_arch_build="${arch_build/i386/i486}"
  256. configure_without_tls=""
  257. # Disable glibc internal debuging but build debuging and profile
  258. # code so we can use this glibc to debug other programs.
  259. create_config_cache >> config.cache
  260. CFLAGS="$CFLAGS -g -DNDEBUG=1" ../configure --prefix=$root/$prefix \
  261. --with-gnu-binutils --enable-add-ons"$ADDONS" $G_PROFILE \
  262. --with-headers=$root/$prefix/include --with-gd=/$prefix \
  263. --with-gd-lib=/$prefix/lib --with-gd-include=/$prefix/include \
  264. $configure_without_tls --cache-file=config.cache \
  265. --build=${temp_arch_build} --host=${temp_arch_target}
  266. eval $MAKE prefix=/usr slibdir=/lib sysconfdir=/etc all
  267. eval $MAKE prefix=/$prefix slibdir=/lib \
  268. sysconfdir=/etc install_root=$root install
  269. ln -sf libbsd-compat.a $root/$prefix/lib/libbsd.a
  270. # install locales
  271. #
  272. if [ $stagelevel -gt 1 ] ; then
  273. # otherwise we risk the hosts /usr/lib/locale/locale-archive being overwritten
  274. eval $MAKE localedata/install-locales
  275. cp ../localedata/SUPPORTED $root/usr/share/i18n/
  276. fi
  277. # copy crypt documentation
  278. #
  279. cp ../crypt/README.ufc-crypt $docdir/README.crypt
  280. # NSCD Init script and config
  281. #
  282. cp $confdir/nscd.conf $confdir/nsswitch.conf $root/etc/
  283. install_init nscd $confdir/nscd.init
  284. # No wrong absolute path in *.so linker scripts
  285. #
  286. if [ -d $root/ROCK/tools.cross -a -z "$pkg_glibc_cross" ]; then
  287. rm -f $root/ROCK/tools.cross/$arch_target/lib/libc.so
  288. rm -f $root/ROCK/tools.cross/$arch_target/lib/libpthread.so
  289. sed 's,/[^ ]*/,,g' $root/$prefix/lib/libc.so > $root/ROCK/tools.cross/$arch_target/lib/libc.so
  290. sed 's,/[^ ]*/,,g' $root/$prefix/lib/libpthread.so > $root/ROCK/tools.cross/$arch_target/lib/libpthread.so
  291. fi
  292. # Install ld.so.conf
  293. #
  294. if [ ! -f $root/etc/ld.so.conf ]
  295. then
  296. { echo "/usr/lib" ; echo "/usr/X11/lib"
  297. echo "/usr/local/lib" ; echo "/opt/*/lib"
  298. } > $root/etc/ld.so.conf
  299. fi
  300. # Move 'ldconfig' and 'sln' binaries
  301. #
  302. if [ -f "$root/usr/sbin/ldconfig" ]; then
  303. mv -v $root/usr/sbin/ldconfig $root/sbin/ldconfig
  304. fi
  305. if [ -f "$root/usr/sbin/sln" ]; then
  306. mv -v $root/usr/sbin/sln $root/sbin/sln
  307. fi
  308. # Create /lib/ld-lsb.so.1 symlink
  309. #
  310. if [ -f $root/lib/ld-linux-$arch_machine.so.2 ]; then
  311. ln -vfs ld-linux-$arch_machine.so.2 $root/lib/ld-lsb.so.1
  312. elif [ -f $root/lib/ld-linux.so.2 ]; then
  313. ln -vfs ld-linux.so.2 $root/lib/ld-lsb.so.1
  314. fi
  315. }
  316. fi
  317. #---------------------------------
  318. glibc_prepatch() {
  319. if [ $pkg_glibc_linuxthreads = 1 -a -f $archdir/*linuxthreads*.tar.bz2 ]; then
  320. tar $taropt $archdir/*linuxthreads*.tar.bz2
  321. fi
  322. }
  323. glibc_stage0() {
  324. if [ $pkg_glibc_version = 24 ]
  325. then
  326. mkdir -p objdir; cd objdir
  327. confopt="${confopt% --target=*}"
  328. var_append confopt " " "--enable-add-ons"$ADDONS" --build=\$arch_build \
  329. --host=\$arch_target"
  330. # due to assembler check - and we do not yet have as ...
  331. [ $arch = hppa ] && var_append confopt " " "--enable-hacker-mode"
  332. eval "../configure --enable-add-ons"$ADDONS" $confopt"
  333. make -k cross-compiling=yes install-headers || true
  334. cp -v ../include/features.h $root/$prefix/include
  335. fi
  336. if [ $pkg_glibc_version = 23 ]
  337. then
  338. # .cross patches don't get applied automagically if we build a -cross- pkg
  339. # maybe add $confdir/glibc23/*.patch.${pkg_glibc_cross:0:3} to the for loop ?
  340. if [ -n "$pkg_glibc_cross" ] ; then
  341. for i in $confdir/glibc23/*.patch.cross
  342. do
  343. echo "Applying patch $i..."
  344. patch -p1 < $i ;
  345. done
  346. fi
  347. # for mips*, tries to add -mabi. for headers, we don't have a compiler allowing that yet
  348. # if cross-compiling. the values of _MIPS_SIM can be found in sysdeps/mips/sgidefs.h
  349. if [ \( $arch = mips -a $crossnative = cross \) -o -n "$pkg_glibc_cross" ] ; then
  350. patch -p1 < $confdir/glibc23/no-mabi-mips64.cross.diff
  351. mv sysdeps/mips/mips32/Makefile sysdeps/mips/mips32/Makefile-x
  352. echo "CC += -D_MIPS_SZPTR=32 -D_MIPS_SIM=1" > sysdeps/mips/mips32/Makefile
  353. mv sysdeps/mips/mips64/n32/Makefile sysdeps/mips/mips64/n32/Makefile-x
  354. echo "CC += -D_MIPS_SZPTR=64 -D_MIPS_SIM=2" > sysdeps/mips/mips64/n32/Makefile
  355. echo "long-double-fcts = yes" >> sysdeps/mips/mips64/n32/Makefile
  356. mv sysdeps/mips/mips64/n64/Makefile sysdeps/mips/mips64/n64/Makefile-x
  357. echo "CC += -D_MIPS_SZPTR=64 -D_MIPS_SIM=3" > sysdeps/mips/mips64/n64/Makefile
  358. echo "long-double-fcts = yes" >> sysdeps/mips/mips64/n64/Makefile
  359. fi
  360. mkdir -p objdir; cd objdir
  361. confopt="${confopt% --target=*}"
  362. var_append confopt " " "--enable-add-ons"$ADDONS" --build=\$arch_build \
  363. --host=\$arch_target"
  364. # due to assembler check - and we do not yet have as ...
  365. [ $arch = hppa ] && var_append confopt " " "--enable-hacker-mode"
  366. eval "../configure --enable-add-ons"$ADDONS" $confopt"
  367. make -k cross-compiling=yes install-headers || true
  368. cp -v ../include/features.h $root/$prefix/include
  369. fi
  370. if [ $pkg_glibc_version = 22 ]
  371. then
  372. eval "./configure --enable-add-ons $confopt"
  373. make cross-compiling=yes install-headers
  374. cp -v include/features.h $root/$prefix/include
  375. fi
  376. mkdir -p $root/$prefix/include/gnu
  377. touch $root/$prefix/include/gnu/stubs.h
  378. cp -v bits/stdio_lim.h $root/$prefix/include/bits
  379. }
  380. patchfiles="`ls $confdir/glibc$pkg_glibc_version/*.patch \
  381. $confdir/glibc$pkg_glibc_version/*.patch.$arch 2>/dev/null | tr '\n' ' '` $patchfiles"
  382. if [ $pkg_glibc_linuxthreads = 1 ]; then
  383. patchfiles="`ls $confdir/glibc$pkg_glibc_version/*.patch-linuxthreads | tr '\n' ' '` $patchfiles"
  384. fi
  385. if [ $stagelevel -le 1 ]; then
  386. patchfiles="`ls $patchfiles $confdir/glibc$pkg_glibc_version/*.patch.cross \
  387. $confdir/glibc$pkg_glibc_version/*.patch.cross.$arch 2>/dev/null | tr '\n' ' '`"
  388. fi
  389. if [ $pkg_glibc_version = 22 ] ; then
  390. # auto-detect for the old glibc
  391. ADDONS=""
  392. else
  393. # new glibc is using NPTL per default, set to linuxthreads if needed
  394. if [ $pkg_glibc_linuxthreads = 1 ]; then
  395. ADDONS="=linuxthreads"
  396. else
  397. ADDONS=""
  398. fi
  399. fi
  400. threadsver="$ver"
  401. prepatch="glibc_prepatch"
  402. if [ -z "$pkg_glibc_cross" ]
  403. then
  404. if [ $stagelevel -eq 0 ]
  405. then
  406. custmain="glibc_stage0"
  407. else
  408. custmain="glibc_custmain"
  409. fi
  410. else
  411. if [ $pkg_glibc_version = 22 ]; then
  412. echo_error "Cross-packages are not supported for glibc22!"
  413. exit 1
  414. fi
  415. arch_target="$pkg_glibc_target"
  416. arch_machine="${arch_target/-*/}"
  417. prefix="$prefix/$pkg_glibc_target"
  418. set_confopt
  419. if [ -z "$( type -p $pkg_glibc_target-gcc )" ]
  420. then
  421. echo_status "Building only cross-headers because there is no cross-gcc (yet)."
  422. custmain="glibc_stage0"
  423. else
  424. export CC=$pkg_glibc_target-gcc
  425. export AS=$pkg_glibc_target-as
  426. export LD=$pkg_glibc_target-ld
  427. export AR=$pkg_glibc_target-ar
  428. export NM=$pkg_glibc_target-nm
  429. export GASP=$pkg_glibc_target-gasp
  430. export STRIP=$pkg_glibc_target-strip
  431. export RANLIB=$pkg_glibc_target-ranlib
  432. export CFLAGS="-O2"
  433. custmain="glibc_custmain"
  434. fi
  435. fi
  436. if [ $stagelevel -eq 1 -a -f $confdir/glibc$pkg_glibc_version/no_path_in_glibcso.diff ]
  437. then
  438. var_append patchfiles " " $confdir/glibc$pkg_glibc_version/no_path_in_glibcso.diff
  439. fi