scan-pkgs.sh 11 KB

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