target/ar71xx: ozonet works for kernel 4.9 (tested on BulletM-5)
[lede-git/.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         LEDE 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), \
31         $(CC) --version | grep gcc, \
32         gcc --version | grep gcc, \
33         gcc49 --version | grep gcc, \
34         gcc48 --version | grep gcc, \
35         gcc47 --version | grep gcc, \
36         gcc46 --version | grep gcc, \
37         gcc --version | grep Apple.LLVM ))
38
39 $(eval $(call TestHostCommand,working-gcc, \
40         Please reinstall the GNU C Compiler - it appears to be broken, \
41         echo 'int main(int argc, char **argv) { return 0; }' | \
42                 gcc -x c -o $(TMP_DIR)/a.out -))
43
44 $(eval $(call SetupHostCommand,g++, \
45         Please install the GNU C++ Compiler (g++), \
46         $(CXX) --version | grep g++, \
47         g++ --version | grep g++, \
48         g++49 --version | grep g++, \
49         g++48 --version | grep g++, \
50         g++47 --version | grep g++, \
51         g++46 --version | grep g++, \
52         g++ --version | grep Apple.LLVM ))
53
54 $(eval $(call TestHostCommand,working-g++, \
55         Please reinstall the GNU C++ Compiler - it appears to be broken, \
56         echo 'int main(int argc, char **argv) { return 0; }' | \
57                 g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
58                 $(TMP_DIR)/a.out))
59
60 $(eval $(call TestHostCommand,ncurses, \
61         Please install ncurses. (Missing libncurses.so or ncurses.h), \
62         echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
63                 gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses))
64
65 ifeq ($(HOST_OS),Linux)
66   zlib_link_flags := -Wl,-Bstatic -lz -Wl,-Bdynamic
67 else
68   zlib_link_flags := -lz
69 endif
70
71 $(eval $(call TestHostCommand,zlib, \
72         Please install a static zlib. (Missing libz.a or zlib.h), \
73         echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
74                 gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - $(zlib_link_flags)))
75
76 $(eval $(call TestHostCommand,perl-thread-queue, \
77         Please install the Perl Thread::Queue module, \
78         perl -MThread::Queue -e 1))
79
80
81 $(eval $(call SetupHostCommand,tar,Please install GNU 'tar', \
82         gtar --version 2>&1 | grep GNU, \
83         gnutar --version 2>&1 | grep GNU, \
84         tar --version 2>&1 | grep GNU))
85
86 $(eval $(call SetupHostCommand,find,Please install GNU 'find', \
87         gfind --version 2>&1 | grep GNU, \
88         find --version 2>&1 | grep GNU))
89
90 $(eval $(call SetupHostCommand,bash,Please install GNU 'bash', \
91         bash --version 2>&1 | grep GNU))
92
93 $(eval $(call SetupHostCommand,patch,Please install GNU 'patch', \
94         gpatch --version 2>&1 | grep 'Free Software Foundation', \
95         patch --version 2>&1 | grep 'Free Software Foundation'))
96
97 $(eval $(call SetupHostCommand,diff,Please install diffutils, \
98         gdiff --version 2>&1 | grep diff, \
99         diff --version 2>&1 | grep diff))
100
101 $(eval $(call SetupHostCommand,cp,Please install GNU fileutils, \
102         gcp --help 2>&1 | grep 'Copy SOURCE', \
103         cp --help 2>&1 | grep 'Copy SOURCE'))
104
105 $(eval $(call SetupHostCommand,seq,, \
106         gseq --version, \
107         seq --version))
108
109 $(eval $(call SetupHostCommand,awk,Please install GNU 'awk', \
110         gawk --version 2>&1 | grep GNU, \
111         awk --version 2>&1 | grep GNU))
112
113 $(eval $(call SetupHostCommand,grep,Please install GNU 'grep', \
114         ggrep --version 2>&1 | grep GNU, \
115         grep --version 2>&1 | grep GNU))
116
117 $(eval $(call SetupHostCommand,getopt, \
118         Please install an extended getopt version that supports --long, \
119         gnugetopt -o t --long test -- --test | grep '^ *--test *--', \
120         /usr/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--', \
121         getopt -o t --long test -- --test | grep '^ *--test *--'))
122
123 $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \
124         gnustat -c%s $(TOPDIR)/Makefile, \
125         gstat -c%s $(TOPDIR)/Makefile, \
126         stat -c%s $(TOPDIR)/Makefile))
127
128 $(eval $(call SetupHostCommand,unzip,Please install 'unzip', \
129         unzip 2>&1 | grep zipfile, \
130         unzip))
131
132 $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \
133         bzip2 --version </dev/null))
134
135 $(eval $(call SetupHostCommand,wget,Please install GNU 'wget', \
136         wget --version | grep GNU))
137
138 $(eval $(call SetupHostCommand,perl,Please install Perl 5.x, \
139         perl --version | grep "perl.*v5"))
140
141 $(eval $(call SetupHostCommand,python,Please install Python 2.x, \
142         python2.7 -V 2>&1 | grep Python, \
143         python2 -V 2>&1 | grep Python, \
144         python -V 2>&1 | grep Python))
145
146 $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \
147         git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule))
148
149 $(eval $(call SetupHostCommand,file,Please install the 'file' package, \
150         file --version 2>&1 | grep file))
151
152 $(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c
153         mkdir -p $(dir $@)
154         $(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $<
155
156 prereq: $(STAGING_DIR_HOST)/bin/mkhash
157
158 # Install ldconfig stub
159 $(eval $(call TestHostCommand,ldconfig-stub,Failed to install stub, \
160         touch $(STAGING_DIR_HOST)/bin/ldconfig && \
161         chmod +x $(STAGING_DIR_HOST)/bin/ldconfig))