1
0

prereq-build.mk 5.1 KB

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