scan-pkgs.sh 5.0 KB

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