2 # Copyright (C) 2006-2012 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
9 include $(INCLUDE_DIR
)/prereq.mk
10 include $(INCLUDE_DIR
)/host-build.mk
13 PKG_NAME
:=Build dependency
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]\.)'))
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
))
26 $(eval
$(call TestHostCommand
,proper-umask
, \
27 Please build with umask
022 - other values produce broken packages
, \
28 umask | grep
-xE
00[012][012]))
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
))
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
-))
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
))
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
++ && \
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
))
66 ifeq ($(HOST_OS
),Linux
)
67 zlib_link_flags
:= -Wl
,-Bstatic
-lz
-Wl
,-Bdynamic
69 zlib_link_flags
:= -lz
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
)))
77 $(eval
$(call TestHostCommand
,perl-thread-queue
, \
78 Please
install the Perl Thread
::Queue module
, \
79 perl
-MThread
::Queue
-e
1))
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
))
87 $(eval
$(call SetupHostCommand
,find
,Please
install GNU
'find', \
88 gfind
--version
2>&1 | grep GNU
, \
89 find
--version
2>&1 | grep GNU
))
91 $(eval
$(call SetupHostCommand
,bash
,Please
install GNU
'bash', \
92 bash
--version
2>&1 | grep GNU
))
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'))
98 $(eval
$(call SetupHostCommand
,diff
,Please
install diffutils
, \
99 gdiff
--version
2>&1 | grep diff
, \
100 diff
--version
2>&1 | grep diff
))
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'))
106 $(eval
$(call SetupHostCommand
,seq
,, \
110 $(eval
$(call SetupHostCommand
,awk
,Please
install GNU
'awk', \
111 gawk
--version
2>&1 | grep GNU
, \
112 awk
--version
2>&1 | grep GNU
))
114 $(eval
$(call SetupHostCommand
,grep
,Please
install GNU
'grep', \
115 ggrep
--version
2>&1 | grep GNU
, \
116 grep
--version
2>&1 | grep GNU
))
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 *--'))
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
))
129 $(eval
$(call SetupHostCommand
,unzip
,Please
install 'unzip', \
130 unzip
2>&1 | grep zipfile
, \
133 $(eval
$(call SetupHostCommand
,bzip2
,Please
install 'bzip2', \
134 bzip2
--version
</dev
/null
))
136 $(eval
$(call SetupHostCommand
,wget
,Please
install GNU
'wget', \
137 wget
--version | grep GNU
))
139 $(eval
$(call SetupHostCommand
,perl
,Please
install Perl
5.x
, \
140 perl
--version | grep
"perl.*v5"))
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
))
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
))
150 $(eval
$(call SetupHostCommand
,file
,Please
install the
'file' package
, \
151 file
--version
2>&1 | grep file
))
153 $(STAGING_DIR_HOST
)/bin
/mkhash
: $(SCRIPT_DIR
)/mkhash.c
155 $(CC
) -O2
-I
$(TOPDIR
)/tools
/include -o
$@
$<
157 prereq
: $(STAGING_DIR_HOST
)/bin
/mkhash
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
))