1
0

scan-pkgs.sh 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  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_NEON ]];then
  22. NEED_LIBXML2_DEV="$NEED_LIBXML2_DEV neon"
  23. fi
  24. if [[ -n $ADK_PACKAGE_LZOP ]];then
  25. NEED_LZODEV="$NEED_LZODEV lzop"
  26. fi
  27. if [[ -n $ADK_PACKAGE_LIBIMAGEMAGICK ]];then
  28. NEED_JPEGDEV="$NEED_JPEGDEV libimagemagick"
  29. NEED_TIFFDEV="$NEED_TIFFDEV libimagemagick"
  30. fi
  31. if [[ -n $ADK_PACKAGE_DISPLAY ]];then
  32. NEED_X11DEV="$NEED_X11DEV display"
  33. NEED_XEXTDEV="$NEED_XEXTDEV display"
  34. fi
  35. if [[ -n $ADK_PACKAGE_GIT ]];then
  36. NEED_CURLDEV="$NEED_CURLDEV git"
  37. fi
  38. if [[ -n $ADK_TARGET_PACKAGE_RPM ]]; then
  39. NEED_RPM="$NEED_RPM rpm"
  40. fi
  41. if [[ -n $ADK_PACKAGE_WPA_SUPPLICANT_WITH_OPENSSL ]]; then
  42. NEED_LIBSSLDEV="$NEED_LIBSSLDEV wpa_supplicant"
  43. fi
  44. if [[ -n $ADK_COMPILE_BIND ]]; then
  45. NEED_LIBSSLDEV="$NEED_LIBSSLDEV bind"
  46. fi
  47. if [[ -n $ADK_PACKAGE_IW ]]; then
  48. NEED_LIBNLDEV="$NEED_LIBNLDEV iw"
  49. fi
  50. if [[ -n $ADK_PACKAGE_NFS_UTILS_WITH_KERBEROS ]]; then
  51. NEED_LIBKRB5DEV="$NEED_LIBKRB5DEV nfs-utils"
  52. fi
  53. if [[ -n $ADK_PACKAGE_NFS_UTILS_WITH_TIRPC ]]; then
  54. NEED_LIBTIRPCDEV="$NEED_LIBTIRPCDEV nfs-utils"
  55. fi
  56. fi
  57. if [[ -n $ADK_PACKAGE_GPSD ]]; then
  58. NEED_PYTHON="$NEED_PYTHON gpsd"
  59. fi
  60. if [[ -n $ADK_PACKAGE_FIREFOX ]]; then
  61. NEED_LIBIDL="$NEED_LIBIDL firefox"
  62. NEED_PYTHON="$NEED_PYTHON firefox"
  63. fi
  64. if [[ -n $ADK_COMPILE_HEIMDAL ]]; then
  65. NEED_BISON="$NEED_BISON heimdal-server"
  66. fi
  67. if [[ -n $ADK_COMPILE_KRB5 ]]; then
  68. NEED_BISON="$NEED_BISON krb5"
  69. fi
  70. if [[ -n $ADK_PACKAGE_LIBXCB ]]; then
  71. NEED_XSLTPROC="$NEED_XSLTPROC libxcb"
  72. fi
  73. if [[ -n $ADK_COMPILE_PCMCIAUTILS ]]; then
  74. NEED_BISON="$NEED_BISON pcmciautils"
  75. NEED_FLEX="$NEED_FLEX pcmciautils"
  76. fi
  77. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  78. NEED_XKBCOMP="$NEED_XKBCOMP xkeyboard-config"
  79. fi
  80. if [[ -n $ADK_COMPILE_AUTOCONF ]]; then
  81. NEED_M4="$NEED_M4 autoconf"
  82. fi
  83. if [[ -n $ADK_COMPILE_AUTOMAKE ]]; then
  84. NEED_AUTOCONF="$NEED_AUTOCONF automake"
  85. fi
  86. if [[ -n $ADK_PACKAGE_SQUID ]]; then
  87. NEED_GXX="$NEED_GXX squid"
  88. fi
  89. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  90. NEED_INTL="$NEED_INTL xkeyboard-config"
  91. fi
  92. if [[ -n $ADK_PACKAGE_LIBPCAP ]]; then
  93. NEED_FLEX="$NEED_FLEX libpcap"
  94. NEED_BISON="$NEED_BISON libpcap"
  95. fi
  96. if [[ -n $ADK_PACKAGE_LIBXFONT ]]; then
  97. NEED_WWW="$NEED_WWW libXfont"
  98. NEED_XMLTO="$NEED_XMLTO libXfont"
  99. fi
  100. if [[ -n $ADK_PACKAGE_EGLIBC ]]; then
  101. NEED_GPERF="$NEED_GPERF eglibc"
  102. fi
  103. if [[ -n $ADK_PACKAGE_GLIB ]]; then
  104. NEED_GETTEXT="$NEED_GETTEXT glib"
  105. fi
  106. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_100DPI ]]; then
  107. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
  108. fi
  109. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_75DPI ]]; then
  110. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
  111. fi
  112. if [[ -n $ADK_PACKAGE_FONT_ADOBE_100DPI ]]; then
  113. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
  114. fi
  115. if [[ -n $ADK_PACKAGE_FONT_ADOBE_75DPI ]]; then
  116. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
  117. fi
  118. if [[ -n $NEED_GETTEXT ]]; then
  119. if ! which gettext >/dev/null 2>&1; then
  120. echo >&2 You need gettext to build $NEED_GETTEXT
  121. out=1
  122. elif ! which msgfmt >/dev/null 2>&1; then
  123. echo >&2 You need msgfmt to build $NEED_GETTEXT
  124. out=1
  125. fi
  126. fi
  127. if [[ -n $NEED_LIBTIRPCDEV ]];then
  128. if ! test -f /usr/include/tirpc/netconfig.h >/dev/null; then
  129. echo >&2 You need tirpc headers to build $NEED_LIBTIRPCDEV
  130. out=1
  131. fi
  132. fi
  133. if [[ -n $NEED_LIBXML2_DEV ]];then
  134. if ! test -f /usr/include/libxml2/libxml/xmlversion.h >/dev/null; then
  135. echo >&2 You need libxml2 headers to build $NEED_LIBXML2_DEV
  136. out=1
  137. fi
  138. fi
  139. if [[ -n $NEED_LIBKRB5DEV ]];then
  140. if ! test -f /usr/include/krb5.h >/dev/null; then
  141. echo >&2 You need krb5 headers to build $NEED_LIBKRB5DEV
  142. out=1
  143. fi
  144. fi
  145. if [[ -n $NEED_CURLDEV ]];then
  146. if ! test -f /usr/include/curl/curl.h >/dev/null; then
  147. if ! test -f /usr/local/include/curl/curl.h >/dev/null; then
  148. echo >&2 You need curl headers to build $NEED_CURLDEV
  149. out=1
  150. fi
  151. fi
  152. fi
  153. if [[ -n $NEED_TIFFDEV ]];then
  154. if ! test -f /usr/include/tiff.h >/dev/null; then
  155. echo >&2 You need libtiff headers to build $NEED_TIFFDEV
  156. out=1
  157. fi
  158. fi
  159. if [[ -n $NEED_JPEGDEV ]];then
  160. if ! test -f /usr/include/jpeglib.h >/dev/null; then
  161. echo >&2 You need libjpeg headers to build $NEED_JPEGDEV
  162. out=1
  163. fi
  164. fi
  165. if [[ -n $NEED_LZODEV ]];then
  166. if ! test -f /usr/include/lzo/lzo1.h >/dev/null; then
  167. echo >&2 You need liblzo headers to build $NEED_LZODEV
  168. out=1
  169. fi
  170. fi
  171. if [[ -n $NEED_LIBNLDEV ]];then
  172. if ! test -f /usr/include/netlink/netlink.h >/dev/null; then
  173. echo >&2 You need libnl headers to build $NEED_LIBNLDEV
  174. out=1
  175. fi
  176. fi
  177. if [[ -n $NEED_X11DEV ]];then
  178. if ! test -f /usr/include/X11/Xlib.h >/dev/null; then
  179. echo >&2 You need X11 headers to build $NEED_X11DEV
  180. out=1
  181. fi
  182. fi
  183. if [[ -n $NEED_XEXTDEV ]];then
  184. if ! test -f /usr/include/X11/extensions/XShm.h >/dev/null; then
  185. echo >&2 You need X11 extensions headers to build $NEED_XEXTDEV
  186. out=1
  187. fi
  188. fi
  189. if [[ -n $NEED_LIBSSLDEV ]]; then
  190. if ! test -f /usr/include/openssl/ssl.h >/dev/null; then
  191. echo >&2 You need openssl headers to build $NEED_LIBSSLDEV
  192. out=1
  193. fi
  194. fi
  195. if [[ -n $NEED_MKFONTDIR ]]; then
  196. if ! which mkfontdir >/dev/null 2>&1; then
  197. echo >&2 You need mkfontdir to build $NEED_MKFONTDIR
  198. out=1
  199. fi
  200. fi
  201. if [[ -n $NEED_M4 ]]; then
  202. if ! which m4 >/dev/null 2>&1; then
  203. echo >&2 You need GNU m4 to build $NEED_M4
  204. out=1
  205. fi
  206. fi
  207. if [[ -n $NEED_AUTOCONF ]]; then
  208. if ! which autoconf >/dev/null 2>&1; then
  209. echo >&2 You need autoconf to build $NEED_AUTOCONF
  210. out=1
  211. fi
  212. fi
  213. if [[ -n $NEED_INTL ]]; then
  214. if ! which intltool-update >/dev/null 2>&1; then
  215. echo >&2 You need intltool to build $NEED_INTL
  216. out=1
  217. fi
  218. fi
  219. if [[ -n $NEED_WWW ]]; then
  220. if ! which w3m >/dev/null 2>&1; then
  221. if ! which lynx >/dev/null 2>&1; then
  222. if ! which links >/dev/null 2>&1; then
  223. echo >&2 You need w3m/links/lynx to build $NEED_WWW
  224. out=1
  225. fi
  226. fi
  227. fi
  228. fi
  229. if [[ -n $NEED_BISON ]]; then
  230. if ! which bison >/dev/null 2>&1; then
  231. echo >&2 You need bison to build $NEED_BISON
  232. out=1
  233. fi
  234. fi
  235. if [[ -n $NEED_ZIP ]]; then
  236. if ! which zip >/dev/null 2>&1; then
  237. echo >&2 You need zip to build $NEED_ZIP
  238. out=1
  239. fi
  240. fi
  241. if [[ -n $NEED_LIBIDL ]]; then
  242. if ! which libIDL-config-2 >/dev/null 2>&1; then
  243. echo >&2 You need libIDL-config-2 to build $NEED_LIBIDL
  244. out=1
  245. fi
  246. fi
  247. if [[ -n $NEED_GPERF ]]; then
  248. if ! which gperf >/dev/null 2>&1; then
  249. echo >&2 You need gperf to build $NEED_GPERF
  250. out=1
  251. fi
  252. fi
  253. if [[ -n $NEED_GXX ]]; then
  254. if ! which g++ >/dev/null 2>&1; then
  255. echo >&2 You need GNU c++ compiler to build $NEED_GXX
  256. out=1
  257. fi
  258. fi
  259. if [[ -n $NEED_RUBY ]]; then
  260. if ! which ruby >/dev/null 2>&1; then
  261. echo >&2 You need ruby to build $NEED_RUBY
  262. out=1
  263. fi
  264. fi
  265. if [[ -n $NEED_XKBCOMP ]]; then
  266. if ! which xkbcomp >/dev/null 2>&1; then
  267. echo >&2 You need xkbcomp to build $NEED_XKBCOMP
  268. out=1
  269. fi
  270. fi
  271. if [[ -n $NEED_RPM ]]; then
  272. if ! which rpmbuild >/dev/null 2>&1; then
  273. echo >&2 You need rpmbuild to to use $NEED_RPM package backend
  274. out=1
  275. fi
  276. fi
  277. if [[ -n $NEED_FLEX ]]; then
  278. if ! which flex >/dev/null 2>&1; then
  279. echo >&2 You need flex to build $NEED_FLEX
  280. out=1
  281. fi
  282. fi
  283. if [[ -n $NEED_XSLTPROC ]]; then
  284. if ! which xsltproc >/dev/null 2>&1; then
  285. echo >&2 You need xsltproc to build $NEED_XSLTPROC
  286. out=1
  287. fi
  288. fi
  289. if [[ -n $NEED_PYTHON ]]; then
  290. if ! which python >/dev/null 2>&1; then
  291. if ! test -x /usr/pkg/bin/python2.6 >/dev/null; then
  292. echo >&2 You need python to build $NEED_PYTHON
  293. out=1
  294. fi
  295. fi
  296. fi
  297. if [[ -n $ADK_USE_CCACHE ]]; then
  298. if ! which ccache >/dev/null 2>&1; then
  299. echo >&2 You have selected to build with ccache, but ccache could not be found.
  300. out=1
  301. fi
  302. fi
  303. exit $out