scan-pkgs.sh 9.5 KB

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