2
0

prereq-build.mk 5.4 KB

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