harfbuzz: security bump to version 1.4.4
[buildroot-gz.git] / package / pkg-utils.mk
blobc95e77953b05edeeb872eb242d0ac9542b0375e3
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
11 # package, and more.
14 define KCONFIG_ENABLE_OPT # (option, file)
15 $(SED) "/\\<$(1)\\>/d" $(2)
16 echo '$(1)=y' >> $(2)
17 endef
19 define KCONFIG_SET_OPT # (option, value, file)
20 $(SED) "/\\<$(1)\\>/d" $(3)
21 echo '$(1)=$(2)' >> $(3)
22 endef
24 define KCONFIG_DISABLE_OPT # (option, file)
25 $(SED) "/\\<$(1)\\>/d" $(2)
26 echo '# $(1) is not set' >> $(2)
27 endef
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)
38 INFLATE.gz = $(ZCAT)
39 INFLATE.lz = $(LZCAT)
40 INFLATE.lzma = $(XZCAT)
41 INFLATE.tbz = $(BZCAT)
42 INFLATE.tbz2 = $(BZCAT)
43 INFLATE.tgz = $(ZCAT)
44 INFLATE.xz = $(XZCAT)
45 INFLATE.tar = cat
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
57 # example:
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)
62 endif
63 endef
66 # legal-info helper functions
68 LEGAL_INFO_SEPARATOR = "::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::"
70 define legal-warning # text
71 echo "WARNING: $(1)" >>$(LEGAL_WARNINGS)
72 endef
74 define legal-warning-pkg # pkg, text
75 echo "WARNING: $(1): $(2)" >>$(LEGAL_WARNINGS)
76 endef
78 define legal-warning-nosource # pkg, {local|override}
79 $(call legal-warning-pkg,$(1),sources not saved ($(2) packages not handled))
80 endef
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))
84 endef
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)
89 endef