prereq-build.mk 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. LEDE 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. ifeq ($(HOST_OS),Linux)
  53. zlib_link_flags := -Wl,-Bstatic -lz -Wl,-Bdynamic
  54. else
  55. zlib_link_flags := -lz
  56. endif
  57. $(eval $(call TestHostCommand,zlib, \
  58. Please install a static zlib. (Missing libz.a or zlib.h), \
  59. echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
  60. gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - $(zlib_link_flags)))
  61. # Xcode deprecated openssl, MacPorts doesn't work nicely for other packages
  62. ifneq ($(HOST_OS),Darwin)
  63. $(eval $(call TestHostCommand,libssl, \
  64. Please install the openssl library (with development headers), \
  65. echo 'int main(int argc, char **argv) { SSL_library_init(); return 0; }' | \
  66. gcc $(HOST_CFLAGS) -include openssl/ssl.h -x c -o $(TMP_DIR)/a.out - -lcrypto -lssl $(HOST_LDFLAGS)))
  67. endif
  68. $(eval $(call TestHostCommand,perl-thread-queue, \
  69. Please install the Perl Thread::Queue module, \
  70. perl -MThread::Queue -e 1))
  71. $(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \
  72. gtar --version 2>&1 | grep GNU, \
  73. gnutar --version 2>&1 | grep GNU, \
  74. tar --version 2>&1 | grep GNU))
  75. $(eval $(call SetupHostCommand,find,Please install GNU 'find', \
  76. gfind --version 2>&1 | grep GNU, \
  77. find --version 2>&1 | grep GNU))
  78. $(eval $(call SetupHostCommand,bash,Please install GNU 'bash', \
  79. bash --version 2>&1 | grep GNU))
  80. $(eval $(call SetupHostCommand,patch,Please install GNU 'patch', \
  81. gpatch --version 2>&1 | grep 'Free Software Foundation', \
  82. patch --version 2>&1 | grep 'Free Software Foundation'))
  83. $(eval $(call SetupHostCommand,diff,Please install diffutils, \
  84. gdiff --version 2>&1 | grep diff, \
  85. diff --version 2>&1 | grep diff))
  86. $(eval $(call SetupHostCommand,cp,Please install GNU fileutils, \
  87. gcp --help, \
  88. cp --help))
  89. $(eval $(call SetupHostCommand,seq,, \
  90. gseq --version, \
  91. seq --version))
  92. $(eval $(call SetupHostCommand,awk,Please install GNU 'awk', \
  93. gawk --version 2>&1 | grep GNU, \
  94. awk --version 2>&1 | grep GNU))
  95. $(eval $(call SetupHostCommand,grep,Please install GNU 'grep', \
  96. ggrep --version 2>&1 | grep GNU, \
  97. grep --version 2>&1 | grep GNU))
  98. $(eval $(call SetupHostCommand,getopt, \
  99. Please install an extended getopt version that supports --long, \
  100. gnugetopt -o t --long test -- --test | grep '^ *--test *--', \
  101. /usr/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--', \
  102. getopt -o t --long test -- --test | grep '^ *--test *--'))
  103. $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
  104. gnustat -c%s $(TMP_DIR)/.host.mk, \
  105. gstat -c%s $(TMP_DIR)/.host.mk, \
  106. stat -c%s $(TMP_DIR)/.host.mk))
  107. $(eval $(call SetupHostCommand,md5sum,, \
  108. gmd5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \
  109. md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \
  110. $(SCRIPT_DIR)/md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e))
  111. $(eval $(call SetupHostCommand,unzip,Please install 'unzip', \
  112. unzip 2>&1 | grep zipfile, \
  113. unzip))
  114. $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \
  115. bzip2 --version </dev/null))
  116. $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \
  117. wget --version | grep GNU))
  118. $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
  119. perl --version | grep "perl.*v5"))
  120. $(eval $(call SetupHostCommand,python,Please install Python 2.x, \
  121. python2.7 -V 2>&1 | grep Python, \
  122. python2 -V 2>&1 | grep Python, \
  123. python -V 2>&1 | grep Python))
  124. $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
  125. git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
  126. $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
  127. file --version 2>&1 | grep file))
  128. ifneq ($(HOST_OS),Darwin)
  129. $(eval $(call SetupHostCommand,openssl,Please install the 'openssl' utility, \
  130. openssl version | grep '\(OpenSSL\|LibreSSL\)'))
  131. endif
  132. # Install ldconfig stub
  133. $(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
  134. touch $(STAGING_DIR_HOST)/bin/ldconfig && \
  135. chmod +x $(STAGING_DIR_HOST)/bin/ldconfig))