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.mk
11 include $(INCLUDE_DIR
)/host-build.mk
13 PKG_NAME
:=Build dependency
15 define Require
/non-root
16 [ "$$(shell whoami)" != "root" ]
18 $(eval
$(call Require
,non-root
, \
19 Please do not compile
as root. \
22 # Required for the toolchain
23 define Require
/working-make
24 $(MAKE
) -v | awk
'($$$$1 == "GNU") && ($$$$2 == "Make") && ($$$$3 >= "3.81") { print "ok" }' | grep ok
> /dev
/null
27 $(eval
$(call Require
,working-make
, \
28 Please
install GNU make v3.81 or later.
(This version has bugs
) \
31 define Require
/case-sensitive-fs
32 rm -f
$(TMP_DIR
)/test.
*
33 touch
$(TMP_DIR
)/test.fs
34 [ \
! -f
$(TMP_DIR
)/test.FS
]
37 $(eval
$(call Require
,case-sensitive-fs
, \
38 OpenWrt can only be built on a case-sensitive filesystem \
42 getopt
--help
2>&1 | grep long
>/dev
/null
44 $(eval
$(call Require
,getopt
, \
45 Please
install GNU getopt \
48 define Require
/fileutils
49 gcp
--help || cp
--help
51 $(eval
$(call Require
,fileutils
, \
52 Please
install GNU fileutils \
55 define Require
/working-gcc
56 echo
'int main(int argc, char **argv) { return 0; }' | \
57 gcc
-x c
-o
$(TMP_DIR
)/a.out
-
60 $(eval
$(call Require
,working-gcc
, \
61 Please
install the GNU C Compiler
(gcc
). \
64 define Require
/working-g
++
65 echo
'int main(int argc, char **argv) { return 0; }' | \
66 g
++ -x c
++ -o
$(TMP_DIR
)/a.out
- -lstdc
++ && \
70 $(eval
$(call Require
,working-g
++, \
71 Please
install the GNU C
++ Compiler
(g
++). \
74 ifneq ($(HOST_STATIC_LINKING
),)
75 define Require
/working-gcc-static
76 echo
'int main(int argc, char **argv) { return 0; }' | \
77 gcc
-x c
$(HOST_STATIC_LINKING
) -o
$(TMP_DIR
)/a.out
-
80 $(eval
$(call Require
,working-gcc-static
, \
81 Please
install the static libc development package
(glibc-static on CentOS
/Fedora
/RHEL
). \
84 define Require
/working-g
++-static
85 echo
'int main(int argc, char **argv) { return 0; }' | \
86 g
++ -x c
++ $(HOST_STATIC_LINKING
) -o
$(TMP_DIR
)/a.out
- -lstdc
++ && \
90 $(eval
$(call Require
,working-g
++-static
, \
91 Please
install the static libstdc
++ development package
(libstdc
++-static on CentOS
/Fedora
/RHEL
). \
95 define Require
/ncurses
96 echo
'int main(int argc, char **argv) { initscr(); return 0; }' | \
97 gcc
-include ncurses.h
-x c
-o
$(TMP_DIR
)/a.out
- -lncurses
100 $(eval
$(call Require
,ncurses
, \
101 Please
install ncurses.
(Missing libncurses.so or ncurses.h
) \
106 echo
'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
107 gcc
-include zlib.h
-x c
-o
$(TMP_DIR
)/a.out
- -lz
110 $(eval
$(call Require
,zlib
, \
111 Please
install zlib.
(Missing libz.so or zlib.h
) \
114 ifneq ($(HOST_STATIC_LINKING
),)
115 define Require
/zlib-static
116 echo
'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
117 gcc
-include zlib.h
-x c
$(HOST_STATIC_LINKING
) -o
$(TMP_DIR
)/a.out
- -lz
120 $(eval
$(call Require
,zlib-static
, \
121 Please
install a static zlib.
(zlib-static on CentOS
/Fedora
/RHEL
). \
125 $(eval
$(call RequireCommand
,gawk
, \
126 Please
install GNU awk. \
129 $(eval
$(call RequireCommand
,unzip
, \
130 Please
install unzip. \
133 $(eval
$(call RequireCommand
,bzip2
, \
134 Please
install bzip2. \
137 $(eval
$(call RequireCommand
,patch
, \
138 Please
install patch. \
141 $(eval
$(call RequireCommand
,perl
, \
142 Please
install perl. \
145 $(eval
$(call RequireCommand
,python
, \
146 Please
install python. \
149 $(eval
$(call RequireCommand
,wget
, \
150 Please
install wget. \
154 git
--version | awk
'($$$$1 == "git") && ($$$$2 == "version") && ($$$$3 >= "1.6.5") { print "ok" }' | grep ok
> /dev
/null
157 $(eval
$(call Require
,git
, \
158 Please
install git
(git-core
) v1.6
.5 or later. \
161 define Require
/gnutar
162 $(TAR
) --version
2>&1 | grep GNU
> /dev
/null
165 $(eval
$(call Require
,gnutar
, \
166 Please
install GNU
tar. \
169 $(eval
$(call RequireCommand
,svn
, \
170 Please
install the subversion client. \
173 define Require
/gnu-find
174 $(FIND
) --version
2>/dev
/null
177 $(eval
$(call Require
,gnu-find
, \
178 Please
install GNU find \
181 define Require
/getopt-extended
182 getopt
--long
- - >/dev
/null
185 $(eval
$(call Require
,getopt-extended
, \
186 Please
install an extended getopt version that supports
--long \