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