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
12 PKG_NAME
:=Build dependency
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]\.)'))
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
))
25 $(eval
$(call TestHostCommand
,proper-umask
, \
26 Please build with umask
022 - other values produce broken packages
, \
27 umask | grep
-xE
0?
0[012][012]))
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-9]\.?)', \
32 gcc
-dumpversion | grep
-E
'^(4\.[8-9]|[5-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 gcc8
--version | grep gcc
, \
39 gcc9
--version | grep gcc
, \
40 gcc
--version | grep
-E
'Apple.(LLVM|clang)' ))
42 $(eval
$(call TestHostCommand
,working-gcc
, \
43 \nPlease reinstall the GNU C Compiler
(4.8 or later
) - \
44 it appears to be broken
, \
45 echo
'int main(int argc, char **argv) { return 0; }' | \
46 gcc
-x c
-o
$(TMP_DIR
)/a.out
-))
48 $(eval
$(call SetupHostCommand
,g
++, \
49 Please
install the GNU C
++ Compiler
(g
++) 4.8 or later
, \
50 $(CXX
) -dumpversion | grep
-E
'^(4\.[8-9]|[5-9]\.?)', \
51 g
++ -dumpversion | grep
-E
'^(4\.[8-9]|[5-9]\.?)', \
52 g
++48 --version | grep g
++, \
53 g
++49 --version | grep g
++, \
54 g
++5 --version | grep g
++, \
55 g
++6 --version | grep g
++, \
56 g
++7 --version | grep g
++, \
57 g
++8 --version | grep g
++, \
58 g
++9 --version | grep g
++, \
59 g
++ --version | grep
-E
'Apple.(LLVM|clang)' ))
61 $(eval
$(call TestHostCommand
,working-g
++, \
62 \nPlease reinstall the GNU C
++ Compiler
(4.8 or later
) - \
63 it appears to be broken
, \
64 echo
'int main(int argc, char **argv) { return 0; }' | \
65 g
++ -x c
++ -o
$(TMP_DIR
)/a.out
- -lstdc
++ && \
68 $(eval
$(call TestHostCommand
,ncurses
, \
69 Please
install ncurses.
(Missing libncurses.so or ncurses.h
), \
70 echo
'int main(int argc, char **argv) { initscr(); return 0; }' | \
71 gcc
-include ncurses.h
-x c
-o
$(TMP_DIR
)/a.out
- -lncurses
))
73 ifeq ($(HOST_OS
),Linux
)
74 zlib_link_flags
:= -Wl
,-Bstatic
-lz
-Wl
,-Bdynamic
76 zlib_link_flags
:= -lz
79 $(eval
$(call TestHostCommand
,perl-thread-queue
, \
80 Please
install the Perl Thread
::Queue module
, \
81 perl
-MThread
::Queue
-e
1))
84 $(eval
$(call SetupHostCommand
,tar,Please
install GNU
'tar', \
85 gtar
--version
2>&1 | grep GNU
, \
86 gnutar
--version
2>&1 | grep GNU
, \
87 tar --version
2>&1 | grep GNU
))
89 $(eval
$(call SetupHostCommand
,find
,Please
install GNU
'find', \
90 gfind
--version
2>&1 | grep GNU
, \
91 find
--version
2>&1 | grep GNU
))
93 $(eval
$(call SetupHostCommand
,bash
,Please
install GNU
'bash', \
94 bash
--version
2>&1 | grep GNU
))
96 $(eval
$(call SetupHostCommand
,patch
,Please
install GNU
'patch', \
97 gpatch
--version
2>&1 | grep
'Free Software Foundation', \
98 patch
--version
2>&1 | grep
'Free Software Foundation'))
100 $(eval
$(call SetupHostCommand
,diff
,Please
install diffutils
, \
101 gdiff
--version
2>&1 | grep diff
, \
102 diff
--version
2>&1 | grep diff
))
104 $(eval
$(call SetupHostCommand
,cp
,Please
install GNU fileutils
, \
105 gcp
--help
2>&1 | grep
'Copy SOURCE', \
106 cp
--help
2>&1 | grep
'Copy SOURCE'))
108 $(eval
$(call SetupHostCommand
,seq
,Please
install seq
, \
110 seq
--version
2>&1 | grep seq
))
112 $(eval
$(call SetupHostCommand
,awk
,Please
install GNU
'awk', \
113 gawk
--version
2>&1 | grep GNU
, \
114 awk
--version
2>&1 | grep GNU
))
116 $(eval
$(call SetupHostCommand
,grep
,Please
install GNU
'grep', \
117 ggrep
--version
2>&1 | grep GNU
, \
118 grep
--version
2>&1 | grep GNU
))
120 $(eval
$(call SetupHostCommand
,getopt
, \
121 Please
install an extended getopt version that supports
--long
, \
122 gnugetopt
-o t
--long
test -- --test | grep
'^ *--test *--', \
123 /usr
/local
/bin
/getopt
-o t
--long
test -- --test | grep
'^ *--test *--', \
124 getopt
-o t
--long
test -- --test | grep
'^ *--test *--'))
126 $(eval
$(call SetupHostCommand
,stat
,Cannot find a file stat utility
, \
127 gnustat
-c
%s
$(TOPDIR
)/Makefile
, \
128 gstat
-c
%s
$(TOPDIR
)/Makefile
, \
129 stat
-c
%s
$(TOPDIR
)/Makefile
))
131 $(eval
$(call SetupHostCommand
,unzip
,Please
install 'unzip', \
132 unzip
2>&1 | grep zipfile
, \
135 $(eval
$(call SetupHostCommand
,bzip2
,Please
install 'bzip2', \
136 bzip2
--version
</dev
/null
))
138 $(eval
$(call SetupHostCommand
,wget
,Please
install GNU
'wget', \
139 wget
--version | grep GNU
))
141 $(eval
$(call SetupHostCommand
,perl
,Please
install Perl
5.x
, \
142 perl
--version | grep
"perl.*v5"))
144 $(eval
$(call CleanupPython2
))
146 $(eval
$(call SetupHostCommand
,python
,Please
install Python
>= 3.5, \
147 python3.8
-V
2>&1 | grep
'Python 3', \
148 python3.7
-V
2>&1 | grep
'Python 3', \
149 python3.6
-V
2>&1 | grep
'Python 3', \
150 python3.5
-V
2>&1 | grep
'Python 3', \
151 python3
-V
2>&1 | grep
-E
'Python 3\.[5-9]\.?'))
153 $(eval
$(call SetupHostCommand
,python3
,Please
install Python
>= 3.5, \
154 python3.8
-V
2>&1 | grep
'Python 3', \
155 python3.7
-V
2>&1 | grep
'Python 3', \
156 python3.6
-V
2>&1 | grep
'Python 3', \
157 python3.5
-V
2>&1 | grep
'Python 3', \
158 python3
-V
2>&1 | grep
-E
'Python 3\.[5-9]\.?'))
160 $(eval
$(call SetupHostCommand
,git
,Please
install Git
(git-core
) >= 1.7.12.2, \
161 git
--exec-path | xargs
-I
% -- grep
-q
-- --recursive
%/git-submodule
))
163 $(eval
$(call SetupHostCommand
,file
,Please
install the
'file' package
, \
164 file
--version
2>&1 | grep file
))
166 $(STAGING_DIR_HOST
)/bin
/mkhash
: $(SCRIPT_DIR
)/mkhash.c
168 $(CC
) -O2
-I
$(TOPDIR
)/tools
/include -o
$@
$<
170 prereq
: $(STAGING_DIR_HOST
)/bin
/mkhash
172 # Install ldconfig stub
173 $(eval
$(call TestHostCommand
,ldconfig-stub
,Failed to
install stub
, \
174 touch
$(STAGING_DIR_HOST
)/bin
/ldconfig
&& \
175 chmod
+x
$(STAGING_DIR_HOST
)/bin
/ldconfig
))