scan-pkgs.sh 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  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_LIBX11 ]]; then
  58. NEED_X11="$NEED_X11 libx11"
  59. fi
  60. if [[ -n $ADK_PACKAGE_LIBNL ]]; then
  61. NEED_FLEX="$NEED_FLEX libnl"
  62. fi
  63. if [[ -n $ADK_PACKAGE_GPSD ]]; then
  64. NEED_PYTHON="$NEED_PYTHON gpsd"
  65. fi
  66. if [[ -n $ADK_PACKAGE_LIBVPX ]]; then
  67. NEED_YASM="$NEED_YASM libvpx"
  68. fi
  69. if [[ -n $ADK_COMPILE_ORBIT2 ]]; then
  70. NEED_LIBIDL="$NEED_LIBIDL orbit2"
  71. fi
  72. if [[ -n $ADK_PACKAGE_FIREFOX ]]; then
  73. NEED_YASM="$NEED_YASM firefox"
  74. NEED_LIBIDL="$NEED_LIBIDL firefox"
  75. NEED_ZIP="$NEED_ZIP firefox"
  76. fi
  77. if [[ -n $ADK_PACKAGE_MESALIB ]]; then
  78. NEED_MAKEDEPEND="$NEED_MAKEDEPEND mesalib"
  79. fi
  80. if [[ -n $ADK_COMPILE_HEIMDAL ]]; then
  81. NEED_BISON="$NEED_BISON heimdal-server"
  82. fi
  83. if [[ -n $ADK_COMPILE_KRB5 ]]; then
  84. NEED_BISON="$NEED_BISON krb5"
  85. fi
  86. if [[ -n $ADK_COMPILE_OPENJDK ]]; then
  87. NEED_ZIP="$NEED_ZIP openjdk"
  88. NEED_GXX="$NEED_GXX openjdk"
  89. NEED_XSLTPROC="$NEED_XSLTPROC openjdk"
  90. fi
  91. if [[ -n $ADK_COMPILE_OPENJDK ]]; then
  92. cd ${TOPDIR}/jtools; bash prereq.sh
  93. [ $? -ne 0 ] && out=1
  94. fi
  95. if [[ -n $ADK_COMPILE_OPENJDK7 ]]; then
  96. NEED_ZIP="$NEED_ZIP openjdk7"
  97. fi
  98. if [[ -n $ADK_COMPILE_OPENJDK7 ]]; then
  99. cd ${TOPDIR}/jtools; bash prereq.sh
  100. [ $? -ne 0 ] && out=1
  101. fi
  102. if [[ -n $ADK_PACKAGE_LIBXCB ]]; then
  103. NEED_XSLTPROC="$NEED_XSLTPROC libxcb"
  104. fi
  105. if [[ -n $ADK_COMPILE_PCMCIAUTILS ]]; then
  106. NEED_BISON="$NEED_BISON pcmciautils"
  107. NEED_FLEX="$NEED_FLEX pcmciautils"
  108. fi
  109. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  110. NEED_XKBCOMP="$NEED_XKBCOMP xkeyboard-config"
  111. fi
  112. if [[ -n $ADK_COMPILE_COROSYNC ]]; then
  113. NEED_GROFF="$NEED_GROFF corosync"
  114. fi
  115. if [[ -n $ADK_PACKAGE_SQUID ]]; then
  116. NEED_GXX="$NEED_GXX squid"
  117. fi
  118. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  119. NEED_INTL="$NEED_INTL xkeyboard-config"
  120. fi
  121. if [[ -n $ADK_PACKAGE_LIBPCAP ]]; then
  122. NEED_FLEX="$NEED_FLEX libpcap"
  123. NEED_BISON="$NEED_BISON libpcap"
  124. fi
  125. if [[ -n $ADK_PACKAGE_LIBXFONT ]]; then
  126. NEED_WWW="$NEED_WWW libXfont"
  127. NEED_XMLTO="$NEED_XMLTO libXfont"
  128. fi
  129. if [[ -n $ADK_PACKAGE_PACEMAKER_MGMTD ]]; then
  130. NEED_SWIG="$NEED_SWIG pacemaker-mgmtd"
  131. fi
  132. if [[ -n $ADK_PACKAGE_EGLIBC ]]; then
  133. NEED_GPERF="$NEED_GPERF eglibc"
  134. fi
  135. if [[ -n $ADK_PACKAGE_GLIB ]]; then
  136. NEED_GETTEXT="$NEED_GETTEXT glib"
  137. fi
  138. if [[ -n $ADK_PACKAGE_BCM2835_VC ]]; then
  139. NEED_CMAKE="$NEED_CMAKE bcm2835-vc"
  140. fi
  141. if [[ -n $ADK_PACKAGE_YAJL ]]; then
  142. NEED_RUBY="$NEED_RUBY yajl"
  143. NEED_CMAKE="$NEED_CMAKE yajl"
  144. fi
  145. if [[ -n $ADK_PACKAGE_XBMC ]]; then
  146. NEED_SDLDEV="$NEED_SDLDEV xbmc"
  147. NEED_SDLIMAGEDEV="$NEED_SDLIMAGEDEV xbmc"
  148. fi
  149. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_100DPI ]]; then
  150. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
  151. fi
  152. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_75DPI ]]; then
  153. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
  154. fi
  155. if [[ -n $ADK_PACKAGE_FONT_ADOBE_100DPI ]]; then
  156. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
  157. fi
  158. if [[ -n $ADK_PACKAGE_FONT_ADOBE_75DPI ]]; then
  159. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
  160. fi
  161. if [[ -n $NEED_GETTEXT ]]; then
  162. if ! which gettext >/dev/null 2>&1; then
  163. echo >&2 You need gettext to build $NEED_GETTEXT
  164. out=1
  165. elif ! which msgfmt >/dev/null 2>&1; then
  166. echo >&2 You need msgfmt to build $NEED_GETTEXT
  167. out=1
  168. fi
  169. fi
  170. if [[ -n $NEED_LIBTIRPCDEV ]];then
  171. if ! test -f /usr/include/tirpc/netconfig.h >/dev/null; then
  172. echo >&2 You need tirpc headers to build $NEED_LIBTIRPCDEV
  173. out=1
  174. fi
  175. fi
  176. if [[ -n $NEED_LIBXML2_DEV ]];then
  177. if ! test -f /usr/include/libxml2/libxml/xmlversion.h >/dev/null; then
  178. echo >&2 You need libxml2 headers to build $NEED_LIBXML2_DEV
  179. out=1
  180. fi
  181. fi
  182. if [[ -n $NEED_LIBKRB5DEV ]];then
  183. if ! test -f /usr/include/krb5.h >/dev/null; then
  184. echo >&2 You need krb5 headers to build $NEED_LIBKRB5DEV
  185. out=1
  186. fi
  187. fi
  188. if [[ -n $NEED_CURLDEV ]];then
  189. if ! test -f /usr/include/curl/curl.h >/dev/null; then
  190. if ! test -f /usr/local/include/curl/curl.h >/dev/null; then
  191. echo >&2 You need curl headers to build $NEED_CURLDEV
  192. out=1
  193. fi
  194. fi
  195. fi
  196. if [[ -n $NEED_TIFFDEV ]];then
  197. if ! test -f /usr/include/tiff.h >/dev/null; then
  198. echo >&2 You need libtiff headers to build $NEED_TIFFDEV
  199. out=1
  200. fi
  201. fi
  202. if [[ -n $NEED_SDLDEV ]];then
  203. if ! test -f /usr/include/SDL/SDL.h >/dev/null; then
  204. echo >&2 You need libSDL headers to build $NEED_SDLDEV
  205. out=1
  206. fi
  207. fi
  208. if [[ -n $NEED_SDLIMAGEDEV ]];then
  209. if ! test -f /usr/include/SDL/SDL_image.h >/dev/null; then
  210. echo >&2 You need libSDL-image headers to build $NEED_SDLIMAGEDEV
  211. out=1
  212. fi
  213. fi
  214. if [[ -n $NEED_JPEGDEV ]];then
  215. if ! test -f /usr/include/jpeglib.h >/dev/null; then
  216. echo >&2 You need libjpeg headers to build $NEED_JPEGDEV
  217. out=1
  218. fi
  219. fi
  220. if [[ -n $NEED_LZODEV ]];then
  221. if ! test -f /usr/include/lzo/lzo1.h >/dev/null; then
  222. echo >&2 You need liblzo headers to build $NEED_LZODEV
  223. out=1
  224. fi
  225. fi
  226. if [[ -n $NEED_LIBNLDEV ]];then
  227. if ! test -f /usr/include/netlink/netlink.h >/dev/null; then
  228. echo >&2 You need libnl headers to build $NEED_LIBNLDEV
  229. out=1
  230. fi
  231. fi
  232. if [[ -n $NEED_X11DEV ]];then
  233. if ! test -f /usr/include/X11/Xlib.h >/dev/null; then
  234. echo >&2 You need X11 headers to build $NEED_X11DEV
  235. out=1
  236. fi
  237. fi
  238. if [[ -n $NEED_X11 ]];then
  239. if ! test -f /usr/include/X11/X.h >/dev/null; then
  240. if ! test -f /usr/local/include/X11/X.h >/dev/null; then
  241. echo >&2 You need X11 headers to build $NEED_X11
  242. out=1
  243. fi
  244. fi
  245. fi
  246. if [[ -n $NEED_XEXTDEV ]];then
  247. if ! test -f /usr/include/X11/extensions/XShm.h >/dev/null; then
  248. echo >&2 You need X11 extensions headers to build $NEED_XEXTDEV
  249. out=1
  250. fi
  251. fi
  252. if [[ -n $NEED_LIBSSLDEV ]]; then
  253. if ! test -f /usr/include/openssl/ssl.h >/dev/null; then
  254. echo >&2 You need openssl headers to build $NEED_LIBSSLDEV
  255. out=1
  256. fi
  257. fi
  258. if [[ -n $NEED_GROFF ]]; then
  259. if ! which groff >/dev/null 2>&1; then
  260. echo >&2 You need groff to build $NEED_GROFF
  261. out=1
  262. fi
  263. fi
  264. if [[ -n $NEED_MKFONTDIR ]]; then
  265. if ! which mkfontdir >/dev/null 2>&1; then
  266. echo >&2 You need mkfontdir to build $NEED_MKFONTDIR
  267. out=1
  268. fi
  269. fi
  270. if [[ -n $NEED_INTL ]]; then
  271. if ! which intltool-update >/dev/null 2>&1; then
  272. echo >&2 You need intltool to build $NEED_INTL
  273. out=1
  274. fi
  275. fi
  276. if [[ -n $NEED_WWW ]]; then
  277. if ! which w3m >/dev/null 2>&1; then
  278. if ! which lynx >/dev/null 2>&1; then
  279. if ! which links >/dev/null 2>&1; then
  280. echo >&2 You need w3m/links/lynx to build $NEED_WWW
  281. out=1
  282. fi
  283. fi
  284. fi
  285. fi
  286. if [[ -n $NEED_BISON ]]; then
  287. if ! which bison >/dev/null 2>&1; then
  288. echo >&2 You need bison to build $NEED_BISON
  289. out=1
  290. fi
  291. fi
  292. if [[ -n $NEED_CMAKE ]]; then
  293. if ! which cmake >/dev/null 2>&1; then
  294. echo >&2 You need cmake to build $NEED_CMAKE
  295. out=1
  296. fi
  297. fi
  298. if [[ -n $NEED_ZIP ]]; then
  299. if ! which zip >/dev/null 2>&1; then
  300. echo >&2 You need zip to build $NEED_ZIP
  301. out=1
  302. fi
  303. fi
  304. if [[ -n $NEED_LIBIDL ]]; then
  305. if ! which libIDL-config-2 >/dev/null 2>&1; then
  306. echo >&2 You need libIDL-config-2 to build $NEED_LIBIDL
  307. out=1
  308. fi
  309. fi
  310. if [[ -n $NEED_SWIG ]]; then
  311. if ! which swig >/dev/null 2>&1; then
  312. echo >&2 You need swig to build $NEED_SWIG
  313. out=1
  314. fi
  315. fi
  316. if [[ -n $NEED_GPERF ]]; then
  317. if ! which gperf >/dev/null 2>&1; then
  318. echo >&2 You need gperf to build $NEED_GPERF
  319. out=1
  320. fi
  321. fi
  322. if [[ -n $NEED_GXX ]]; then
  323. if ! which g++ >/dev/null 2>&1; then
  324. echo >&2 You need GNU c++ compiler to build $NEED_GXX
  325. out=1
  326. fi
  327. fi
  328. if [[ -n $NEED_RUBY ]]; then
  329. if ! which ruby >/dev/null 2>&1; then
  330. echo >&2 You need ruby to build $NEED_RUBY
  331. out=1
  332. fi
  333. fi
  334. if [[ -n $NEED_XKBCOMP ]]; then
  335. if ! which xkbcomp >/dev/null 2>&1; then
  336. echo >&2 You need xkbcomp to build $NEED_XKBCOMP
  337. out=1
  338. fi
  339. fi
  340. if [[ -n $NEED_RPM ]]; then
  341. if ! which rpmbuild >/dev/null 2>&1; then
  342. echo >&2 You need rpmbuild to to use $NEED_RPM package backend
  343. out=1
  344. fi
  345. fi
  346. if [[ -n $NEED_FLEX ]]; then
  347. if ! which flex >/dev/null 2>&1; then
  348. echo >&2 You need flex to build $NEED_FLEX
  349. out=1
  350. fi
  351. fi
  352. if [[ -n $ADK_LINUX_X86 ]]; then
  353. if [[ -n $NEED_YASM ]]; then
  354. if ! which yasm >/dev/null 2>&1; then
  355. echo >&2 You need yasm to build $NEED_YASM
  356. out=1
  357. fi
  358. fi
  359. fi
  360. if [[ -n $NEED_XSLTPROC ]]; then
  361. if ! which xsltproc >/dev/null 2>&1; then
  362. echo >&2 You need xsltproc to build $NEED_XSLTPROC
  363. out=1
  364. fi
  365. fi
  366. if [[ -n $NEED_DBUSGLIB ]]; then
  367. if ! which dbus-binding-tool >/dev/null 2>&1; then
  368. echo >&2 You need dbus-binding-tool to build $NEED_DBUSGLIB
  369. out=1
  370. fi
  371. fi
  372. if [[ -n $NEED_MAKEDEPEND ]]; then
  373. if ! which makedepend >/dev/null 2>&1; then
  374. echo >&2 You need makedepend to build $NEED_MAKEDEPEND
  375. out=1
  376. fi
  377. fi
  378. if [[ -n $ADK_USE_CCACHE ]]; then
  379. if ! which ccache >/dev/null 2>&1; then
  380. echo >&2 You have selected to build with ccache, but ccache could not be found.
  381. out=1
  382. fi
  383. fi
  384. exit $out