1 ################################################################################
3 # This file contains various utility functions used by the package
4 # infrastructure, or by the packages themselves.
6 ################################################################################
9 # Manipulation of .config files based on the Kconfig
10 # infrastructure. Used by the BusyBox package, the Linux kernel
14 define KCONFIG_ENABLE_OPT
# (option, file)
15 $(SED
) "/\\<$(1)\\>/d" $(2)
19 define KCONFIG_SET_OPT
# (option, value, file)
20 $(SED
) "/\\<$(1)\\>/d" $(3)
21 echo
'$(1)=$(2)' >> $(3)
24 define KCONFIG_DISABLE_OPT
# (option, file)
25 $(SED
) "/\\<$(1)\\>/d" $(2)
26 echo
'# $(1) is not set' >> $(2)
29 # Helper functions to determine the name of a package and its
30 # directory from its makefile directory, using the $(MAKEFILE_LIST)
31 # variable provided by make. This is used by the *-package macros to
32 # automagically find where the package is located.
33 pkgdir
= $(dir $(lastword
$(MAKEFILE_LIST
)))
34 pkgname
= $(lastword
$(subst /, ,$(pkgdir
)))
36 # Define extractors for different archive suffixes
37 INFLATE.bz2
= $(BZCAT
)
39 INFLATE.lzma
= $(XZCAT
)
40 INFLATE.tbz
= $(BZCAT
)
41 INFLATE.tbz2
= $(BZCAT
)
45 # suitable-extractor(filename): returns extractor based on suffix
46 suitable-extractor
= $(INFLATE
$(suffix $(1)))
48 # check-deprecated-variable -- throw an error on deprecated variables
50 # $(eval $(call check-deprecated-variable,FOO_MAKE_OPT,FOO_MAKE_OPTS))
51 define check-deprecated-variable
# (deprecated var, new var)
52 ifneq ($$(origin $(1)),undefined
)
53 $$(error Package error
: use
$(2) instead of
$(1). Please fix your .mk file
)
58 # legal-info helper functions
60 LEGAL_INFO_SEPARATOR
= "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
62 define legal-warning
# text
63 echo
"WARNING: $(1)" >>$(LEGAL_WARNINGS
)
66 define legal-warning-pkg
# pkg, text
67 echo
"WARNING: $(1): $(2)" >>$(LEGAL_WARNINGS
)
70 define legal-warning-nosource
# pkg, {local|override}
71 $(call legal-warning-pkg
,$(1),sources not saved
($(2) packages not handled
))
74 define legal-manifest
# pkg, version, license, license-files, source, url, {HOST|TARGET}
75 echo
'"$(1)","$(2)","$(3)","$(4)","$(5)","$(6)"' >>$(LEGAL_MANIFEST_CSV_
$(7))
78 define legal-license-file
# pkg, filename, file-fullpath, {HOST|TARGET}
79 mkdir
-p
$(LICENSE_FILES_DIR_
$(4))/$(1)/$(dir $(2)) && \
80 cp
$(3) $(LICENSE_FILES_DIR_
$(4))/$(1)/$(2)