scan-pkgs.sh 5.3 KB

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