diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2010-12-04 16:16:47 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2010-12-04 16:16:47 +0000 |
commit | 5f7f3dc1a377dc54eeab95ad1cd2d52026c4a0f0 (patch) | |
tree | b66c6cd46276768fc4565fc68c2433e9f9b335d6 | |
parent | 50afc47d7a20580c43e50422bf634c3318a9092e (diff) | |
download | buildsystem-5f7f3dc1a377dc54eeab95ad1cd2d52026c4a0f0.tar.gz buildsystem-5f7f3dc1a377dc54eeab95ad1cd2d52026c4a0f0.tar.bz2 |
Create pkg-config macro library
svn path=/trunk/tools/buildsystem/; revision=10966
-rw-r--r-- | makefiles/Makefile.pkgconfig | 69 | ||||
-rw-r--r-- | makefiles/Makefile.tools | 5 |
2 files changed, 74 insertions, 0 deletions
diff --git a/makefiles/Makefile.pkgconfig b/makefiles/Makefile.pkgconfig new file mode 100644 index 0000000..9e0e75d --- /dev/null +++ b/makefiles/Makefile.pkgconfig @@ -0,0 +1,69 @@ +# General purpose pkg-config macros + +# Determine if a package is available +# 1: Name of variable to assign result into +# 2: Name of package to search for +define pkg_config_package_available + ifeq ($$(PKGCONFIG),) + $$(error pkg-config is required to auto-detect package availability) + endif + + ifeq ($$(shell $$(PKGCONFIG) --exists $(2) && echo yes),yes) + $(1) := yes + else + $(1) := no + endif + +endef + +# Retrieve the version of a package +# 1: Name of variable to assign result into +# 2: Name of package to search for +define pkg_config_package_version + ifeq ($$(PKGCONFIG),) + $$(error pkg-config is required to auto-detect package version) + endif + + $(1) := $$(shell $$(PKGCONFIG) --version $(2)) + +endef + +# Test the presence of a minimum version of a package +# 1: Name of variable to assign result into +# 2: Name of package to search for +# 3: Lowest accepted version number +define pkg_config_package_min_version + ifeq ($$(PKGCONFIG),) + $$(error pkg-config is required to auto-detect package version) + endif + + ifeq ($$(shell $$(PKGCONFIG) --atleast-version=$(3) $(2) && echo yes),yes) + $(1) := yes + else + $(1) := no + endif + +endef + +# Test the presence of a minimum version of a package +# 1: Name of variable to assign result into +# 2: Name of package to search for +# 3: Lowest accepted version number +# 4: Highest accepted version number +define pkg_config_package_compare_version + ifeq ($$(PKGCONFIG),) + $$(error pkg-config is required to auto-detect package version) + endif + + ifeq ($$(shell $$(PKGCONFIG) --atleast-version=$(3) $(2) && echo yes),yes) + ifeq ($$(shell $$(PKGCONFIG) --max-version=$(4) $(2) && echo yes),yes) + $(1) := yes + else + $(1) := no + endif + else + $(1) := no + endif + +endef + diff --git a/makefiles/Makefile.tools b/makefiles/Makefile.tools index 4cf2fb1..aff1c23 100644 --- a/makefiles/Makefile.tools +++ b/makefiles/Makefile.tools @@ -372,3 +372,8 @@ ifeq ($(COMPONENT_TYPE),lib-shared) SHAREDLDPATH ?= LD_LIBRARY_PATH="$(BUILDDIR):$(LD_LIBRARY_PATH)" endif +################################################################################ +# Package config macros +################################################################################ + +include build/makefiles/Makefile.pkgconfig |