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.

148 lines
4.9 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/dietlibc/parse-config-9
  9. # ROCK Linux is Copyright (C) 1998 - 2003 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. # --- FUNCTIONS-BEGIN ---
  23. function set_wrapper_and_misc () {
  24. var_append CC_WRAPPER_INSERT " " "-idirafter $root/usr/include"
  25. if [ "$stagelevel" -le 1 -o "$ROCKCFG_DIETLIBC_ALL" -ne 1 ] ; then
  26. var_append CC_WRAPPER_INSERT " " "-nostdinc"
  27. # all dietlibc pathes are redirected into the build system
  28. var_insert CC_WRAPPER_FILTER "|" "sed -e 's,/usr/dietlibc/,$root&,'"
  29. var_append CC_WRAPPER_OTHERS ":" $dietbin
  30. else
  31. if [ "$diet_dynamic_static" == "static" ] ; then
  32. var_append GCC_WRAPPER_INSERT " " "-static"
  33. fi
  34. var_append GCC_WRAPPER_INSERT " " "-D__dietlibc__"
  35. fi
  36. }
  37. function add_lib () {
  38. if [ "$stagelevel" -le 1 ] ; then var_append CC_WRAPPER_APPEND_PO " " "$1"
  39. else var_append CC_WRAPPER_APPEND " " "$1"; fi
  40. }
  41. # --- FUNCTIONS-END --
  42. # decide wether to compile the packet with dietlibc or not
  43. if [ "$ROCKCFG_DIETLIBC_ALL" = 1 -o "$pkg" = "dietlibc" ]; then
  44. pkg_dietlibc_useit=1
  45. else
  46. x="${pkg//-/_}" ; x="${x//+/_}"
  47. eval "pkg_dietlibc_useit=\$ROCKCFG_DIETLIBC_${x}"
  48. fi
  49. [ "$pkg_dietlibc_useit" != 1 ] && pkg_dietlibc_useit=0
  50. [ "$stagelevel" -eq 0 ] && pkg_dietlibc_useit=0 # never use dietlibc in stage 0
  51. if [ "$pkg_dietlibc_useit" = 1 ]; then
  52. # If we use something like 'i386-pc-linux-gnu' as architecture name,
  53. # some programs start using gnu extensions. So we use ..-gnulibc1
  54. # instead.
  55. #
  56. pkg_dietlibc_orig_target="$arch_target"
  57. arch_target="${arch_target}libc1"
  58. [ $ROCKCFG_CROSSBUILD = 0 ] && arch_build="${arch_target}"
  59. if [ -d $base/build/$ROCKCFG_ID/$toolsdir/diet-bin ] ; then
  60. PATH="$base/build/$ROCKCFG_ID/$toolsdir/diet-bin:$PATH"
  61. fi
  62. if [ "$ROCKCFG_DIETLIBC_DYN" = "1" ]
  63. then dietbin="diet-dyn" ; diet_dynamic_static="dynamic"
  64. else dietbin="diet" ; diet_dynamic_static="static" ; fi
  65. echo_status "Preparing configuration to build this package with dietlibc ("${diet_dynamic_static}"ally)."
  66. if [ "$stagelevel" -gt 1 ]; then
  67. var_remove CC_WRAPPER_INSERT " " "-pipe" ;
  68. var_append CC_WRAPPER_REMOVE " " "-pipe" ;
  69. var_remove GCC_WRAPPER_INSERT " " "-pipe" ;
  70. var_append GCC_WRAPPER_REMOVE " " "-pipe" ;
  71. var_remove KCC_WRAPPER_INSERT " " "-pipe" ;
  72. var_append KCC_WRAPPER_REMOVE " " "-pipe" ;
  73. fi
  74. # patch has problems with Plan A patching so we switch with -x 16 to Plan B
  75. [ "$stagelevel" -ge 9 ] && patchopt="-bfp1 -x 16 -z .orig"
  76. case "$pkg" in
  77. dietlibc)
  78. echo_status "This package does not utilize a C library ..."
  79. ;;
  80. linux*)
  81. echo_status "This package is currently blacklisted and not build using dietlibc!"
  82. [ "$stagelevel" -gt 1 ] && [ "$diet_dynamic_static" == "static" ] && var_append GCC_WRAPPER_INSERT " " "-static"
  83. ;;
  84. e2fsprogs|util-linux|net-tools) # the packets that have BSD problems and/or GNU problems
  85. echo_status "Setting dietlibc special GNU/BSD settings!"
  86. var_append CC_WRAPPER_INSERT " " "-D_BSD_SOURCE"
  87. var_append CC_WRAPPER_INSERT " " "-D_GNU_SOURCE"
  88. set_wrapper_and_misc
  89. ;;
  90. sed|lilo)
  91. echo_status "Setting dietlibc special lcompat settings!"
  92. add_lib "-lcompat"
  93. set_wrapper_and_misc
  94. ;;
  95. coreutils|findutils)
  96. echo_status "Setting dietlibc special lcompat+BSD settings!"
  97. var_append CC_WRAPPER_INSERT " " "-D_BSD_SOURCE"
  98. add_lib "-lcompat"
  99. set_wrapper_and_misc
  100. ;;
  101. *)
  102. echo_status "Using default dietlibc compiler options!"
  103. set_wrapper_and_misc
  104. ;;
  105. esac
  106. case "$pkg" in
  107. coreutils)
  108. var_remove patchfiles " " "*acl-xattr.patch"
  109. ;;
  110. curl)
  111. [ "$diet_dynamic_static" == "static" ] && var_append extraconfopt " " "--disable-shared"
  112. ;;
  113. ncurses)
  114. var_append extraconfopt " " "--without-cxx-binding --without-cxx"
  115. ;;
  116. util-linux)
  117. add_lib "-lrpc"
  118. add_lib "-lcompat"
  119. ;;
  120. dump)
  121. var_append extraconfopt " " "--disable-rmt"
  122. ;;
  123. esac
  124. var_append patchfiles " " `ls $base/package/base/dietlibc/pkg_patch/pkg_$pkg.patch 2>/dev/null`
  125. [ "$stagelevel" -ge 1 -a "$ROCKCFG_DIETLIBC_ALL" -eq 1 ] && var_append patchfiles " " `ls $base/package/base/dietlibc/pkg_patch/pkg_$pkg.chroot.patch 2>/dev/null`
  126. fi