scan-pkgs.sh 11 KB

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