summaryrefslogtreecommitdiffhomepage
path: root/pkg/rpm/Makefile
diff options
context:
space:
mode:
authorAndrei Belov <defan@nginx.com>2018-01-22 16:39:31 +0300
committerAndrei Belov <defan@nginx.com>2018-01-22 16:39:31 +0300
commitbe8df0631a6fa4e5afa8c03ed5b84cec72da20d4 (patch)
tree756001955deac1252d1890cae951d397a502103d /pkg/rpm/Makefile
parentd1f29ed77edd5833d1e84f20ed7032377d5de960 (diff)
downloadunit-be8df0631a6fa4e5afa8c03ed5b84cec72da20d4.tar.gz
unit-be8df0631a6fa4e5afa8c03ed5b84cec72da20d4.tar.bz2
Packages: improved per-module dependency tracking.
Diffstat (limited to 'pkg/rpm/Makefile')
-rw-r--r--pkg/rpm/Makefile26
1 files changed, 23 insertions, 3 deletions
diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile
index 2a839444..aad26a5a 100644
--- a/pkg/rpm/Makefile
+++ b/pkg/rpm/Makefile
@@ -8,7 +8,8 @@ DEFAULT_RELEASE := 1
VERSION ?= $(DEFAULT_VERSION)
RELEASE ?= $(DEFAULT_RELEASE)
-BUILD_DEPENDS = libxml2 libxslt rpm-build rpmlint
+BUILD_DEPENDS_unit = libxml2 libxslt rpm-build rpmlint
+BUILD_DEPENDS = $(BUILD_DEPENDS_unit)
MODULES=
-include Makefile.*
@@ -51,6 +52,25 @@ check-build-depends:
fi \
}
+check-build-depends-%:
+ @{ \
+ not_installed= ; \
+ for pkg in $(BUILD_DEPENDS_unit) $(BUILD_DEPENDS_$*); do \
+ rpm -qi $${pkg} >/dev/null 2>&1 ; \
+ if [ $$? -ne 0 ]; then \
+ not_installed="$${not_installed} $${pkg}" ; \
+ fi ; \
+ done ; \
+ if test -n "$${not_installed}" ; then \
+ echo "" >&2 ; \
+ echo "The following packages are required in order to proceed:" >&2 ; \
+ echo "" >&2 ; \
+ echo $${not_installed} >&2 ; \
+ echo "" >&2 ; \
+ exit 1 ; \
+ fi \
+ }
+
rpmbuild/SPECS:
mkdir -p rpmbuild/SPECS
@@ -74,7 +94,7 @@ rpmbuild/SOURCES/unit-$(VERSION).tar.gz:
--transform "s#^#unit-$(VERSION)/#" \
LICENSE NOTICE CHANGES README configure auto src test
-unit: rpmbuild/SPECS/unit.spec rpmbuild/SOURCES/unit-$(VERSION).tar.gz
+unit: check-build-depends-unit rpmbuild/SPECS/unit.spec rpmbuild/SOURCES/unit-$(VERSION).tar.gz
@echo "===> Building $@ package" ; \
rpmbuild -D "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/unit.spec && \
ln -s rpmbuild/BUILD/$@-$(VERSION)/build $@
@@ -122,7 +142,7 @@ rpmbuild/SPECS/unit-%.spec: unit.module.spec.in ../../docs/changes.xml | rpmbuil
>> $@.tmp
mv $@.tmp $@
-unit-%: rpmbuild/SPECS/unit-%.spec rpmbuild/SOURCES/unit-$(VERSION).tar.gz
+unit-%: check-build-depends-% rpmbuild/SPECS/unit-%.spec rpmbuild/SOURCES/unit-$(VERSION).tar.gz
@echo "===> Building $@ package" ; \
rpmbuild -D "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/$@.spec && \
ln -s rpmbuild/BUILD/$@-$(VERSION)/build $@