scan-pkgs.sh 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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_LIBIMAGEMAGICK ]];then
  22. NEED_JPEGDEV="$NEED_JPEGDEV libimagemagick"
  23. NEED_TIFFDEV="$NEED_TIFFDEV libimagemagick"
  24. fi
  25. if [[ -n $ADK_PACKAGE_DISPLAY ]];then
  26. NEED_X11DEV="$NEED_X11DEV display"
  27. NEED_XEXTDEV="$NEED_XEXTDEV display"
  28. fi
  29. if [[ -n $ADK_PACKAGE_GIT ]];then
  30. NEED_CURLDEV="$NEED_CURLDEV git"
  31. fi
  32. if [[ -n $ADK_TARGET_PACKAGE_RPM ]]; then
  33. NEED_RPM="$NEED_RPM rpm"
  34. fi
  35. if [[ -n $ADK_PACKAGE_WPA_SUPPLICANT_WITH_OPENSSL ]]; then
  36. NEED_LIBSSLDEV="$NEED_LIBSSLDEV wpa_supplicant"
  37. fi
  38. if [[ -n $ADK_PACKAGE_IW ]]; then
  39. NEED_LIBNLDEV="$NEED_LIBNLDEV iw"
  40. fi
  41. if [[ -n $ADK_PACKAGE_NFS_UTILS_WITH_KERBEROS ]]; then
  42. NEED_LIBKRB5DEV="$NEED_LIBKRB5DEV nfs-utils"
  43. fi
  44. if [[ -n $ADK_PACKAGE_NFS_UTILS_WITH_TIRPC ]]; then
  45. NEED_LIBTIRPCDEV="$NEED_LIBTIRPCDEV nfs-utils"
  46. fi
  47. fi
  48. if [[ -n $ADK_PACKAGE_GPSD ]]; then
  49. NEED_PYTHON="$NEED_PYTHON gpsd"
  50. fi
  51. if [[ -n $ADK_PACKAGE_FIREFOX ]]; then
  52. NEED_ZIP="$NEED_ZIP firefox"
  53. NEED_LIBIDL="$NEED_LIBIDL firefox"
  54. NEED_PYTHON="$NEED_PYTHON firefox"
  55. fi
  56. if [[ -n $ADK_COMPILE_HEIMDAL ]]; then
  57. NEED_BISON="$NEED_BISON heimdal-server"
  58. fi
  59. if [[ -n $ADK_COMPILE_KRB5 ]]; then
  60. NEED_BISON="$NEED_BISON krb5"
  61. fi
  62. if [[ -n $ADK_PACKAGE_LIBXCB ]]; then
  63. NEED_XSLTPROC="$NEED_XSLTPROC libxcb"
  64. fi
  65. if [[ -n $ADK_COMPILE_PCMCIAUTILS ]]; then
  66. NEED_BISON="$NEED_BISON pcmciautils"
  67. NEED_FLEX="$NEED_FLEX pcmciautils"
  68. fi
  69. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  70. NEED_XKBCOMP="$NEED_XKBCOMP xkeyboard-config"
  71. fi
  72. if [[ -n $ADK_COMPILE_AUTOCONF ]]; then
  73. NEED_M4="$NEED_M4 autoconf"
  74. fi
  75. if [[ -n $ADK_COMPILE_AUTOMAKE ]]; then
  76. NEED_AUTOCONF="$NEED_AUTOCONF automake"
  77. fi
  78. if [[ -n $ADK_PACKAGE_SQUID ]]; then
  79. NEED_GXX="$NEED_GXX squid"
  80. fi
  81. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  82. NEED_INTL="$NEED_INTL xkeyboard-config"
  83. fi
  84. if [[ -n $ADK_PACKAGE_LIBPCAP ]]; then
  85. NEED_FLEX="$NEED_FLEX libpcap"
  86. NEED_BISON="$NEED_BISON libpcap"
  87. fi
  88. if [[ -n $ADK_PACKAGE_LIBXFONT ]]; then
  89. NEED_WWW="$NEED_WWW libXfont"
  90. NEED_XMLTO="$NEED_XMLTO libXfont"
  91. fi
  92. if [[ -n $ADK_PACKAGE_EGLIBC ]]; then
  93. NEED_GPERF="$NEED_GPERF eglibc"
  94. fi
  95. if [[ -n $ADK_PACKAGE_GLIB ]]; then
  96. NEED_GETTEXT="$NEED_GETTEXT glib"
  97. fi
  98. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_100DPI ]]; then
  99. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
  100. fi
  101. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_75DPI ]]; then
  102. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
  103. fi
  104. if [[ -n $ADK_PACKAGE_FONT_ADOBE_100DPI ]]; then
  105. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
  106. fi
  107. if [[ -n $ADK_PACKAGE_FONT_ADOBE_75DPI ]]; then
  108. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
  109. fi
  110. if [[ -n $NEED_GETTEXT ]]; then
  111. if ! which gettext >/dev/null 2>&1; then
  112. echo >&2 You need gettext to build $NEED_GETTEXT
  113. out=1
  114. elif ! which msgfmt >/dev/null 2>&1; then
  115. echo >&2 You need msgfmt to build $NEED_GETTEXT
  116. out=1
  117. fi
  118. fi
  119. if [[ -n $NEED_LIBTIRPCDEV ]];then
  120. if ! test -f /usr/include/tirpc/netconfig.h >/dev/null; then
  121. echo >&2 You need tirpc headers to build $NEED_LIBTIRPCDEV
  122. out=1
  123. fi
  124. fi
  125. if [[ -n $NEED_LIBKRB5DEV ]];then
  126. if ! test -f /usr/include/krb5.h >/dev/null; then
  127. echo >&2 You need krb5 headers to build $NEED_LIBKRB5DEV
  128. out=1
  129. fi
  130. fi
  131. if [[ -n $NEED_CURLDEV ]];then
  132. if ! test -f /usr/include/curl/curl.h >/dev/null; then
  133. if ! test -f /usr/local/include/curl/curl.h >/dev/null; then
  134. echo >&2 You need curl headers to build $NEED_CURLDEV
  135. out=1
  136. fi
  137. fi
  138. fi
  139. if [[ -n $NEED_TIFFDEV ]];then
  140. if ! test -f /usr/include/tiff.h >/dev/null; then
  141. echo >&2 You need tiff headers to build $NEED_TIFFDEV
  142. out=1
  143. fi
  144. fi
  145. if [[ -n $NEED_JPEGDEV ]];then
  146. if ! test -f /usr/include/jpeglib.h >/dev/null; then
  147. echo >&2 You need jpeg headers to build $NEED_JPEGDEV
  148. out=1
  149. fi
  150. fi
  151. if [[ -n $NEED_LIBNLDEV ]];then
  152. if ! test -f /usr/include/netlink/netlink.h >/dev/null; then
  153. echo >&2 You need libnl headers to build $NEED_LIBNLDEV
  154. out=1
  155. fi
  156. fi
  157. if [[ -n $NEED_X11DEV ]];then
  158. if ! test -f /usr/include/X11/Xlib.h >/dev/null; then
  159. echo >&2 You need X11 headers to build $NEED_X11DEV
  160. out=1
  161. fi
  162. fi
  163. if [[ -n $NEED_XEXTDEV ]];then
  164. if ! test -f /usr/include/X11/extensions/XShm.h >/dev/null; then
  165. echo >&2 You need X11 extensions headers to build $NEED_XEXTDEV
  166. out=1
  167. fi
  168. fi
  169. if [[ -n $NEED_LIBSSLDEV ]]; then
  170. if ! test -f /usr/include/openssl/ssl.h >/dev/null; then
  171. echo >&2 You need openssl headers to build $NEED_LIBSSLDEV
  172. out=1
  173. fi
  174. fi
  175. if [[ -n $NEED_MKFONTDIR ]]; then
  176. if ! which mkfontdir >/dev/null 2>&1; then
  177. echo >&2 You need mkfontdir to build $NEED_MKFONTDIR
  178. out=1
  179. fi
  180. fi
  181. if [[ -n $NEED_M4 ]]; then
  182. if ! which m4 >/dev/null 2>&1; then
  183. echo >&2 You need GNU m4 to build $NEED_M4
  184. out=1
  185. fi
  186. fi
  187. if [[ -n $NEED_AUTOCONF ]]; then
  188. if ! which autoconf >/dev/null 2>&1; then
  189. echo >&2 You need autoconf to build $NEED_AUTOCONF
  190. out=1
  191. fi
  192. fi
  193. if [[ -n $NEED_INTL ]]; then
  194. if ! which intltool-update >/dev/null 2>&1; then
  195. echo >&2 You need intltool to build $NEED_INTL
  196. out=1
  197. fi
  198. fi
  199. if [[ -n $NEED_WWW ]]; then
  200. if ! which w3m >/dev/null 2>&1; then
  201. if ! which lynx >/dev/null 2>&1; then
  202. if ! which links >/dev/null 2>&1; then
  203. echo >&2 You need w3m/links/lynx to build $NEED_WWW
  204. out=1
  205. fi
  206. fi
  207. fi
  208. fi
  209. if [[ -n $NEED_BISON ]]; then
  210. if ! which bison >/dev/null 2>&1; then
  211. echo >&2 You need bison to build $NEED_BISON
  212. out=1
  213. fi
  214. fi
  215. if [[ -n $NEED_ZIP ]]; then
  216. if ! which zip >/dev/null 2>&1; then
  217. echo >&2 You need zip to build $NEED_ZIP
  218. out=1
  219. fi
  220. fi
  221. if [[ -n $NEED_LIBIDL ]]; then
  222. if ! which libIDL-config-2 >/dev/null 2>&1; then
  223. echo >&2 You need libIDL-config-2 to build $NEED_LIBIDL
  224. out=1
  225. fi
  226. fi
  227. if [[ -n $NEED_GPERF ]]; then
  228. if ! which gperf >/dev/null 2>&1; then
  229. echo >&2 You need gperf to build $NEED_GPERF
  230. out=1
  231. fi
  232. fi
  233. if [[ -n $NEED_GXX ]]; then
  234. if ! which g++ >/dev/null 2>&1; then
  235. echo >&2 You need GNU c++ compiler to build $NEED_GXX
  236. out=1
  237. fi
  238. fi
  239. if [[ -n $NEED_RUBY ]]; then
  240. if ! which ruby >/dev/null 2>&1; then
  241. echo >&2 You need ruby to build $NEED_RUBY
  242. out=1
  243. fi
  244. fi
  245. if [[ -n $NEED_XKBCOMP ]]; then
  246. if ! which xkbcomp >/dev/null 2>&1; then
  247. echo >&2 You need xkbcomp to build $NEED_XKBCOMP
  248. out=1
  249. fi
  250. fi
  251. if [[ -n $NEED_RPM ]]; then
  252. if ! which rpmbuild >/dev/null 2>&1; then
  253. echo >&2 You need rpmbuild to to use $NEED_RPM package backend
  254. out=1
  255. fi
  256. fi
  257. if [[ -n $NEED_FLEX ]]; then
  258. if ! which flex >/dev/null 2>&1; then
  259. echo >&2 You need flex to to use $NEED_FLEX package
  260. out=1
  261. fi
  262. fi
  263. if [[ -n $NEED_XSLTPROC ]]; then
  264. if ! which xsltproc >/dev/null 2>&1; then
  265. echo >&2 You need xsltproc to to use $NEED_XSLTPROC package
  266. out=1
  267. fi
  268. fi
  269. if [[ -n $NEED_PYTHON ]]; then
  270. if ! which python >/dev/null 2>&1; then
  271. if ! test -x /usr/pkg/bin/python2.6 >/dev/null; then
  272. echo >&2 You need python to to use $NEED_PYTHON package
  273. out=1
  274. fi
  275. fi
  276. fi
  277. if [[ -n $ADK_USE_CCACHE ]]; then
  278. if ! which ccache >/dev/null 2>&1; then
  279. echo >&2 You have selected to build with ccache, but ccache could not be found.
  280. out=1
  281. fi
  282. fi
  283. exit $out