scan-pkgs.sh 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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=$(env NOFAKE=yes 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 $NEED_GETTEXT ]]; then
  73. if ! which xgettext >/dev/null 2>&1; then
  74. echo >&2 You need gettext to build $NEED_GETTEXT
  75. out=1
  76. elif ! which msgfmt >/dev/null 2>&1; then
  77. echo >&2 You need gettext to build $NEED_GETTEXT
  78. out=1
  79. fi
  80. fi
  81. if [[ -n $NEED_CURLDEV ]];then
  82. if ! test -f /usr/include/curl/curl.h >/dev/null; then
  83. if ! test -f /usr/local/include/curl/curl.h >/dev/null; then
  84. echo >&2 You need curl headers to build $NEED_CURLDEV
  85. out=1
  86. fi
  87. fi
  88. fi
  89. if [[ -n $NEED_SSLDEV ]]; then
  90. if ! test -f /usr/lib/pkgconfig/openssl.pc >/dev/null; then
  91. if ! test -f /usr/include/openssl/ssl.h >/dev/null; then
  92. echo >&2 You need openssl headers to build $NEED_SQUID
  93. out=1
  94. fi
  95. fi
  96. fi
  97. if [[ -n $NEED_INTL ]]; then
  98. if ! which intltool-update >/dev/null 2>&1; then
  99. echo >&2 You need intltool-update to build $NEED_INTL
  100. out=1
  101. fi
  102. fi
  103. if [[ -n $NEED_WWW ]]; then
  104. if ! which w3m >/dev/null 2>&1; then
  105. if ! which lynx >/dev/null 2>&1; then
  106. if ! which links >/dev/null 2>&1; then
  107. echo >&2 You need w3m/links/lynx to build $NEED_WWW
  108. out=1
  109. fi
  110. fi
  111. fi
  112. fi
  113. if [[ -n $NEED_BISON ]]; then
  114. if ! which bison >/dev/null 2>&1; then
  115. echo >&2 You need bison to build $NEED_BISON
  116. out=1
  117. fi
  118. fi
  119. if [[ -n $NEED_GXX ]]; then
  120. if ! which g++ >/dev/null 2>&1; then
  121. echo >&2 You need GNU c++ compiler to build $NEED_GXX
  122. out=1
  123. fi
  124. fi
  125. if [[ -n $NEED_RUBY ]]; then
  126. if ! which ruby >/dev/null 2>&1; then
  127. echo >&2 You need ruby to build $NEED_RUBY
  128. out=1
  129. fi
  130. fi
  131. if [[ -n $NEED_XKBCOMP ]]; then
  132. if ! which xkbcomp >/dev/null 2>&1; then
  133. echo >&2 You need xkbcomp to build $NEED_XKBCOMP
  134. out=1
  135. fi
  136. fi
  137. if [[ -n $NEED_XMLTO ]]; then
  138. if ! which xmlto >/dev/null 2>&1; then
  139. echo >&2 You need xmlto to build $NEED_XMLTO
  140. out=1
  141. fi
  142. fi
  143. if [[ -n $NEED_PKGCONFIG ]]; then
  144. if ! which pkg-config >/dev/null 2>&1; then
  145. echo >&2 You need pkg-config to build $NEED_PKGCONFIG
  146. out=1
  147. fi
  148. fi
  149. if [[ -n $NEED_GLIBZWO ]]; then
  150. if ! which glib-genmarshal >/dev/null 2>&1; then
  151. echo >&2 You need libglib2.0-dev to build $NEED_GLIBZWO
  152. out=1
  153. fi
  154. fi
  155. if [[ -n $ADK_USE_CCACHE ]]; then
  156. if ! which ccache >/dev/null 2>&1; then
  157. echo >&2 You have selected to build with ccache, but ccache could not be found.
  158. out=1
  159. fi
  160. fi
  161. if [[ -n $NEED_RPM ]]; then
  162. if ! which rpmbuild >/dev/null 2>&1; then
  163. echo >&2 You need rpmbuild to to use $NEED_RPM package backend
  164. out=1
  165. fi
  166. fi
  167. if [[ -n $NEED_FLEX ]]; then
  168. if ! which flex >/dev/null 2>&1; then
  169. echo >&2 You need flex to to use $NEED_FLEX package
  170. out=1
  171. fi
  172. fi
  173. exit $out