scan-pkgs.sh 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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_GLIB ]]; then
  73. NEED_GLIBZWO="$NEED_GLIBZWO glib"
  74. NEED_GETTEXT="$NEED_GETTEXT glib"
  75. fi
  76. if [[ -n $ADK_PACKAGE_LIBPCAP ]]; then
  77. NEED_FLEX="$NEED_FLEX libpcap"
  78. NEED_BISON="$NEED_BISON libpcap"
  79. fi
  80. if [[ -n $ADK_PACKAGE_LIBXFONT ]]; then
  81. NEED_WWW="$NEED_WWW libXfont"
  82. NEED_XMLTO="$NEED_XMLTO libXfont"
  83. fi
  84. if [[ -n $ADK_PACKAGE_EGLIBC ]]; then
  85. NEED_GPERF="$NEED_GPERF eglibc"
  86. fi
  87. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_100DPI ]]; then
  88. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
  89. fi
  90. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_75DPI ]]; then
  91. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
  92. fi
  93. if [[ -n $ADK_PACKAGE_FONT_ADOBE_100DPI ]]; then
  94. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
  95. fi
  96. if [[ -n $ADK_PACKAGE_FONT_ADOBE_75DPI ]]; then
  97. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
  98. fi
  99. if [[ -n $NEED_GETTEXT ]]; then
  100. if ! which gettext >/dev/null 2>&1; then
  101. echo >&2 You need gettext to build $NEED_GETTEXT
  102. out=1
  103. # elif ! which msgfmt >/dev/null 2>&1; then
  104. # echo >&2 You need msgfmt to build $NEED_GETTEXT
  105. # out=1
  106. fi
  107. fi
  108. if [[ -n $NEED_CURLDEV ]];then
  109. if ! test -f /usr/include/curl/curl.h >/dev/null; then
  110. if ! test -f /usr/local/include/curl/curl.h >/dev/null; then
  111. echo >&2 You need curl headers to build $NEED_CURLDEV
  112. out=1
  113. fi
  114. fi
  115. fi
  116. if [[ -n $NEED_TIFFDEV ]];then
  117. if ! test -f /usr/include/tiff.h >/dev/null; then
  118. echo >&2 You need tiff headers to build $NEED_TIFFDEV
  119. out=1
  120. fi
  121. fi
  122. if [[ -n $NEED_JPEGDEV ]];then
  123. if ! test -f /usr/include/jpeglib.h >/dev/null; then
  124. echo >&2 You need jpeg headers to build $NEED_JPEGDEV
  125. out=1
  126. fi
  127. fi
  128. if [[ -n $NEED_LIBNLDEV ]];then
  129. if ! test -f /usr/include/netlink/netlink.h >/dev/null; then
  130. echo >&2 You need libnl headers to build $NEED_LIBNLDEV
  131. out=1
  132. fi
  133. fi
  134. if [[ -n $NEED_X11DEV ]];then
  135. if ! test -f /usr/include/X11/Xlib.h >/dev/null; then
  136. echo >&2 You need X11 headers to build $NEED_X11DEV
  137. out=1
  138. fi
  139. fi
  140. if [[ -n $NEED_XEXTDEV ]];then
  141. if ! test -f /usr/include/X11/extensions/XShm.h >/dev/null; then
  142. echo >&2 You need X11 extensions headers to build $NEED_XEXTDEV
  143. out=1
  144. fi
  145. fi
  146. if [[ -n $NEED_LIBSSLDEV ]]; then
  147. if ! test -f /usr/include/openssl/ssl.h >/dev/null; then
  148. echo >&2 You need openssl headers to build $NEED_LIBSSLDEV
  149. out=1
  150. fi
  151. fi
  152. if [[ -n $NEED_MKFONTDIR ]]; then
  153. if ! which mkfontdir >/dev/null 2>&1; then
  154. echo >&2 You need mkfontdir to build $NEED_MKFONTDIR
  155. out=1
  156. fi
  157. fi
  158. if [[ -n $NEED_M4 ]]; then
  159. if ! which m4 >/dev/null 2>&1; then
  160. echo >&2 You need GNU m4 to build $NEED_M4
  161. out=1
  162. fi
  163. fi
  164. if [[ -n $NEED_AUTOCONF ]]; then
  165. if ! which autoconf >/dev/null 2>&1; then
  166. echo >&2 You need autoconf to build $NEED_AUTOCONF
  167. out=1
  168. fi
  169. fi
  170. if [[ -n $NEED_INTL ]]; then
  171. if ! which intltool-update >/dev/null 2>&1; then
  172. echo >&2 You need intltool to build $NEED_INTL
  173. out=1
  174. fi
  175. fi
  176. if [[ -n $NEED_WWW ]]; then
  177. if ! which w3m >/dev/null 2>&1; then
  178. if ! which lynx >/dev/null 2>&1; then
  179. if ! which links >/dev/null 2>&1; then
  180. echo >&2 You need w3m/links/lynx to build $NEED_WWW
  181. out=1
  182. fi
  183. fi
  184. fi
  185. fi
  186. if [[ -n $NEED_BISON ]]; then
  187. if ! which bison >/dev/null 2>&1; then
  188. echo >&2 You need bison to build $NEED_BISON
  189. out=1
  190. fi
  191. fi
  192. if [[ -n $NEED_ZIP ]]; then
  193. if ! which zip >/dev/null 2>&1; then
  194. echo >&2 You need zip to build $NEED_ZIP
  195. out=1
  196. fi
  197. fi
  198. if [[ -n $NEED_LIBIDL ]]; then
  199. if ! which libIDL-config-2 >/dev/null 2>&1; then
  200. echo >&2 You need libIDL-config-2 to build $NEED_LIBIDL
  201. out=1
  202. fi
  203. fi
  204. if [[ -n $NEED_GPERF ]]; then
  205. if ! which gperf >/dev/null 2>&1; then
  206. echo >&2 You need gperf to build $NEED_GPERF
  207. out=1
  208. fi
  209. fi
  210. if [[ -n $NEED_GXX ]]; then
  211. if ! which g++ >/dev/null 2>&1; then
  212. echo >&2 You need GNU c++ compiler to build $NEED_GXX
  213. out=1
  214. fi
  215. fi
  216. if [[ -n $NEED_RUBY ]]; then
  217. if ! which ruby >/dev/null 2>&1; then
  218. echo >&2 You need ruby to build $NEED_RUBY
  219. out=1
  220. fi
  221. fi
  222. if [[ -n $NEED_XKBCOMP ]]; then
  223. if ! which xkbcomp >/dev/null 2>&1; then
  224. echo >&2 You need xkbcomp to build $NEED_XKBCOMP
  225. out=1
  226. fi
  227. fi
  228. if [[ -n $NEED_GLIBZWO ]]; then
  229. if ! which glib-genmarshal >/dev/null 2>&1; then
  230. echo >&2 You need libglib2.0-dev to build $NEED_GLIBZWO
  231. out=1
  232. fi
  233. fi
  234. if [[ -n $NEED_RPM ]]; then
  235. if ! which rpmbuild >/dev/null 2>&1; then
  236. echo >&2 You need rpmbuild to to use $NEED_RPM package backend
  237. out=1
  238. fi
  239. fi
  240. if [[ -n $NEED_FLEX ]]; then
  241. if ! which flex >/dev/null 2>&1; then
  242. echo >&2 You need flex to to use $NEED_FLEX package
  243. out=1
  244. fi
  245. fi
  246. if [[ -n $NEED_PYTHON ]]; then
  247. if ! which python >/dev/null 2>&1; then
  248. if ! test -x /usr/pkg/bin/python2.6 >/dev/null; then
  249. echo >&2 You need python to to use $NEED_PYTHON package
  250. out=1
  251. fi
  252. fi
  253. fi
  254. exit $out