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.82 or later.
(This version has bugs
), \
18 $(MAKE
) -v | grep
-E
'Make (3\.8[2-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]))
30 $(eval
$(call SetupHostCommand
,gcc
, \
31 Please
install the GNU C Compiler
(gcc
) 4.8 or later
, \
32 $(CC
) -dumpversion | grep
-E
'^(4\.[8-9]|[5-9]\.?|10\.?)', \
33 gcc
-dumpversion | grep
-E
'^(4\.[8-9]|[5-9]\.?|10\.?)', \
34 gcc
--version | grep
-E
'Apple.(LLVM|clang)' ))
36 $(eval
$(call TestHostCommand
,working-gcc
, \
37 \nPlease reinstall the GNU C Compiler
(4.8 or later
) - \
38 it appears to be broken
, \
39 echo
'int main(int argc, char **argv) { return 0; }' | \
40 gcc
-x c
-o
$(TMP_DIR
)/a.out
-))
44 $(eval
$(call SetupHostCommand
,g
++, \
45 Please
install the GNU C
++ Compiler
(g
++) 4.8 or later
, \
46 $(CXX
) -dumpversion | grep
-E
'^(4\.[8-9]|[5-9]\.?|10\.?)', \
47 g
++ -dumpversion | grep
-E
'^(4\.[8-9]|[5-9]\.?|10\.?)', \
48 g
++ --version | grep
-E
'Apple.(LLVM|clang)' ))
50 $(eval
$(call TestHostCommand
,working-g
++, \
51 \nPlease reinstall the GNU C
++ Compiler
(4.8 or later
) - \
52 it appears to be broken
, \
53 echo
'int main(int argc, char **argv) { return 0; }' | \
54 g
++ -x c
++ -o
$(TMP_DIR
)/a.out
- -lstdc
++ && \
59 $(eval
$(call TestHostCommand
,ncurses
, \
60 Please
install ncurses.
(Missing libncurses.so or ncurses.h
), \
61 echo
'int main(int argc, char **argv) { initscr(); return 0; }' | \
62 gcc
-include ncurses.h
-x c
-o
$(TMP_DIR
)/a.out
- -lncurses
))
65 ifeq ($(HOST_OS
),Linux
)
66 zlib_link_flags
:= -Wl
,-Bstatic
-lz
-Wl
,-Bdynamic
68 zlib_link_flags
:= -lz
71 $(eval
$(call TestHostCommand
,perl-data-dumper
, \
72 Please
install the Perl Data
::Dumper module
, \
73 perl
-MData
::Dumper
-e
1))
75 $(eval
$(call TestHostCommand
,perl-thread-queue
, \
76 Please
install the Perl Thread
::Queue module
, \
77 perl
-MThread
::Queue
-e
1))
80 $(eval
$(call SetupHostCommand
,tar,Please
install GNU
'tar', \
81 gtar
--version
2>&1 | grep GNU
, \
82 gnutar
--version
2>&1 | grep GNU
, \
83 tar --version
2>&1 | grep GNU
))
85 $(eval
$(call SetupHostCommand
,find
,Please
install GNU
'find', \
86 gfind
--version
2>&1 | grep GNU
, \
87 find
--version
2>&1 | grep GNU
))
89 $(eval
$(call SetupHostCommand
,bash
,Please
install GNU
'bash', \
90 bash
--version
2>&1 | grep GNU
))
92 $(eval
$(call SetupHostCommand
,xargs
, \
93 Please
install 'xargs' that supports
'-r/--no-run-if-empty', \
94 gxargs
-r
--version
, \
97 $(eval
$(call SetupHostCommand
,patch
,Please
install GNU
'patch', \
98 gpatch
--version
2>&1 | grep
'Free Software Foundation', \
99 patch
--version
2>&1 | grep
'Free Software Foundation'))
101 $(eval
$(call SetupHostCommand
,diff
,Please
install diffutils
, \
102 gdiff
--version
2>&1 | grep diff
, \
103 diff
--version
2>&1 | grep diff
))
105 $(eval
$(call SetupHostCommand
,cp
,Please
install GNU fileutils
, \
106 gcp
--help
2>&1 | grep
'Copy SOURCE', \
107 cp
--help
2>&1 | grep
'Copy SOURCE'))
109 $(eval
$(call SetupHostCommand
,seq
,Please
install seq
, \
111 seq
--version
2>&1 | grep seq
))
113 $(eval
$(call SetupHostCommand
,awk
,Please
install GNU
'awk', \
114 gawk
--version
2>&1 | grep GNU
, \
115 awk
--version
2>&1 | grep GNU
))
117 $(eval
$(call SetupHostCommand
,grep
,Please
install GNU
'grep', \
118 ggrep
--version
2>&1 | grep GNU
, \
119 grep
--version
2>&1 | grep GNU
))
121 $(eval
$(call SetupHostCommand
,egrep
,Please
install GNU
'grep', \
122 gegrep
--version
2>&1 | grep GNU
, \
123 egrep
--version
2>&1 | grep GNU
))
125 $(eval
$(call SetupHostCommand
,getopt
, \
126 Please
install an extended getopt version that supports
--long
, \
127 gnugetopt
-o t
--long
test -- --test | grep
'^ *--test *--', \
128 getopt
-o t
--long
test -- --test | grep
'^ *--test *--', \
129 /usr
/local
/opt
/gnu-getopt
/bin
/getopt
-o t
--long
test -- --test | grep
'^ *--test *--'))
131 $(eval
$(call SetupHostCommand
,stat
,Cannot find a file stat utility
, \
132 gnustat
-c
%s
$(TOPDIR
)/Makefile
, \
133 gstat
-c
%s
$(TOPDIR
)/Makefile
, \
134 stat
-c
%s
$(TOPDIR
)/Makefile
))
136 $(eval
$(call SetupHostCommand
,unzip
,Please
install 'unzip', \
137 unzip
2>&1 | grep zipfile
, \
140 $(eval
$(call SetupHostCommand
,bzip2
,Please
install 'bzip2', \
141 bzip2
--version
</dev
/null
))
143 $(eval
$(call SetupHostCommand
,wget
,Please
install GNU
'wget', \
144 wget
--version | grep GNU
))
146 $(eval
$(call SetupHostCommand
,perl
,Please
install Perl
5.x
, \
147 perl
--version | grep
"perl.*v5"))
149 $(eval
$(call CleanupPython2
))
151 $(eval
$(call SetupHostCommand
,python
,Please
install Python
>= 3.5, \
152 python3.8
-V
2>&1 | grep
'Python 3', \
153 python3.7
-V
2>&1 | grep
'Python 3', \
154 python3.6
-V
2>&1 | grep
'Python 3', \
155 python3.5
-V
2>&1 | grep
'Python 3', \
156 python3
-V
2>&1 | grep
-E
'Python 3\.[5-9]\.?'))
158 $(eval
$(call SetupHostCommand
,python3
,Please
install Python
>= 3.5, \
159 python3.8
-V
2>&1 | grep
'Python 3', \
160 python3.7
-V
2>&1 | grep
'Python 3', \
161 python3.6
-V
2>&1 | grep
'Python 3', \
162 python3.5
-V
2>&1 | grep
'Python 3', \
163 python3
-V
2>&1 | grep
-E
'Python 3\.[5-9]\.?'))
165 $(eval
$(call SetupHostCommand
,git
,Please
install Git
(git-core
) >= 1.7.12.2, \
166 git
--exec-path | xargs
-I
% -- grep
-q
-- --recursive
%/git-submodule
))
168 $(eval
$(call SetupHostCommand
,file
,Please
install the
'file' package
, \
169 file
--version
2>&1 | grep file
))
171 $(STAGING_DIR_HOST
)/bin
/mkhash
: $(SCRIPT_DIR
)/mkhash.c
173 $(CC
) -O2
-I
$(TOPDIR
)/tools
/include -o
$@
$<
175 prereq
: $(STAGING_DIR_HOST
)/bin
/mkhash
177 # Install ldconfig stub
178 $(eval
$(call TestHostCommand
,ldconfig-stub
,Failed to
install stub
, \
179 touch
$(STAGING_DIR_HOST
)/bin
/ldconfig
&& \
180 chmod
+x
$(STAGING_DIR_HOST
)/bin
/ldconfig
))