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 gnugetopt
--help
2>&1 | grep long
>/dev
/null || \
43 /usr
/local
/bin
/getopt
--help
2>&1 | grep long
>/dev
/null || \
44 getopt
--help
2>&1 | grep long
>/dev
/null
46 $(eval
$(call Require
,getopt
, \
47 Please
install GNU getopt \
50 define Require
/fileutils
51 gcp
--help || cp
--help
53 $(eval
$(call Require
,fileutils
, \
54 Please
install GNU fileutils \
57 define Require
/working-gcc
58 echo
'int main(int argc, char **argv) { return 0; }' | \
59 gcc
-x c
-o
$(TMP_DIR
)/a.out
-
62 $(eval
$(call Require
,working-gcc
, \
63 Please
install the GNU C Compiler
(gcc
). \
66 define Require
/working-g
++
67 echo
'int main(int argc, char **argv) { return 0; }' | \
68 g
++ -x c
++ -o
$(TMP_DIR
)/a.out
- -lstdc
++ && \
72 $(eval
$(call Require
,working-g
++, \
73 Please
install the GNU C
++ Compiler
(g
++). \
76 ifneq ($(HOST_STATIC_LINKING
),)
77 define Require
/working-gcc-static
78 echo
'int main(int argc, char **argv) { return 0; }' | \
79 gcc
-x c
$(HOST_STATIC_LINKING
) -o
$(TMP_DIR
)/a.out
-
82 $(eval
$(call Require
,working-gcc-static
, \
83 Please
install the static libc development package
(glibc-static on CentOS
/Fedora
/RHEL
). \
86 define Require
/working-g
++-static
87 echo
'int main(int argc, char **argv) { return 0; }' | \
88 g
++ -x c
++ $(HOST_STATIC_LINKING
) -o
$(TMP_DIR
)/a.out
- -lstdc
++ && \
92 $(eval
$(call Require
,working-g
++-static
, \
93 Please
install the static libstdc
++ development package
(libstdc
++-static on CentOS
/Fedora
/RHEL
). \
97 define Require
/ncurses
98 echo
'int main(int argc, char **argv) { initscr(); return 0; }' | \
99 gcc
-include ncurses.h
-x c
-o
$(TMP_DIR
)/a.out
- -lncurses
102 $(eval
$(call Require
,ncurses
, \
103 Please
install ncurses.
(Missing libncurses.so or ncurses.h
) \
108 echo
'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
109 gcc
-include zlib.h
-x c
-o
$(TMP_DIR
)/a.out
- -lz
112 $(eval
$(call Require
,zlib
, \
113 Please
install zlib.
(Missing libz.so or zlib.h
) \
116 ifneq ($(HOST_STATIC_LINKING
),)
117 define Require
/zlib-static
118 echo
'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
119 gcc
-include zlib.h
-x c
$(HOST_STATIC_LINKING
) -o
$(TMP_DIR
)/a.out
- -lz
122 $(eval
$(call Require
,zlib-static
, \
123 Please
install a static zlib.
(zlib-static on CentOS
/Fedora
/RHEL
). \
127 $(eval
$(call RequireCommand
,gawk
, \
128 Please
install GNU awk. \
131 $(eval
$(call RequireCommand
,unzip
, \
132 Please
install unzip. \
135 $(eval
$(call RequireCommand
,bzip2
, \
136 Please
install bzip2. \
139 $(eval
$(call RequireCommand
,perl
, \
140 Please
install perl. \
143 $(eval
$(call RequireCommand
,$(PYTHON
), \
144 Please
install python. \
147 $(eval
$(call RequireCommand
,wget
, \
148 Please
install wget. \
152 git
--version | awk
'($$$$1 == "git") && ($$$$2 == "version") && ($$$$3 >= "1.6.5") { print "ok" }' | grep ok
> /dev
/null
155 $(eval
$(call Require
,git
, \
156 Please
install git
(git-core
) v1.6
.5 or later. \
159 define Require
/gnutar
160 $(TAR
) --version
2>&1 | grep GNU
> /dev
/null
163 $(eval
$(call Require
,gnutar
, \
164 Please
install GNU
tar. \
167 $(eval
$(call RequireCommand
,svn
, \
168 Please
install the subversion client. \
171 $(eval
$(call RequireCommand
,openssl
, \
172 Please
install openssl. \
175 define Require
/gnu-find
176 $(FIND
) --version
2>/dev
/null
179 $(eval
$(call Require
,gnu-find
, \
180 Please
install GNU find \
183 define Require
/getopt-extended
184 getopt
--long
- - >/dev
/null
187 $(eval
$(call Require
,getopt-extended
, \
188 Please
install an extended getopt version that supports
--long \
191 $(eval
$(call RequireCommand
,file
, \
192 Please
install the
'file' package. \