scan-pkgs.sh 4.7 KB

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