prereq-build.mk 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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]\.?|1[0-9]\.?)', \
  25. gcc -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|1[0-9]\.?)', \
  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]\.?|1[0-9]\.?)', \
  35. g++ -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|1[0-9]\.?)', \
  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-data-dumper, \
  53. Please install the Perl Data::Dumper module, \
  54. perl -MData::Dumper -e 1))
  55. $(eval $(call TestHostCommand,perl-findbin, \
  56. Please install the Perl FindBin module, \
  57. perl -MFindBin -e 1))
  58. $(eval $(call TestHostCommand,perl-file-copy, \
  59. Please install the Perl File::Copy module, \
  60. perl -MFile::Copy -e 1))
  61. $(eval $(call TestHostCommand,perl-file-compare, \
  62. Please install the Perl File::Compare module, \
  63. perl -MFile::Compare -e 1))
  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 $(TOPDIR)/Makefile, \
  101. gstat -c%s $(TOPDIR)/Makefile, \
  102. stat -c%s $(TOPDIR)/Makefile))
  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 CleanupPython2))
  113. $(eval $(call SetupHostCommand,python,Please install Python >= 3.5, \
  114. python3.12 -V 2>&1 | grep 'Python 3', \
  115. python3.11 -V 2>&1 | grep 'Python 3', \
  116. python3.10 -V 2>&1 | grep 'Python 3', \
  117. python3.9 -V 2>&1 | grep 'Python 3', \
  118. python3.8 -V 2>&1 | grep 'Python 3', \
  119. python3.7 -V 2>&1 | grep 'Python 3', \
  120. python3.6 -V 2>&1 | grep 'Python 3', \
  121. python3.5 -V 2>&1 | grep 'Python 3', \
  122. python3 -V 2>&1 | grep -E 'Python 3\.([5-9]|10)\.?'))
  123. $(eval $(call TestHostCommand,python3-jsmin, \
  124. Please install the jsmin Python module, \
  125. python3 -c "import jsmin" 2>&1 ))
  126. $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
  127. git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
  128. $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
  129. file --version 2>&1 | grep file))
  130. $(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c
  131. mkdir -p $(dir $@)
  132. $(CC) -I$(TOPDIR)/tools/include -o $@ $<
  133. prereq: $(STAGING_DIR_HOST)/bin/mkhash
  134. # Install ldconfig stub
  135. $(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
  136. touch $(STAGING_DIR_HOST)/bin/ldconfig && \
  137. chmod +x $(STAGING_DIR_HOST)/bin/ldconfig))