prereq-build.mk 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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-build.mk
  10. SHELL:=sh
  11. PKG_NAME:=Build dependency
  12. # Required for the toolchain
  13. $(eval $(call TestHostCommand,working-make, \
  14. Please install GNU make v3.81 or later. (This version has bugs), \
  15. $(MAKE) -v | grep -E 'Make (3\.8[1-9]|3\.9[0-9]|[4-9]\.)'))
  16. $(eval $(call TestHostCommand,case-sensitive-fs, \
  17. LEDE can only be built on a case-sensitive filesystem, \
  18. rm -f $(TMP_DIR)/test.*; touch $(TMP_DIR)/test.fs; \
  19. test ! -f $(TMP_DIR)/test.FS))
  20. $(eval $(call TestHostCommand,proper-umask, \
  21. Please build with umask 022 - other values produce broken packages, \
  22. umask | grep -xE 00[012][012]))
  23. $(eval $(call SetupHostCommand,gcc, \
  24. Please install the GNU C Compiler (gcc), \
  25. $(CC) --version | grep gcc, \
  26. gcc --version | grep gcc, \
  27. gcc49 --version | grep gcc, \
  28. gcc48 --version | grep gcc, \
  29. gcc47 --version | grep gcc, \
  30. gcc46 --version | grep gcc, \
  31. gcc --version | grep Apple.LLVM ))
  32. $(eval $(call TestHostCommand,working-gcc, \
  33. Please reinstall the GNU C Compiler - it appears to be broken, \
  34. echo 'int main(int argc, char **argv) { return 0; }' | \
  35. gcc -x c -o $(TMP_DIR)/a.out -))
  36. $(eval $(call SetupHostCommand,g++, \
  37. Please install the GNU C++ Compiler (g++), \
  38. $(CXX) --version | grep g++, \
  39. g++ --version | grep g++, \
  40. g++49 --version | grep g++, \
  41. g++48 --version | grep g++, \
  42. g++47 --version | grep g++, \
  43. g++46 --version | grep g++, \
  44. g++ --version | grep Apple.LLVM ))
  45. $(eval $(call TestHostCommand,working-g++, \
  46. Please reinstall the GNU C++ Compiler - it appears to be broken, \
  47. echo 'int main(int argc, char **argv) { return 0; }' | \
  48. g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
  49. $(TMP_DIR)/a.out))
  50. $(eval $(call TestHostCommand,ncurses, \
  51. Please install ncurses. (Missing libncurses.so or ncurses.h), \
  52. echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
  53. gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses))
  54. ifeq ($(HOST_OS),Linux)
  55. zlib_link_flags := -Wl,-Bstatic -lz -Wl,-Bdynamic
  56. else
  57. zlib_link_flags := -lz
  58. endif
  59. $(eval $(call TestHostCommand,zlib, \
  60. Please install a static zlib. (Missing libz.a or zlib.h), \
  61. echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
  62. gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - $(zlib_link_flags)))
  63. $(eval $(call TestHostCommand,perl-thread-queue, \
  64. Please install the Perl Thread::Queue module, \
  65. perl -MThread::Queue -e 1))
  66. $(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \
  67. gtar --version 2>&1 | grep GNU, \
  68. gnutar --version 2>&1 | grep GNU, \
  69. tar --version 2>&1 | grep GNU))
  70. $(eval $(call SetupHostCommand,find,Please install GNU 'find', \
  71. gfind --version 2>&1 | grep GNU, \
  72. find --version 2>&1 | grep GNU))
  73. $(eval $(call SetupHostCommand,bash,Please install GNU 'bash', \
  74. bash --version 2>&1 | grep GNU))
  75. $(eval $(call SetupHostCommand,patch,Please install GNU 'patch', \
  76. gpatch --version 2>&1 | grep 'Free Software Foundation', \
  77. patch --version 2>&1 | grep 'Free Software Foundation'))
  78. $(eval $(call SetupHostCommand,diff,Please install diffutils, \
  79. gdiff --version 2>&1 | grep diff, \
  80. diff --version 2>&1 | grep diff))
  81. $(eval $(call SetupHostCommand,cp,Please install GNU fileutils, \
  82. gcp --help 2>&1 | grep 'Copy SOURCE', \
  83. cp --help 2>&1 | grep 'Copy SOURCE'))
  84. $(eval $(call SetupHostCommand,seq,, \
  85. gseq --version, \
  86. seq --version))
  87. $(eval $(call SetupHostCommand,awk,Please install GNU 'awk', \
  88. gawk --version 2>&1 | grep GNU, \
  89. awk --version 2>&1 | grep GNU))
  90. $(eval $(call SetupHostCommand,grep,Please install GNU 'grep', \
  91. ggrep --version 2>&1 | grep GNU, \
  92. grep --version 2>&1 | grep GNU))
  93. $(eval $(call SetupHostCommand,getopt, \
  94. Please install an extended getopt version that supports --long, \
  95. gnugetopt -o t --long test -- --test | grep '^ *--test *--', \
  96. /usr/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--', \
  97. getopt -o t --long test -- --test | grep '^ *--test *--'))
  98. $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
  99. gnustat -c%s $(TOPDIR)/Makefile, \
  100. gstat -c%s $(TOPDIR)/Makefile, \
  101. stat -c%s $(TOPDIR)/Makefile))
  102. $(eval $(call SetupHostCommand,unzip,Please install 'unzip', \
  103. unzip 2>&1 | grep zipfile, \
  104. unzip))
  105. $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \
  106. bzip2 --version </dev/null))
  107. $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \
  108. wget --version | grep GNU))
  109. $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
  110. perl --version | grep "perl.*v5"))
  111. $(eval $(call SetupHostCommand,python,Please install Python 2.x, \
  112. python2.7 -V 2>&1 | grep Python, \
  113. python2 -V 2>&1 | grep Python, \
  114. python -V 2>&1 | grep Python))
  115. $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
  116. git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
  117. $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
  118. file --version 2>&1 | grep file))
  119. $(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c
  120. mkdir -p $(dir $@)
  121. $(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $<
  122. prereq: $(STAGING_DIR_HOST)/bin/mkhash
  123. # Install ldconfig stub
  124. $(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
  125. touch $(STAGING_DIR_HOST)/bin/ldconfig && \
  126. chmod +x $(STAGING_DIR_HOST)/bin/ldconfig))