[SCM] Debian packaging of libimager-perl branch, master, updated. debian/0.93+dfsg-1-6-g2154c05

gregor herrmann gregoa at debian.org
Sun Dec 9 00:02:50 UTC 2012


The following commit has been merged in the master branch:
commit c03c40bf25d31aa7c0a907a51338f54e1b0ba387
Author: gregor herrmann <gregoa at debian.org>
Date:   Sun Dec 9 00:56:07 2012 +0100

    update debian/rules with gnu make magic
    
    IMAGERAPI_DETECTED_VERSION is now evaluated only once, and at the right time
    thanks alot to somian!

diff --git a/debian/rules b/debian/rules
index 018df6b..5e4a897 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,19 +8,16 @@ TMP     = $(CURDIR)/debian/$(PACKAGE)
 # it needs to be updated manually because of the implications on the archive
 
 IMAGERAPI_VERSION = 5
-IMAGERAPI_DETECTED_VERSION = $(shell [ ! -e imconfig.h ] || cpp `perl -MExtUtils::Embed -e ccopts` debian/get-imagerapi-version.cpp | sh)
+IMAGERAPI_DETECTED_VERSION =
 
-%:
-	dh $@
-
-override_dh_auto_configure:
-	dh_auto_configure -- --disable=TT-fonts
-
-override_dh_auto_build:
-ifneq ($(IMAGERAPI_VERSION),$(IMAGERAPI_DETECTED_VERSION))
+_DETECTION_CMD := cpp `perl -MExtUtils::Embed -e ccopts` debian/get-imagerapi-version.cpp | sh
+# GNU-make required for the use of define here.
+define _ABORTBUILD
 	echo Aborting due to Imager API version mismatch - configured $(IMAGERAPI_VERSION), detected $(IMAGERAPI_DETECTED_VERSION)
 	exit 1
-else
+endef
+# GNU-make required for the use of define here.
+define _RUNBUILD
 	dh_auto_build
 	printf "%s\n%s\n%s\n" \
 	  "# this variable is the preferred interface for generating a perl-imagerapi-* dependency." \
@@ -30,7 +27,22 @@ else
 	sed "s, at IMAGERAPI_VERSION@,$(IMAGERAPI_VERSION)," debian/dh_perl_imager.in >debian/dh_perl_imager
 	chmod +x debian/dh_perl_imager
 	pod2man debian/dh_perl_imager debian/dh_perl_imager.1
-endif
+endef
+
+%:
+	dh $@
+
+# GNU-make required for the eval ... construct here.
+getapi_version: imconfig.h
+	: $(eval IMAGERAPI_DETECTED_VERSION := $(shell $(_DETECTION_CMD)))
+	@echo IMAGERAPI_DETECTED_VERSION detected as $(IMAGERAPI_DETECTED_VERSION)
+
+override_dh_auto_configure:
+	dh_auto_configure -- --disable=TT-fonts
+
+# GNU-make required for the use of "in-line conditional *if*", and filter-out function.
+override_dh_auto_build: getapi_version
+	$(if $(filter-out $(IMAGERAPI_VERSION),$(IMAGERAPI_DETECTED_VERSION)),$(_ABORTBUILD),$(_RUNBUILD))
 
 override_dh_auto_install:
 	dh_auto_install
@@ -56,3 +68,5 @@ override_dh_clean:
 
 override_dh_gencontrol:
 	dh_gencontrol -- -Vperl-imagerapi-version=$(IMAGERAPI_VERSION)
+
+.PHONY: getapi_version

-- 
Debian packaging of libimager-perl



More information about the Pkg-perl-cvs-commits mailing list