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