Root/include/prereq-build.mk

1#
2# Copyright (C) 2006 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7
8include $(TOPDIR)/rules.mk
9include $(INCLUDE_DIR)/prereq.mk
10include $(INCLUDE_DIR)/host.mk
11
12PKG_NAME:=Build dependency
13
14define Require/non-root
15    [ "$$(shell whoami)" != "root" ]
16endef
17$(eval $(call Require,non-root, \
18    Please do not compile as root. \
19))
20
21# Required for the toolchain
22define Require/working-make
23    $(MAKE) -v | awk '($$$$1 == "GNU") && ($$$$2 = "Make") && ($$$$3 >= "3.81") { print "ok" }' | grep ok > /dev/null
24endef
25
26$(eval $(call Require,working-make, \
27    Please install GNU make v3.81 or later. (This version has bugs) \
28))
29
30define Require/case-sensitive-fs
31    rm -f $(TMP_DIR)/test.*
32    touch $(TMP_DIR)/test.fs
33    [ \! -f $(TMP_DIR)/test.FS ]
34endef
35
36$(eval $(call Require,case-sensitive-fs, \
37    OpenWrt can only be built on a case-sensitive filesystem \
38))
39
40define Require/getopt
41    getopt --help 2>&1 | grep long >/dev/null
42endef
43$(eval $(call Require,getopt, \
44    Please install GNU getopt \
45))
46
47define Require/fileutils
48    gcp --help || cp --help
49endef
50$(eval $(call Require,fileutils, \
51    Please install GNU fileutils \
52))
53
54define Require/working-gcc
55    echo 'int main(int argc, char **argv) { return 0; }' | \
56        gcc -x c -o $(TMP_DIR)/a.out -
57endef
58
59$(eval $(call Require,working-gcc, \
60    Please install the GNU C Compiler (gcc). \
61))
62
63define Require/working-g++
64    echo 'int main(int argc, char **argv) { return 0; }' | \
65        g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \
66        $(TMP_DIR)/a.out
67endef
68
69$(eval $(call Require,working-g++, \
70    Please install the GNU C++ Compiler (g++). \
71))
72
73define Require/ncurses
74    echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \
75        gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses
76endef
77
78$(eval $(call Require,ncurses, \
79    Please install ncurses. (Missing libncurses.so or ncurses.h) \
80))
81
82
83define Require/zlib
84    echo 'int main(int argc, char **argv) { gzdopen(0, "rb"); return 0; }' | \
85        gcc -include zlib.h -x c -o $(TMP_DIR)/a.out - -lz
86endef
87
88$(eval $(call Require,zlib, \
89    Please install zlib. (Missing libz.so or zlib.h) \
90))
91
92$(eval $(call RequireCommand,gawk, \
93    Please install GNU awk. \
94))
95
96$(eval $(call RequireCommand,flex, \
97    Please install flex. \
98))
99
100$(eval $(call RequireCommand,unzip, \
101    Please install unzip. \
102))
103
104$(eval $(call RequireCommand,bzip2, \
105    Please install bzip2. \
106))
107
108$(eval $(call RequireCommand,patch, \
109    Please install patch. \
110))
111
112$(eval $(call RequireCommand,perl, \
113    Please install perl. \
114))
115
116$(eval $(call RequireCommand,python, \
117    Please install python. \
118))
119
120$(eval $(call RequireCommand,wget, \
121    Please install wget. \
122))
123
124define Require/gnutar
125    $(TAR) --version 2>&1 | grep GNU > /dev/null
126endef
127
128$(eval $(call Require,gnutar, \
129    Please install GNU tar. \
130))
131
132$(eval $(call RequireCommand,svn, \
133    Please install the subversion client. \
134))
135
136define Require/gnu-find
137    $(FIND) --version 2>/dev/null
138endef
139
140$(eval $(call Require,gnu-find, \
141    Please install GNU find \
142))
143
144define Require/getopt-extended
145    getopt --long - - >/dev/null
146endef
147
148$(eval $(call Require,getopt-extended, \
149    Please install an extended getopt version that supports --long \
150))
151

Archive Download this file



interactive