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
)
40 INFLATE.lzma
= $(XZCAT
)
41 INFLATE.tbz
= $(BZCAT
)
42 INFLATE.tbz2
= $(BZCAT
)
46 # suitable-extractor(filename): returns extractor based on suffix
47 suitable-extractor
= $(INFLATE
$(suffix $(1)))
49 # extractor-dependency(filename): returns extractor for 'filename' if the
50 # extractor is a dependency. If we build the extractor return nothing.
51 # $(firstword) is used here because the extractor can have arguments, like
52 # ZCAT="gzip -d -c", and to check for the dependency we only want 'gzip'.
53 extractor-dependency
= $(firstword $(INFLATE
$(filter-out \
54 $(EXTRACTOR_DEPENDENCY_PRECHECKED_EXTENSIONS
),$(suffix $(1)))))
56 # check-deprecated-variable -- throw an error on deprecated variables
58 # $(eval $(call check-deprecated-variable,FOO_MAKE_OPT,FOO_MAKE_OPTS))
59 define check-deprecated-variable
# (deprecated var, new var)
60 ifneq ($$(origin $(1)),undefined
)
61 $$(error Package error
: use
$(2) instead of
$(1). Please fix your .mk file
)
66 # legal-info helper functions
68 LEGAL_INFO_SEPARATOR
= "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
70 define legal-warning
# text
71 echo
"WARNING: $(1)" >>$(LEGAL_WARNINGS
)
74 define legal-warning-pkg
# pkg, text
75 echo
"WARNING: $(1): $(2)" >>$(LEGAL_WARNINGS
)
78 define legal-warning-nosource
# pkg, {local|override}
79 $(call legal-warning-pkg
,$(1),sources not saved
($(2) packages not handled
))
82 define legal-manifest
# pkg, version, license, license-files, source, url, {HOST|TARGET}
83 echo
'"$(1)","$(2)","$(3)","$(4)","$(5)","$(6)"' >>$(LEGAL_MANIFEST_CSV_
$(7))
86 define legal-license-file
# pkg, filename, file-fullpath, {HOST|TARGET}
87 mkdir
-p
$(LICENSE_FILES_DIR_
$(4))/$(1)/$(dir $(2)) && \
88 cp
$(3) $(LICENSE_FILES_DIR_
$(4))/$(1)/$(2)