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.

207 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 - 2010 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. elif hasflag USE_DIETLIBC; then
  40. pkg_dietlibc_useit=1
  41. else
  42. x="${pkg//-/_}" ; x="${x//+/_}"
  43. eval "pkg_dietlibc_useit=\$SDECFG_DIETLIBC_${x}"
  44. fi
  45. [ "$pkg_dietlibc_useit" != 1 ] && pkg_dietlibc_useit=0
  46. [ "$pkg_dietlibc_useit" = 1 -a $pkg = gcc ] &&
  47. var_append extraconfopt " " "--disable-threads"
  48. # never use dietlibc in stage 0
  49. if atstage toolchain; then
  50. pkg_dietlibc_useit=0
  51. fi
  52. if [ "$pkg_dietlibc_useit" = 1 ]; then
  53. # If we use something like 'i386-pc-linux-gnu' as architecture name,
  54. # some programs start using gnu extensions. So we use ..-dietlibc
  55. # instead.
  56. #
  57. pkg_dietlibc_orig_target="$arch_target"
  58. arch_target="${arch_target/-gnu/-gnudietlibc}"
  59. if atstage native; then
  60. arch_build="${arch_target}"
  61. fi
  62. if [ -d $base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/diet-bin ] ; then
  63. PATH="$base/build/$SDECFG_ID/TOOLCHAIN/$toolsdir/diet-bin:$PATH"
  64. fi
  65. if [ "$SDECFG_DIETLIBC_DYN" = "1" ]
  66. then dietbin="diet-dyn" ; diet_dynamic_static="dynamic"
  67. else dietbin="diet" ; diet_dynamic_static="static" ; fi
  68. echo_status "Preparing configuration to build this package with dietlibc ("${diet_dynamic_static}"ally)."
  69. if atstage native; then
  70. var_remove CC_WRAPPER_INSERT " " "-pipe" ;
  71. var_append CC_WRAPPER_REMOVE " " "-pipe" ;
  72. var_remove GCC_WRAPPER_INSERT " " "-pipe" ;
  73. var_append GCC_WRAPPER_REMOVE " " "-pipe" ;
  74. var_remove KCC_WRAPPER_INSERT " " "-pipe" ;
  75. var_append KCC_WRAPPER_REMOVE " " "-pipe" ;
  76. fi
  77. if [ "$GCC_WRAPPER_INSERT" != "${GCC_WRAPPER_INSERT/-fstack-protector}" ]; then
  78. echo_warning 'Disabling GCC stack-protector for dietlibc-based package.'
  79. var_remove GCC_WRAPPER_INSERT ' ' '-fstack-protector'
  80. fi
  81. # patch has problems with Plan A patching so we switch with -x 16 to Plan B
  82. if atstage rebuild; then
  83. patchopt="-bfp1 -x 16 -z .orig"
  84. fi
  85. case "$pkg" in
  86. dietlibc)
  87. ;;
  88. linux*)
  89. echo_status "Dietlibc not utilized for this package."
  90. if atstage native && [ "$diet_dynamic_static" == "static" ]; then
  91. var_append GCC_WRAPPER_INSERT " " "-static"
  92. fi
  93. ;;
  94. iptables|mmv|grsecurity)
  95. echo_status "Enabling non-portable GNU features."
  96. var_append CC_WRAPPER_INSERT " " "-D_GNU_SOURCE"
  97. set_wrapper_and_misc
  98. ;;
  99. coreutils|findutils|curl|procps|radiusclient-ng|libpcap|binutils|udhcp|file|libxml|lvm2|iputils|hotplug2|xmlrpc-c)
  100. echo_status "Enabling non-portable BSD features."
  101. var_append CC_WRAPPER_INSERT " " "-D_BSD_SOURCE"
  102. set_wrapper_and_misc
  103. ;;
  104. e2fsprogs|util-linux|ash|irda-utils|ppp|dropbear|nullmailer|traceroute|libevent)
  105. echo_status "Enabling non-portable GNU and BSD features."
  106. var_append CC_WRAPPER_INSERT " " "-D_GNU_SOURCE -D_BSD_SOURCE"
  107. set_wrapper_and_misc
  108. ;;
  109. nvi)
  110. echo_status "Enabling non-portable GNU, BSD features and types."
  111. var_append CC_WRAPPER_INSERT " " "-D_GNU_SOURCE -D_BSD_SOURCE"
  112. var_append CC_WRAPPER_INSERT " " "-D__BIT_TYPES_DEFINED__"
  113. set_wrapper_and_misc
  114. ;;
  115. iproute2)
  116. echo_status "Setting __GLIBC__=3 to build the package!"
  117. var_append CC_WRAPPER_INSERT " " "-D__GLIBC__=3"
  118. set_wrapper_and_misc
  119. ;;
  120. net-tools)
  121. echo_status "Enabling non-portable GNU, BSD features and a lot of other tweaks."
  122. var_append CC_WRAPPER_INSERT " " "-D_GNU_SOURCE -D_BSD_SOURCE"
  123. var_append CC_WRAPPER_INSERT " " "-D__GLIBC__"
  124. var_append CC_WRAPPER_INSERT " " "-D_LINUX_IN6_H"
  125. set_wrapper_and_misc
  126. ;;
  127. #squid)
  128. #var_append CC_WRAPPER_INSERT " " "-DHAVE_SYS_TIME_H"
  129. #set_wrapper_and_misc
  130. # ;;
  131. *)
  132. echo_status "Using default dietlibc options!"
  133. set_wrapper_and_misc
  134. ;;
  135. esac
  136. case "$pkg" in
  137. sed|lilo|findutils|net-tools|dropbear|udev|rng-tools|udhcp|psmisc|busybox|e2fsprogs|nbd)
  138. add_lib "-lcompat"
  139. ;;
  140. coreutils)
  141. add_lib "-lcompat"
  142. var_remove patchfiles " " "*acl-xattr.patch"
  143. ;;
  144. ncurses)
  145. var_append extraconfopt " " \
  146. "--without-cxx-binding --without-cxx"
  147. ;;
  148. util-linux)
  149. add_lib "-lrpc -lcompat"
  150. ;;
  151. dump)
  152. var_append extraconfopt " " "--disable-rmt"
  153. ;;
  154. perl)
  155. add_lib "-lm -lcompat"
  156. ;;
  157. openssl|gettext)
  158. remove_lib "-ldl"
  159. ;;
  160. iptables)
  161. add_lib "-lrpc"
  162. ;;
  163. grsecurity)
  164. var_append makeopt " " "nopam"
  165. ;;
  166. procps)
  167. if [ "$diet_dynamic_static" == "static" ]; then
  168. var_append makeopt ' ' 'SHARED=0'
  169. var_append makeinstopt ' ' 'SHARED=0'
  170. fi
  171. ;;
  172. esac
  173. var_append patchfiles " " \
  174. `ls $base/package/base/dietlibc/patches/pkg_$pkg.patch 2>/dev/null`
  175. if ! atstage toolchain && [ "$SDECFG_LIBC" = "dietlibc" ]; then
  176. var_append patchfiles " " \
  177. `ls $base/package/base/dietlibc/patches/pkg_$pkg.chroot.patch 2>/dev/null`
  178. fi
  179. fi