scan-pkgs.sh 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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_GIT ]];then
  22. NEED_CURLDEV="$NEED_CURLDEV git"
  23. fi
  24. if [[ -n $ADK_TARGET_PACKAGE_RPM ]]; then
  25. NEED_RPM="$NEED_RPM rpm"
  26. fi
  27. fi
  28. if [[ -n $ADK_PACKAGE_GPSD ]]; then
  29. NEED_PYTHON="$NEED_PYTHON gpsd"
  30. fi
  31. if [[ -n $ADK_PACKAGE_FIREFOX ]]; then
  32. NEED_ZIP="$NEED_ZIP firefox"
  33. NEED_LIBIDL="$NEED_LIBIDL firefox"
  34. NEED_PYTHON="$NEED_PYTHON firefox"
  35. fi
  36. if [[ -n $ADK_COMPILE_HEIMDAL ]]; then
  37. NEED_BISON="$NEED_BISON heimdal-server"
  38. fi
  39. if [[ -n $ADK_COMPILE_PCMCIAUTILS ]]; then
  40. NEED_BISON="$NEED_BISON pcmciautils"
  41. NEED_FLEX="$NEED_FLEX pcmciautils"
  42. fi
  43. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  44. NEED_XKBCOMP="$NEED_XKBCOMP xkeyboard-config"
  45. fi
  46. if [[ -n $ADK_COMPILE_AVAHI ]]; then
  47. NEED_PKGCONFIG="$NEED_PKGCONFIG avahi"
  48. fi
  49. if [[ -n $ADK_COMPILE_AUTOCONF ]]; then
  50. NEED_M4="$NEED_M4 autoconf"
  51. fi
  52. if [[ -n $ADK_COMPILE_AUTOMAKE ]]; then
  53. NEED_AUTOCONF="$NEED_AUTOCONF automake"
  54. fi
  55. if [[ -n $ADK_PACKAGE_SQUID ]]; then
  56. NEED_GXX="$NEED_GXX squid"
  57. fi
  58. if [[ -n $ADK_PACKAGE_DANSGUARDIAN ]]; then
  59. NEED_PKGCONFIG="$NEED_PKGCONFIG dansguardian"
  60. fi
  61. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  62. NEED_INTL="$NEED_INTL xkeyboard-config"
  63. fi
  64. if [[ -n $ADK_PACKAGE_GLIB ]]; then
  65. NEED_GLIBZWO="$NEED_GLIBZWO glib"
  66. NEED_GETTEXT="$NEED_GETTEXT glib"
  67. NEED_PKGCONFIG="$NEED_PKGCONFIG glib"
  68. fi
  69. if [[ -n $ADK_PACKAGE_LIBPCAP ]]; then
  70. NEED_FLEX="$NEED_FLEX libpcap"
  71. NEED_BISON="$NEED_BISON libpcap"
  72. fi
  73. if [[ -n $ADK_PACKAGE_LIBXFONT ]]; then
  74. NEED_WWW="$NEED_WWW libXfont"
  75. NEED_XMLTO="$NEED_XMLTO libXfont"
  76. fi
  77. if [[ -n $ADK_PACKAGE_EGLIBC ]]; then
  78. NEED_GPERF="$NEED_GPERF eglibc"
  79. fi
  80. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_100DPI ]]; then
  81. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
  82. fi
  83. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_75DPI ]]; then
  84. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
  85. fi
  86. if [[ -n $ADK_PACKAGE_FONT_ADOBE_100DPI ]]; then
  87. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
  88. fi
  89. if [[ -n $ADK_PACKAGE_FONT_ADOBE_75DPI ]]; then
  90. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
  91. fi
  92. if [[ -n $NEED_GETTEXT ]]; then
  93. if ! which xgettext >/dev/null 2>&1; then
  94. echo >&2 You need gettext to build $NEED_GETTEXT
  95. out=1
  96. elif ! which msgfmt >/dev/null 2>&1; then
  97. echo >&2 You need gettext to build $NEED_GETTEXT
  98. out=1
  99. fi
  100. fi
  101. if [[ -n $NEED_CURLDEV ]];then
  102. if ! test -f /usr/include/curl/curl.h >/dev/null; then
  103. if ! test -f /usr/local/include/curl/curl.h >/dev/null; then
  104. echo >&2 You need curl headers to build $NEED_CURLDEV
  105. out=1
  106. fi
  107. fi
  108. fi
  109. #if [[ -n $NEED_SSLDEV ]]; then
  110. # if ! test -f /usr/lib/pkgconfig/openssl.pc >/dev/null; then
  111. # if ! test -f /usr/include/openssl/ssl.h >/dev/null; then
  112. # echo >&2 You need openssl headers to build $NEED_SSLDEV
  113. # out=1
  114. # fi
  115. # fi
  116. #fi
  117. if [[ -n $NEED_MKFONTDIR ]]; then
  118. if ! which mkfontdir >/dev/null 2>&1; then
  119. echo >&2 You need mkfontdir to build $NEED_MKFONTDIR
  120. out=1
  121. fi
  122. fi
  123. if [[ -n $NEED_M4 ]]; then
  124. if ! which m4 >/dev/null 2>&1; then
  125. echo >&2 You need GNU m4 to build $NEED_M4
  126. out=1
  127. fi
  128. fi
  129. if [[ -n $NEED_AUTOCONF ]]; then
  130. if ! which autoconf >/dev/null 2>&1; then
  131. echo >&2 You need autoconf to build $NEED_AUTOCONF
  132. out=1
  133. fi
  134. fi
  135. if [[ -n $NEED_INTL ]]; then
  136. if ! which intltool-update >/dev/null 2>&1; then
  137. echo >&2 You need intltool to build $NEED_INTL
  138. out=1
  139. fi
  140. fi
  141. if [[ -n $NEED_WWW ]]; then
  142. if ! which w3m >/dev/null 2>&1; then
  143. if ! which lynx >/dev/null 2>&1; then
  144. if ! which links >/dev/null 2>&1; then
  145. echo >&2 You need w3m/links/lynx to build $NEED_WWW
  146. out=1
  147. fi
  148. fi
  149. fi
  150. fi
  151. if [[ -n $NEED_BISON ]]; then
  152. if ! which bison >/dev/null 2>&1; then
  153. echo >&2 You need bison to build $NEED_BISON
  154. out=1
  155. fi
  156. fi
  157. if [[ -n $NEED_ZIP ]]; then
  158. if ! which zip >/dev/null 2>&1; then
  159. echo >&2 You need zip to build $NEED_ZIP
  160. out=1
  161. fi
  162. fi
  163. if [[ -n $NEED_LIBIDL ]]; then
  164. if ! which libIDL-config-2 >/dev/null 2>&1; then
  165. echo >&2 You need libIDL-config-2 to build $NEED_LIBIDL
  166. out=1
  167. fi
  168. fi
  169. if [[ -n $NEED_GPERF ]]; then
  170. if ! which gperf >/dev/null 2>&1; then
  171. echo >&2 You need gperf to build $NEED_GPERF
  172. out=1
  173. fi
  174. fi
  175. if [[ -n $NEED_GXX ]]; then
  176. if ! which g++ >/dev/null 2>&1; then
  177. echo >&2 You need GNU c++ compiler to build $NEED_GXX
  178. out=1
  179. fi
  180. fi
  181. if [[ -n $NEED_RUBY ]]; then
  182. if ! which ruby >/dev/null 2>&1; then
  183. echo >&2 You need ruby to build $NEED_RUBY
  184. out=1
  185. fi
  186. fi
  187. if [[ -n $NEED_XKBCOMP ]]; then
  188. if ! which xkbcomp >/dev/null 2>&1; then
  189. echo >&2 You need xkbcomp to build $NEED_XKBCOMP
  190. out=1
  191. fi
  192. fi
  193. if [[ -n $NEED_PKGCONFIG ]]; then
  194. if ! which pkg-config >/dev/null 2>&1; then
  195. echo >&2 You need pkg-config to build $NEED_PKGCONFIG
  196. out=1
  197. fi
  198. fi
  199. if [[ -n $NEED_GLIBZWO ]]; then
  200. if ! which glib-genmarshal >/dev/null 2>&1; then
  201. echo >&2 You need libglib2.0-dev to build $NEED_GLIBZWO
  202. out=1
  203. fi
  204. fi
  205. if [[ -n $NEED_RPM ]]; then
  206. if ! which rpmbuild >/dev/null 2>&1; then
  207. echo >&2 You need rpmbuild to to use $NEED_RPM package backend
  208. out=1
  209. fi
  210. fi
  211. if [[ -n $NEED_FLEX ]]; then
  212. if ! which flex >/dev/null 2>&1; then
  213. echo >&2 You need flex to to use $NEED_FLEX package
  214. out=1
  215. fi
  216. fi
  217. if [[ -n $NEED_PYTHON ]]; then
  218. if ! which python >/dev/null 2>&1; then
  219. if ! test -x /usr/pkg/bin/python2.6 >/dev/null; then
  220. echo >&2 You need python to to use $NEED_PYTHON package
  221. out=1
  222. fi
  223. fi
  224. fi
  225. exit $out