2 # Copyright (C) 2006-2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 ifneq ($(__prereq_inc
),1)
12 if
[ -f
$(TMP_DIR
)/.prereq-error
]; then \
14 cat
$(TMP_DIR
)/.prereq-error
; \
15 rm -f
$(TMP_DIR
)/.prereq-error
; \
29 ifeq ($$(CHECK_
$(1)),)
32 prereq-
$(1): $(if
$(PREREQ_PREV
),prereq-
$(PREREQ_PREV
)) FORCE
33 printf
"Checking '$(1)'... "
34 if
$(NO_TRACE_MAKE
) -f
$(firstword $(MAKEFILE_LIST
)) check-
$(1) >/dev
/null
2>/dev
/null
; then \
38 echo
"$(PKG_NAME): $(strip $(2))" >> $(TMP_DIR
)/.prereq-error
; \
45 .SILENT
: prereq-
$(1) check-
$(1)
58 $$(eval
$$(call Require
,$(1),$(2)))
66 $$(eval
$$(call Require
,$(1),$(2)))
70 define Require
/python3-cleanup
71 if
[ -f
"$(STAGING_DIR_HOST)/bin/python" ] && \
72 $(STAGING_DIR_HOST
)/bin
/python
-V
2>&1 | \
73 grep
-q
'Python 3'; then \
74 rm $(STAGING_DIR_HOST
)/bin
/python
; \
78 $$(eval
$$(call Require
,python3-cleanup
))
81 define QuoteHostCommand
82 '$(subst ','"'"',$(strip $(1)))'
88 define TestHostCommand
90 ($(3)) >/dev/null 2>/dev/null
93 $$(eval $$(call Require,$(1),$(2)))
99 define SetupHostCommand
101 [ -f "$(STAGING_DIR_HOST
)/bin
/$(strip $(1))" ] && exit 0; \
102 for cmd in $(call QuoteHostCommand,$(3)) $(call QuoteHostCommand,$(4)) \
103 $(call QuoteHostCommand,$(5)) $(call QuoteHostCommand,$(6)) \
104 $(call QuoteHostCommand,$(7)) $(call QuoteHostCommand,$(8)) \
105 $(call QuoteHostCommand,$(9)) $(call QuoteHostCommand,$(10)) \
106 $(call QuoteHostCommand,$(11)) $(call QuoteHostCommand,$(12)); do \
107 if [ -n "$$$$$$$$cmd" ]; then \
108 bin="$$$$$$$$(PATH
="$(subst $(space),:,$(filter-out $(STAGING_DIR_HOST)/%,$(subst :,$(space),$(PATH))))" \
109 which
"$$$$$$$${cmd%% *}")"; \
110 if [ -x "$$$$$$$$bin" ] && eval "$$$$$$$$cmd" >/dev/null 2>/dev/null; then \
111 mkdir -p "$(STAGING_DIR_HOST
)/bin
"; \
112 ln -sf "$$$$$$$$bin" "$(STAGING_DIR_HOST
)/bin
/$(strip $(1))"; \
120 $$(eval $$(call Require,$(1),$(if $(2),$(2),Missing $(1) command)))