prereq-build.mk 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. #
  2. # Copyright (C) 2006-2012 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. include $(INCLUDE_DIR)/prereq.mk
  9. include $(INCLUDE_DIR)/host.mk
  10. include $(INCLUDE_DIR)/host-build.mk
  11. SHELL:=sh
  12. PKG_NAME:=Build dependency
  13. # Required for the toolchain
  14. $(eval $(call TestHostCommand,working-make, \
  15. Please install GNU make v3.81 or later. (This version has bugs), \
  16. $(MAKE) -v | grep -E 'Make (3\.8[1-9]|3\.9[0-9]|[4-9]\.)'))
  17. $(eval $(call TestHostCommand,case-sensitive-fs, \
  18. libreCMC can only be built on a case-sensitive filesystem, \
  19. rm -f $(TMP_DIR)/test.*; touch $(TMP_DIR)/test.fs; \
  20. test ! -f $(TMP_DIR)/test.FS))
  21. $(eval $(call SetupHostCommand,gcc, \
  22. Please install the GNU C Compiler (gcc), \
  23. $(CC) --version | grep gcc, \
  24. gcc --version | grep gcc, \
  25. gcc49 --version | grep gcc, \
  26. gcc48 --version | grep gcc, \
  27. gcc47 --version | grep gcc, \
  28. gcc46 --version | grep gcc, \
  29. gcc --version | grep Apple.LLVM ))
  30. $(eval $(call TestHostCommand,working-gcc, \
  31. Please reinstall the GNU C Compiler - it appears to be broken, \
  32. echo 'int main(int argc, char **argv) { return 0; }' | \
  33. gcc -x c -o $(TMP_DIR)/a.out -))
  34. $(eval $(call SetupHostCommand,g++, \
  35. Please install the GNU C++ Compiler (g++), \
  36. $(CXX) --version | grep g++, \
  37. g++ --version | grep g++, \
  38. g++49 --version | grep g++, \
  39. g++48 --version | grep g++, \
  40. g++47 --version | grep g++, \
  41. g++46 --version | grep g++, \
  42. g++ --version | grep Apple.LLVM ))
  43. $(eval $(call TestHostCommand,working-g++, \
  44. Please reinstall the GNU C++ Compiler - it appears to be broken, \
  45. echo 'int main(int argc, char **argv) { return 0; }' | \
  46. g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
  47. $(TMP_DIR)/a.out))
  48. $(eval $(call TestHostCommand,ncurses, \
  49. Please install ncurses. (Missing libncurses.so or ncurses.h), \
  50. echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
  51. gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses))
  52. $(eval $(call TestHostCommand,zlib, \
  53. Please install zlib. (Missing libz.so or zlib.h), \
  54. echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
  55. gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - -lz))
  56. $(eval $(call TestHostCommand,libssl, \
  57. Please install the openssl library (with development headers), \
  58. echo 'int main(int argc, char **argv) { SSL_library_init(); return 0; }' | \
  59. gcc -include openssl/ssl.h -x c -o $(TMP_DIR)/a.out - -lcrypto -lssl))
  60. $(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \
  61. gtar --version 2>&1 | grep GNU, \
  62. gnutar --version 2>&1 | grep GNU, \
  63. tar --version 2>&1 | grep GNU))
  64. $(eval $(call SetupHostCommand,find,Please install GNU 'find', \
  65. gfind --version 2>&1 | grep GNU, \
  66. find --version 2>&1 | grep GNU))
  67. $(eval $(call SetupHostCommand,bash,Please install GNU 'bash', \
  68. bash --version 2>&1 | grep GNU))
  69. $(eval $(call SetupHostCommand,patch,Please install GNU 'patch', \
  70. gpatch --version 2>&1 | grep 'Free Software Foundation', \
  71. patch --version 2>&1 | grep 'Free Software Foundation'))
  72. $(eval $(call SetupHostCommand,diff,Please install diffutils, \
  73. gdiff --version 2>&1 | grep diff, \
  74. diff --version 2>&1 | grep diff))
  75. $(eval $(call SetupHostCommand,cp,Please install GNU fileutils, \
  76. gcp --help, \
  77. cp --help))
  78. $(eval $(call SetupHostCommand,seq,, \
  79. gseq --version, \
  80. seq --version))
  81. $(eval $(call SetupHostCommand,awk,Please install GNU 'awk', \
  82. gawk --version 2>&1 | grep GNU, \
  83. awk --version 2>&1 | grep GNU))
  84. $(eval $(call SetupHostCommand,grep,Please install GNU 'grep', \
  85. ggrep --version 2>&1 | grep GNU, \
  86. grep --version 2>&1 | grep GNU))
  87. $(eval $(call SetupHostCommand,getopt, \
  88. Please install an extended getopt version that supports --long, \
  89. gnugetopt -o t --long test -- --test | grep '^ *--test *--', \
  90. /usr/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--', \
  91. getopt -o t --long test -- --test | grep '^ *--test *--'))
  92. $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
  93. gnustat -c%s $(TMP_DIR)/.host.mk, \
  94. gstat -c%s $(TMP_DIR)/.host.mk, \
  95. stat -c%s $(TMP_DIR)/.host.mk))
  96. $(eval $(call SetupHostCommand,md5sum,, \
  97. gmd5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \
  98. md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \
  99. $(SCRIPT_DIR)/md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e))
  100. $(eval $(call SetupHostCommand,unzip,Please install 'unzip', \
  101. unzip 2>&1 | grep zipfile, \
  102. unzip))
  103. $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \
  104. bzip2 --version </dev/null))
  105. $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \
  106. wget --version | grep GNU))
  107. $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
  108. perl --version | grep "perl.*v5"))
  109. $(eval $(call SetupHostCommand,python,Please install Python 2.x, \
  110. python2.7 -V 2>&1 | grep Python, \
  111. python2 -V 2>&1 | grep Python, \
  112. python -V 2>&1 | grep Python))
  113. $(eval $(call SetupHostCommand,svn,Please install the Subversion client, \
  114. svn --version | grep Subversion))
  115. $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.6.5, \
  116. git clone 2>&1 | grep -- --recursive))
  117. $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
  118. file --version 2>&1 | grep file))
  119. $(eval $(call SetupHostCommand,openssl,Please install the 'openssl' utility, \
  120. openssl version | grep OpenSSL))
  121. # Install ldconfig stub
  122. $(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
  123. touch $(STAGING_DIR_HOST)/bin/ldconfig && \
  124. chmod +x $(STAGING_DIR_HOST)/bin/ldconfig))