scan-pkgs.sh 9.4 KB

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