scan-pkgs.sh 11 KB

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