scan-pkgs.sh 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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. NEED_SSLDEV="$NEED_SSLDEV git"
  24. fi
  25. if [[ -n $ADK_TARGET_PACKAGE_RPM ]]; then
  26. NEED_RPM="$NEED_RPM rpm"
  27. fi
  28. fi
  29. if [[ -n $ADK_PACKAGE_LIBUSB ]]; then
  30. NEED_BISON="$NEED_BISON libusb"
  31. fi
  32. if [[ -n $ADK_COMPILE_HEIMDAL ]]; then
  33. NEED_BISON="$NEED_BISON heimdal-server"
  34. fi
  35. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  36. NEED_XKBCOMP="$NEED_XKBCOMP xkeyboard-config"
  37. fi
  38. if [[ -n $ADK_COMPILE_AVAHI ]]; then
  39. NEED_PKGCONFIG="$NEED_PKGCONFIG avahi"
  40. fi
  41. if [[ -n $ADK_PACKAGE_SQUID ]]; then
  42. NEED_SSLDEV="$NEED_SSLDEV squid"
  43. NEED_GXX="$NEED_GXX squid"
  44. fi
  45. if [[ -n $ADK_PACKAGE_DANSGUARDIAN ]]; then
  46. NEED_PKGCONFIG="$NEED_PKGCONFIG dansguardian"
  47. fi
  48. if [[ -n $ADK_PACKAGE_XKEYBOARD_CONFIG ]]; then
  49. NEED_INTL="$NEED_INTL xkeyboard-config"
  50. fi
  51. if [[ -n $ADK_PACKAGE_GLIB ]]; then
  52. NEED_GLIBZWO="$NEED_GLIBZWO glib"
  53. NEED_GETTEXT="$NEED_GETTEXT glib"
  54. NEED_PKGCONFIG="$NEED_PKGCONFIG glib"
  55. fi
  56. if [[ -n $ADK_PACKAGE_LIBPCAP ]]; then
  57. NEED_FLEX="$NEED_FLEX libpcap"
  58. NEED_BISON="$NEED_BISON libpcap"
  59. fi
  60. if [[ -n $ADK_PACKAGE_LIBXFONT ]]; then
  61. NEED_WWW="$NEED_WWW libXfont"
  62. NEED_XMLTO="$NEED_XMLTO libXfont"
  63. fi
  64. if [[ -n $ADK_PACKAGE_EGLIBC ]]; then
  65. NEED_GPERF="$NEED_GPERF eglibc"
  66. fi
  67. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_100DPI ]]; then
  68. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-100dpi"
  69. fi
  70. if [[ -n $ADK_PACKAGE_FONT_BITSTREAM_75DPI ]]; then
  71. NEED_MKFONTDIR="$NEED_MKFONTDIR font-bitstream-75dpi"
  72. fi
  73. if [[ -n $ADK_PACKAGE_FONT_ADOBE_100DPI ]]; then
  74. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-100dpi"
  75. fi
  76. if [[ -n $ADK_PACKAGE_FONT_ADOBE_75DPI ]]; then
  77. NEED_MKFONTDIR="$NEED_MKFONTDIR font-adobe-75dpi"
  78. fi
  79. if [[ -n $NEED_GETTEXT ]]; then
  80. if ! which xgettext >/dev/null 2>&1; then
  81. echo >&2 You need gettext to build $NEED_GETTEXT
  82. out=1
  83. elif ! which msgfmt >/dev/null 2>&1; then
  84. echo >&2 You need gettext to build $NEED_GETTEXT
  85. out=1
  86. fi
  87. fi
  88. if [[ -n $NEED_CURLDEV ]];then
  89. if ! test -f /usr/include/curl/curl.h >/dev/null; then
  90. if ! test -f /usr/local/include/curl/curl.h >/dev/null; then
  91. echo >&2 You need curl headers to build $NEED_CURLDEV
  92. out=1
  93. fi
  94. fi
  95. fi
  96. if [[ -n $NEED_SSLDEV ]]; then
  97. if ! test -f /usr/lib/pkgconfig/openssl.pc >/dev/null; then
  98. if ! test -f /usr/include/openssl/ssl.h >/dev/null; then
  99. echo >&2 You need openssl headers to build $NEED_SQUID
  100. out=1
  101. fi
  102. fi
  103. fi
  104. if [[ -n $NEED_MKFONTDIR ]]; then
  105. if ! which mkfontdir >/dev/null 2>&1; then
  106. echo >&2 You need mkfontdir to build $NEED_MKFONTDIR
  107. out=1
  108. fi
  109. fi
  110. if [[ -n $NEED_INTL ]]; then
  111. if ! which intltool-update >/dev/null 2>&1; then
  112. echo >&2 You need intltool-update to build $NEED_INTL
  113. out=1
  114. fi
  115. fi
  116. if [[ -n $NEED_WWW ]]; then
  117. if ! which w3m >/dev/null 2>&1; then
  118. if ! which lynx >/dev/null 2>&1; then
  119. if ! which links >/dev/null 2>&1; then
  120. echo >&2 You need w3m/links/lynx to build $NEED_WWW
  121. out=1
  122. fi
  123. fi
  124. fi
  125. fi
  126. if [[ -n $NEED_BISON ]]; then
  127. if ! which bison >/dev/null 2>&1; then
  128. echo >&2 You need bison to build $NEED_BISON
  129. out=1
  130. fi
  131. fi
  132. if [[ -n $NEED_GPERF ]]; then
  133. if ! which gperf >/dev/null 2>&1; then
  134. echo >&2 You need gperf to build $NEED_GPERF
  135. out=1
  136. fi
  137. fi
  138. if [[ -n $NEED_GXX ]]; then
  139. if ! which g++ >/dev/null 2>&1; then
  140. echo >&2 You need GNU c++ compiler to build $NEED_GXX
  141. out=1
  142. fi
  143. fi
  144. if [[ -n $NEED_RUBY ]]; then
  145. if ! which ruby >/dev/null 2>&1; then
  146. echo >&2 You need ruby to build $NEED_RUBY
  147. out=1
  148. fi
  149. fi
  150. if [[ -n $NEED_XKBCOMP ]]; then
  151. if ! which xkbcomp >/dev/null 2>&1; then
  152. echo >&2 You need xkbcomp to build $NEED_XKBCOMP
  153. out=1
  154. fi
  155. fi
  156. if [[ -n $NEED_PKGCONFIG ]]; then
  157. if ! which pkg-config >/dev/null 2>&1; then
  158. echo >&2 You need pkg-config to build $NEED_PKGCONFIG
  159. out=1
  160. fi
  161. fi
  162. if [[ -n $NEED_GLIBZWO ]]; then
  163. if ! which glib-genmarshal >/dev/null 2>&1; then
  164. echo >&2 You need libglib2.0-dev to build $NEED_GLIBZWO
  165. out=1
  166. fi
  167. fi
  168. if [[ -n $ADK_USE_CCACHE ]]; then
  169. if ! which ccache >/dev/null 2>&1; then
  170. echo >&2 You have selected to build with ccache, but ccache could not be found.
  171. out=1
  172. fi
  173. fi
  174. if [[ -n $NEED_RPM ]]; then
  175. if ! which rpmbuild >/dev/null 2>&1; then
  176. echo >&2 You need rpmbuild to to use $NEED_RPM package backend
  177. out=1
  178. fi
  179. fi
  180. if [[ -n $NEED_FLEX ]]; then
  181. if ! which flex >/dev/null 2>&1; then
  182. echo >&2 You need flex to to use $NEED_FLEX package
  183. out=1
  184. fi
  185. fi
  186. exit $out