scan-pkgs.sh 9.6 KB

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