OpenSDE Packages Database (without history before r20070)
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.

205 lines
6.0 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: package/.../dietlibc/parse-config-9
  6. # Copyright (C) 2006 - 2008 The OpenSDE Project
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2004 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- SDE-COPYRIGHT-NOTE-END ---
  17. # --- FUNCTIONS-BEGIN ---
  18. function set_wrapper_and_misc () {
  19. export DIETHOME=$root/usr/dietlibc
  20. if ! atstage native || [ "$SDECFG_LIBC" != "dietlibc" ] ; then
  21. var_append CC_WRAPPER_OTHERS ":" $dietbin
  22. fi
  23. if [ "$diet_dynamic_static" == "static" ] ; then
  24. var_append extraconfopt ' ' '--disable-shared --without-shared'
  25. var_append GCC_WRAPPER_INSERT ' ' '-c?:-static'
  26. fi
  27. var_append GCC_WRAPPER_INSERT ' ' '-D__dietlibc__'
  28. }
  29. function add_lib () {
  30. var_append CC_WRAPPER_APPEND " " "-c?:$1"
  31. }
  32. function remove_lib () {
  33. var_append CC_WRAPPER_REMOVE " " "$1"
  34. }
  35. # --- FUNCTIONS-END --
  36. # decide wether to compile the packet with dietlibc or not
  37. if [ "$SDECFG_LIBC" = "dietlibc" -o "$pkg" = "dietlibc" ]; then
  38. pkg_dietlibc_useit=1
  39. else
  40. x="${pkg//-/_}" ; x="${x//+/_}"
  41. eval "pkg_dietlibc_useit=\$SDECFG_DIETLIBC_${x}"
  42. fi
  43. [ "$pkg_dietlibc_useit" != 1 ] && pkg_dietlibc_useit=0
  44. [ "$pkg_dietlibc_useit" = 1 -a $pkg = gcc ] &&
  45. var_append extraconfopt " " "--disable-threads"
  46. # never use dietlibc in stage 0
  47. if atstage toolchain; then
  48. pkg_dietlibc_useit=0
  49. fi
  50. if [ "$pkg_dietlibc_useit" = 1 ]; then
  51. # If we use something like 'i386-pc-linux-gnu' as architecture name,
  52. # some programs start using gnu extensions. So we use ..-dietlibc
  53. # instead.
  54. #
  55. pkg_dietlibc_orig_target="$arch_target"
  56. arch_target="${arch_target/-gnu/-gnudietlibc}"
  57. if atstage native; then
  58. arch_build="${arch_target}"
  59. fi
  60. if [ -d $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/diet-bin ] ; then
  61. PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/diet-bin:$PATH"
  62. fi
  63. if [ "$SDECFG_DIETLIBC_DYN" = "1" ]
  64. then dietbin="diet-dyn" ; diet_dynamic_static="dynamic"
  65. else dietbin="diet" ; diet_dynamic_static="static" ; fi
  66. echo_status "Preparing configuration to build this package with dietlibc ("${diet_dynamic_static}"ally)."
  67. if atstage native; then
  68. var_remove CC_WRAPPER_INSERT " " "-pipe" ;
  69. var_append CC_WRAPPER_REMOVE " " "-pipe" ;
  70. var_remove GCC_WRAPPER_INSERT " " "-pipe" ;
  71. var_append GCC_WRAPPER_REMOVE " " "-pipe" ;
  72. var_remove KCC_WRAPPER_INSERT " " "-pipe" ;
  73. var_append KCC_WRAPPER_REMOVE " " "-pipe" ;
  74. fi
  75. if [ "$GCC_WRAPPER_INSERT" != "${GCC_WRAPPER_INSERT/-fstack-protector}" ]; then
  76. echo_warning 'Disabling GCC stack-protector for dietlibc-based package.'
  77. var_remove GCC_WRAPPER_INSERT ' ' '-fstack-protector'
  78. fi
  79. # patch has problems with Plan A patching so we switch with -x 16 to Plan B
  80. if atstage rebuild; then
  81. patchopt="-bfp1 -x 16 -z .orig"
  82. fi
  83. case "$pkg" in
  84. dietlibc)
  85. ;;
  86. linux*)
  87. echo_status "Dietlibc not utilized for this package."
  88. if atstage native && [ "$diet_dynamic_static" == "static" ]; then
  89. var_append GCC_WRAPPER_INSERT " " "-static"
  90. fi
  91. ;;
  92. iptables|mmv|grsecurity)
  93. echo_status "Enabling non-portable GNU features."
  94. var_append CC_WRAPPER_INSERT " " "-D_GNU_SOURCE"
  95. set_wrapper_and_misc
  96. ;;
  97. coreutils|findutils|curl|procps|radiusclient-ng|libpcap|binutils|udhcp|file|libxml|lvm2|iputils|hotplug2|xmlrpc-c)
  98. echo_status "Enabling non-portable BSD features."
  99. var_append CC_WRAPPER_INSERT " " "-D_BSD_SOURCE"
  100. set_wrapper_and_misc
  101. ;;
  102. e2fsprogs|util-linux|ash|irda-utils|ppp|dropbear|nullmailer|traceroute|libevent)
  103. echo_status "Enabling non-portable GNU and BSD features."
  104. var_append CC_WRAPPER_INSERT " " "-D_GNU_SOURCE -D_BSD_SOURCE"
  105. set_wrapper_and_misc
  106. ;;
  107. nvi)
  108. echo_status "Enabling non-portable GNU, BSD features and types."
  109. var_append CC_WRAPPER_INSERT " " "-D_GNU_SOURCE -D_BSD_SOURCE"
  110. var_append CC_WRAPPER_INSERT " " "-D__BIT_TYPES_DEFINED__"
  111. set_wrapper_and_misc
  112. ;;
  113. iproute2)
  114. echo_status "Setting __GLIBC__=3 to build the package!"
  115. var_append CC_WRAPPER_INSERT " " "-D__GLIBC__=3"
  116. set_wrapper_and_misc
  117. ;;
  118. net-tools)
  119. echo_status "Enabling non-portable GNU, BSD features and a lot of other tweaks."
  120. var_append CC_WRAPPER_INSERT " " "-D_GNU_SOURCE -D_BSD_SOURCE"
  121. var_append CC_WRAPPER_INSERT " " "-D__GLIBC__"
  122. var_append CC_WRAPPER_INSERT " " "-D_LINUX_IN6_H"
  123. set_wrapper_and_misc
  124. ;;
  125. #squid)
  126. #var_append CC_WRAPPER_INSERT " " "-DHAVE_SYS_TIME_H"
  127. #set_wrapper_and_misc
  128. # ;;
  129. *)
  130. echo_status "Using default dietlibc options!"
  131. set_wrapper_and_misc
  132. ;;
  133. esac
  134. case "$pkg" in
  135. sed|lilo|findutils|net-tools|dropbear|udev|rng-tools|udhcp|psmisc|busybox|e2fsprogs|nbd)
  136. add_lib "-lcompat"
  137. ;;
  138. coreutils)
  139. add_lib "-lcompat"
  140. var_remove patchfiles " " "*acl-xattr.patch"
  141. ;;
  142. ncurses)
  143. var_append extraconfopt " " \
  144. "--without-cxx-binding --without-cxx"
  145. ;;
  146. util-linux)
  147. add_lib "-lrpc -lcompat"
  148. ;;
  149. dump)
  150. var_append extraconfopt " " "--disable-rmt"
  151. ;;
  152. perl)
  153. add_lib "-lm -lcompat"
  154. ;;
  155. openssl|gettext)
  156. remove_lib "-ldl"
  157. ;;
  158. iptables)
  159. add_lib "-lrpc"
  160. ;;
  161. grsecurity)
  162. var_append makeopt " " "nopam"
  163. ;;
  164. procps)
  165. if [ "$diet_dynamic_static" == "static" ]; then
  166. var_append makeopt ' ' 'SHARED=0'
  167. var_append makeinstopt ' ' 'SHARED=0'
  168. fi
  169. ;;
  170. esac
  171. var_append patchfiles " " \
  172. `ls $base/package/base/dietlibc/patches/pkg_$pkg.patch 2>/dev/null`
  173. if ! atstage toolchain && [ "$SDECFG_LIBC" = "dietlibc" ]; then
  174. var_append patchfiles " " \
  175. `ls $base/package/base/dietlibc/patches/pkg_$pkg.chroot.patch 2>/dev/null`
  176. fi
  177. fi