include: set shell to "sh" for prereq tests
[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 include $(INCLUDE_DIR)/host.mk
11 include $(INCLUDE_DIR)/host-build.mk
12
13 SHELL:=sh
14 PKG_NAME:=Build dependency
15
16
17 # Required for the toolchain
18 $(eval $(call TestHostCommand,working-make, \
19         Please install GNU make v3.81 or later. (This version has bugs), \
20         $(MAKE) -v | grep -E 'Make (3\.8[1-9]|3\.9[0-9]|[4-9]\.)'))
21
22 $(eval $(call TestHostCommand,case-sensitive-fs, \
23         OpenWrt can only be built on a case-sensitive filesystem, \
24         rm -f $(TMP_DIR)/test.*; touch $(TMP_DIR)/test.fs; \
25                 test ! -f $(TMP_DIR)/test.FS))
26
27 $(eval $(call SetupHostCommand,gcc, \
28         Please install the GNU C Compiler (gcc), \
29         $(CC) --version | grep gcc, \
30         gcc --version | grep gcc, \
31         gcc49 --version | grep gcc, \
32         gcc48 --version | grep gcc, \
33         gcc47 --version | grep gcc, \
34         gcc46 --version | grep gcc))
35
36 $(eval $(call TestHostCommand,working-gcc, \
37         Please reinstall the GNU C Compiler - it appears to be broken, \
38         echo 'int main(int argc, char **argv) { return 0; }' | \
39                 gcc -x c -o $(TMP_DIR)/a.out -))
40
41 $(eval $(call SetupHostCommand,g++, \
42         Please install the GNU C++ Compiler (g++), \
43         $(CXX) --version | grep g++, \
44         g++ --version | grep g++, \
45         g++49 --version | grep g++, \
46         g++48 --version | grep g++, \
47         g++47 --version | grep g++, \
48         g++46 --version | grep g++))
49
50 $(eval $(call TestHostCommand,working-g++, \
51         Please reinstall the GNU C++ Compiler - it appears to be broken, \
52         echo 'int main(int argc, char **argv) { return 0; }' | \
53                 g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
54                 $(TMP_DIR)/a.out))
55
56 $(eval $(call TestHostCommand,ncurses, \
57         Please install ncurses. (Missing libncurses.so or ncurses.h), \
58         echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
59                 gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses))
60
61 $(eval $(call TestHostCommand,zlib, \
62         Please install zlib. (Missing libz.so or zlib.h), \
63         echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
64                 gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - -lz))
65
66 $(eval $(call TestHostCommand,libssl, \
67         Please install the openssl library (with development headers), \
68         echo 'int main(int argc, char **argv) { SSL_library_init(); return 0; }' | \
69                 gcc -include openssl/ssl.h -x c -o $(TMP_DIR)/a.out - -lcrypto -lssl))
70
71 ifneq ($(HOST_STATIC_LINKING),)
72   $(eval $(call TestHostCommand,working-gcc-static, \
73         Please install the static libc development package (glibc-static on CentOS/Fedora/RHEL)., \
74         echo 'int main(int argc, char **argv) { return 0; }' | \
75                 gcc -x c $(HOST_STATIC_LINKING) -o $(TMP_DIR)/a.out -))
76
77   $(eval $(call TestHostCommand,working-g++-static, \
78         Please install the static libstdc++ development package (libstdc++-static on CentOS/Fedora/RHEL)., \
79         echo 'int main(int argc, char **argv) { return 0; }' | \
80                 g++ -x c++ $(HOST_STATIC_LINKING) -o $(TMP_DIR)/a.out - -lstdc++ && \
81                 $(TMP_DIR)/a.out))
82
83   $(eval $(call TestHostCommand,zlib-static, \
84         Please install a static zlib. (zlib-static on CentOS/Fedora/RHEL)., \
85         echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
86                 gcc -include zlib.h -x c $(HOST_STATIC_LINKING) -o $(TMP_DIR)/a.out - -lz))
87 endif
88
89
90 $(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \
91         gtar --version 2>&1 | grep GNU, \
92         gnutar --version 2>&1 | grep GNU, \
93         tar --version 2>&1 | grep GNU))
94
95 $(eval $(call SetupHostCommand,find,Please install GNU 'find', \
96         gfind --version 2>&1 | grep GNU, \
97         find --version 2>&1 | grep GNU))
98
99 $(eval $(call SetupHostCommand,bash,Please install GNU 'bash', \
100         bash --version 2>&1 | grep GNU))
101
102 $(eval $(call SetupHostCommand,patch,Please install GNU 'patch', \
103         gpatch --version 2>&1 | grep 'Free Software Foundation', \
104         patch --version 2>&1 | grep 'Free Software Foundation'))
105
106 $(eval $(call SetupHostCommand,diff,Please install diffutils, \
107         gdiff --version 2>&1 | grep diff, \
108         diff --version 2>&1 | grep diff))
109
110 $(eval $(call SetupHostCommand,cp,Please install GNU fileutils, \
111         gcp --help, \
112         cp --help))
113
114 $(eval $(call SetupHostCommand,seq,, \
115         gseq --version, \
116         seq --version))
117
118 $(eval $(call SetupHostCommand,awk,Please install GNU 'awk', \
119         gawk --version 2>&1 | grep GNU, \
120         awk --version 2>&1 | grep GNU))
121
122 $(eval $(call SetupHostCommand,grep,Please install GNU 'grep', \
123         ggrep --version 2>&1 | grep GNU, \
124         grep --version 2>&1 | grep GNU))
125
126 $(eval $(call SetupHostCommand,getopt, \
127         Please install an extended getopt version that supports --long, \
128         gnugetopt -o t --long test -- --test | grep '^ *--test *--', \
129         /usr/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--', \
130         getopt -o t --long test -- --test | grep '^ *--test *--'))
131
132 $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
133         gnustat -c%s $(TMP_DIR)/.host.mk, \
134         gstat -c%s $(TMP_DIR)/.host.mk, \
135         stat -c%s $(TMP_DIR)/.host.mk))
136
137 $(eval $(call SetupHostCommand,md5sum,, \
138         gmd5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \
139         md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e, \
140         $(SCRIPT_DIR)/md5sum /dev/null | grep d41d8cd98f00b204e9800998ecf8427e))
141
142 $(eval $(call SetupHostCommand,unzip,Please install 'unzip', \
143         unzip 2>&1 | grep zipfile, \
144         unzip))
145
146 $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \
147         bzip2 --version </dev/null))
148
149 $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \
150         wget --version | grep GNU))
151
152 $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
153         perl --version | grep "perl 5"))
154
155 $(eval $(call SetupHostCommand,python,Please install Python 2.x, \
156         python2.7 -V 2>&1 | grep Python, \
157         python2 -V 2>&1 | grep Python, \
158         python -V 2>&1 | grep Python))
159
160 $(eval $(call SetupHostCommand,svn,Please install the Subversion client, \
161         svn --version | grep Subversion))
162
163 $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.6.5, \
164         git clone --help | grep -- --recursive))
165
166 $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
167         file --version | grep file))
168
169 $(eval $(call SetupHostCommand,openssl,Please install the 'openssl' utility, \
170         openssl version | grep OpenSSL))
171
172
173 # Install ldconfig stub
174 $(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
175         touch $(STAGING_DIR_HOST)/bin/ldconfig && \
176         chmod +x $(STAGING_DIR_HOST)/bin/ldconfig))