scan-pkgs.sh 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. #
  4. # Scan host-tool prerequisites of certain packages before building.
  5. if test -z "$BASH_VERSION"; then
  6. foo=`$BASH -c 'echo "$BASH_VERSION"'`
  7. else
  8. foo=$BASH_VERSION
  9. fi
  10. if test -z "$foo"; then
  11. echo OpenADK requires GNU bash to be installed.
  12. exit 1
  13. fi
  14. test -z "$BASH_VERSION$KSH_VERSION" && exec $BASH $0 "$@"
  15. [[ -n $BASH_VERSION ]] && shopt -s extglob
  16. topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
  17. OStype=$(uname)
  18. out=0
  19. . $topdir/.config
  20. if [[ -n $ADK_NATIVE ]];then
  21. if [[ -n $ADK_PACKAGE_LIBIMAGEMAGICK ]];then
  22. NEED_JPEGDEV="$NEED_JPEGDEV libimagemagick"
  23. NEED_TIFFDEV="$NEED_TIFFDEV libimagemagick"
  24. fi
  25. if [[ -n $ADK_PACKAGE_DISPLAY ]];then
  26. NEED_X11DEV="$NEED_X11DEV display"
  27. NEED_XEXTDEV="$NEED_XEXTDEV display"
  28. fi
  29. if [[ -n $ADK_PACKAGE_GIT ]];then
  30. NEED_CURLDEV="$NEED_CURLDEV git"
  31. fi
  32. if [[ -n $ADK_TARGET_PACKAGE_RPM ]]; then
  33. NEED_RPM="$NEED_RPM rpm"
  34. fi
  35. if [[ -n $ADK_PACKAGE_WPA_SUPPLICANT_WITH_OPENSSL ]]; then
  36. NEED_LIBSSLDEV="$NEED_LIBSSLDEV wpa_supplicant"
  37. fi
  38. if [[ -n $ADK_PACKAGE_IW ]]; then
  39. NEED_LIBNLDEV="$NEED_LIBNLDEV iw"
  40. fi
  41. fi
  42. if [[ -n $ADK_PACKAGE_GPSD ]]; then
  43. NEED_PYTHON="$NEED_PYTHON gpsd"
  44. fi
  45. if [[ -n $ADK_PACKAGE_FIREFOX ]]; then
  46. NEED_ZIP="$NEED_ZIP firefox"
  47. NEED_LIBIDL="$NEED_LIBIDL firefox"
  48. NEED_PYTHON="$NEED_PYTHON firefox"
  49. fi
  50. if [[ -n $ADK_COMPILE_HEIMDAL ]]; then
  51. NEED_BISON="$NEED_BISON heimdal-server"
  52. fi
  53. if [[ -n $ADK_COMPILE_PCMCIAUTILS ]]; then
  54. NEED_BISON="$NEED_BISON pcmciautils"
  55. NEED_FLEX="$NEED_FLEX pcmciautils"
  56. fi
  57. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  58. NEED_XKBCOMP="$NEED_XKBCOMP xkeyboard-config"
  59. fi
  60. if [[ -n $ADK_COMPILE_AUTOCONF ]]; then
  61. NEED_M4="$NEED_M4 autoconf"
  62. fi
  63. if [[ -n $ADK_COMPILE_AUTOMAKE ]]; then
  64. NEED_AUTOCONF="$NEED_AUTOCONF automake"
  65. fi
  66. if [[ -n $ADK_PACKAGE_SQUID ]]; then
  67. NEED_GXX="$NEED_GXX squid"
  68. fi
  69. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  70. NEED_INTL="$NEED_INTL xkeyboard-config"
  71. fi
  72. if [[ -n $ADK_PACKAGE_LIBPCAP ]]; then
  73. NEED_FLEX="$NEED_FLEX libpcap"
  74. NEED_BISON="$NEED_BISON libpcap"
  75. fi
  76. if [[ -n $ADK_PACKAGE_LIBXFONT ]]; then
  77. NEED_WWW="$NEED_WWW libXfont"
  78. NEED_XMLTO="$NEED_XMLTO libXfont"
  79. fi
  80. if [[ -n $ADK_PACKAGE_EGLIBC ]]; then
  81. NEED_GPERF="$NEED_GPERF eglibc"
  82. fi
  83. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_100DPI ]]; then
  84. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
  85. fi
  86. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_75DPI ]]; then
  87. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
  88. fi
  89. if [[ -n $ADK_PACKAGE_FONT_ADOBE_100DPI ]]; then
  90. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
  91. fi
  92. if [[ -n $ADK_PACKAGE_FONT_ADOBE_75DPI ]]; then
  93. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
  94. fi
  95. if [[ -n $NEED_GETTEXT ]]; then
  96. if ! which gettext >/dev/null 2>&1; then
  97. echo >&2 You need gettext to build $NEED_GETTEXT
  98. out=1
  99. # elif ! which msgfmt >/dev/null 2>&1; then
  100. # echo >&2 You need msgfmt to build $NEED_GETTEXT
  101. # out=1
  102. fi
  103. fi
  104. if [[ -n $NEED_CURLDEV ]];then
  105. if ! test -f /usr/include/curl/curl.h >/dev/null; then
  106. if ! test -f /usr/local/include/curl/curl.h >/dev/null; then
  107. echo >&2 You need curl headers to build $NEED_CURLDEV
  108. out=1
  109. fi
  110. fi
  111. fi
  112. if [[ -n $NEED_TIFFDEV ]];then
  113. if ! test -f /usr/include/tiff.h >/dev/null; then
  114. echo >&2 You need tiff headers to build $NEED_TIFFDEV
  115. out=1
  116. fi
  117. fi
  118. if [[ -n $NEED_JPEGDEV ]];then
  119. if ! test -f /usr/include/jpeglib.h >/dev/null; then
  120. echo >&2 You need jpeg headers to build $NEED_JPEGDEV
  121. out=1
  122. fi
  123. fi
  124. if [[ -n $NEED_LIBNLDEV ]];then
  125. if ! test -f /usr/include/netlink/netlink.h >/dev/null; then
  126. echo >&2 You need libnl headers to build $NEED_LIBNLDEV
  127. out=1
  128. fi
  129. fi
  130. if [[ -n $NEED_X11DEV ]];then
  131. if ! test -f /usr/include/X11/Xlib.h >/dev/null; then
  132. echo >&2 You need X11 headers to build $NEED_X11DEV
  133. out=1
  134. fi
  135. fi
  136. if [[ -n $NEED_XEXTDEV ]];then
  137. if ! test -f /usr/include/X11/extensions/XShm.h >/dev/null; then
  138. echo >&2 You need X11 extensions headers to build $NEED_XEXTDEV
  139. out=1
  140. fi
  141. fi
  142. if [[ -n $NEED_LIBSSLDEV ]]; then
  143. if ! test -f /usr/include/openssl/ssl.h >/dev/null; then
  144. echo >&2 You need openssl headers to build $NEED_LIBSSLDEV
  145. out=1
  146. fi
  147. fi
  148. if [[ -n $NEED_MKFONTDIR ]]; then
  149. if ! which mkfontdir >/dev/null 2>&1; then
  150. echo >&2 You need mkfontdir to build $NEED_MKFONTDIR
  151. out=1
  152. fi
  153. fi
  154. if [[ -n $NEED_M4 ]]; then
  155. if ! which m4 >/dev/null 2>&1; then
  156. echo >&2 You need GNU m4 to build $NEED_M4
  157. out=1
  158. fi
  159. fi
  160. if [[ -n $NEED_AUTOCONF ]]; then
  161. if ! which autoconf >/dev/null 2>&1; then
  162. echo >&2 You need autoconf to build $NEED_AUTOCONF
  163. out=1
  164. fi
  165. fi
  166. if [[ -n $NEED_INTL ]]; then
  167. if ! which intltool-update >/dev/null 2>&1; then
  168. echo >&2 You need intltool to build $NEED_INTL
  169. out=1
  170. fi
  171. fi
  172. if [[ -n $NEED_WWW ]]; then
  173. if ! which w3m >/dev/null 2>&1; then
  174. if ! which lynx >/dev/null 2>&1; then
  175. if ! which links >/dev/null 2>&1; then
  176. echo >&2 You need w3m/links/lynx to build $NEED_WWW
  177. out=1
  178. fi
  179. fi
  180. fi
  181. fi
  182. if [[ -n $NEED_BISON ]]; then
  183. if ! which bison >/dev/null 2>&1; then
  184. echo >&2 You need bison to build $NEED_BISON
  185. out=1
  186. fi
  187. fi
  188. if [[ -n $NEED_ZIP ]]; then
  189. if ! which zip >/dev/null 2>&1; then
  190. echo >&2 You need zip to build $NEED_ZIP
  191. out=1
  192. fi
  193. fi
  194. if [[ -n $NEED_LIBIDL ]]; then
  195. if ! which libIDL-config-2 >/dev/null 2>&1; then
  196. echo >&2 You need libIDL-config-2 to build $NEED_LIBIDL
  197. out=1
  198. fi
  199. fi
  200. if [[ -n $NEED_GPERF ]]; then
  201. if ! which gperf >/dev/null 2>&1; then
  202. echo >&2 You need gperf to build $NEED_GPERF
  203. out=1
  204. fi
  205. fi
  206. if [[ -n $NEED_GXX ]]; then
  207. if ! which g++ >/dev/null 2>&1; then
  208. echo >&2 You need GNU c++ compiler to build $NEED_GXX
  209. out=1
  210. fi
  211. fi
  212. if [[ -n $NEED_RUBY ]]; then
  213. if ! which ruby >/dev/null 2>&1; then
  214. echo >&2 You need ruby to build $NEED_RUBY
  215. out=1
  216. fi
  217. fi
  218. if [[ -n $NEED_XKBCOMP ]]; then
  219. if ! which xkbcomp >/dev/null 2>&1; then
  220. echo >&2 You need xkbcomp to build $NEED_XKBCOMP
  221. out=1
  222. fi
  223. fi
  224. if [[ -n $NEED_RPM ]]; then
  225. if ! which rpmbuild >/dev/null 2>&1; then
  226. echo >&2 You need rpmbuild to to use $NEED_RPM package backend
  227. out=1
  228. fi
  229. fi
  230. if [[ -n $NEED_FLEX ]]; then
  231. if ! which flex >/dev/null 2>&1; then
  232. echo >&2 You need flex to to use $NEED_FLEX package
  233. out=1
  234. fi
  235. fi
  236. if [[ -n $NEED_PYTHON ]]; then
  237. if ! which python >/dev/null 2>&1; then
  238. if ! test -x /usr/pkg/bin/python2.6 >/dev/null; then
  239. echo >&2 You need python to to use $NEED_PYTHON package
  240. out=1
  241. fi
  242. fi
  243. fi
  244. exit $out