scan-pkgs.sh 8.6 KB

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