Debian Codegraph @

debian/rules

raw
1 #!/usr/bin/make -f
2
3 PACKAGE = $(shell dh_listpackages)
4 TMP = $(CURDIR)/debian/$(PACKAGE)
5
6 include /usr/share/dpkg/architecture.mk
7 PERLVER := $(shell perl -MConfig -e 'print $$Config{version}')
8 ARCHLIB := $(shell perl -I/usr/lib/$(DEB_HOST_MULTIARCH)/perl/cross-config-$(PERLVER) -MConfig -e 'print $$Config{vendorarch}')
9
10 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
11
12 # #847397
13 # TL;dr: this is https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78176
14 # can be dropped once the gcc bug is fixed
15 include /usr/share/dpkg/architecture.mk
16 NOOPT = mips mipsel
17 ifneq (,$(filter $(DEB_HOST_ARCH), $(NOOPT)))
18 export DEB_CFLAGS_MAINT_STRIP:=-O2
19 export DEB_CFLAGS_MAINT_APPEND:=-O0
20 endif
21
22 # this number comes from IMAGER_API_VERSION in imexttypes.h
23 # it is used for the Provides: perl-imagerapi-XX relationship
24 # it needs to be updated manually because of the implications on the archive
25
26 IMAGERAPI_VERSION = 5
27 IMAGERAPI_DETECTED_VERSION =
28
29 _DETECTION_CMD := cpp `perl -MExtUtils::Embed -e ccopts` debian/get-imagerapi-version.cpp | sh
30 # GNU-make required for the use of define here.
31 define _ABORTBUILD
32 echo Aborting due to Imager API version mismatch - configured $(IMAGERAPI_VERSION), detected $(IMAGERAPI_DETECTED_VERSION)
33 exit 1
34 endef
35 # GNU-make required for the use of define here.
36 define _RUNBUILD
37 dh_auto_build
38 printf "%s\n%s\n%s\n" \
39 "# this variable is the preferred interface for generating a perl-imagerapi-* dependency." \
40 "# See #693003." \
41 "PERL_IMAGERAPI_DEPENDS=perl-imagerapi-$(IMAGERAPI_VERSION)" \
42 > debian/perl-imagerapi.make
43 sed "s,@IMAGERAPI_VERSION@,$(IMAGERAPI_VERSION)," debian/dh_perl_imager.in >debian/dh_perl_imager
44 chmod +x debian/dh_perl_imager
45 pod2man debian/dh_perl_imager debian/dh_perl_imager.1
46 endef
47
48 %:
49 dh $@
50
51 # GNU-make required for the eval ... construct here.
52 getapi_version: imconfig.h
53 : $(eval IMAGERAPI_DETECTED_VERSION := $(shell $(_DETECTION_CMD)))
54 @echo IMAGERAPI_DETECTED_VERSION detected as $(IMAGERAPI_DETECTED_VERSION)
55
56 override_dh_auto_configure:
57 # since 1.020, T1 and FT1 are disabled by default but keeping it explicit doesn't hurt
58 dh_auto_configure -- --disable=FT1,T1,W32
59
60 # GNU-make required for the use of "in-line conditional *if*", and filter-out function.
61 override_dh_auto_build: getapi_version
62 $(if $(filter-out $(IMAGERAPI_VERSION),$(IMAGERAPI_DETECTED_VERSION)),$(_ABORTBUILD),$(_RUNBUILD))
63
64 override_dh_auto_install:
65 dh_auto_install
66 # Imager::Font::Type1 is a wrapper around Imager::Font::T1
67 # which we don't build; cf. #638762
68 $(RM) -v $(TMP)/$(ARCHLIB)/Imager/Font/Type1.pm \
69 $(TMP)/usr/share/man/man3/Imager::Font::Type1.3pm
70
71 override_dh_installexamples:
72 dh_installexamples
73 sed -i '1s|^#!perl|#!/usr/bin/perl|' $(TMP)/usr/share/doc/libimager-perl/examples/*
74
75 override_dh_fixperms:
76 dh_fixperms
77 chmod a+x $(TMP)/usr/share/doc/$(PACKAGE)/examples/*.pl
78
79 override_dh_gencontrol:
80 dh_gencontrol -- -Vperl-imagerapi-version=$(IMAGERAPI_VERSION)
81
82 .PHONY: getapi_version