[Build-common-hackers] Bug#288806: cdbs: support for perl modules that use Module::Build

Peter Makholm peter at makholm.net
Fri Nov 9 11:08:28 UTC 2007


Package: cdbs
Version: 0.4.49
Followup-For: Bug #288806

Just overriding DEB_MAKE_INVOKE doesn't work for me. It fails when the
makefile class tries to run $(DEB_MAKE_INVOKE) -k $(DEB_MAKE_CLEAN_TARGET)

Instead I've made the attached patch which provides native support for
Module::Build including code to detect which build system is used by
prefering Build.PL over Makefile.PL.

-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.18-4-xen-amd64 (SMP w/1 CPU core)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/bash

cdbs depends on no packages.

Versions of packages cdbs recommends:
ii  autotools-dev                 20070725.1 Update infrastructure for config.{
ii  debhelper                     5.0.57     helper programs for debian/rules

-- no debconf information
-------------- next part --------------
--- /usr/share/cdbs/1/class/perlmodule.mk	2007-05-20 18:13:10.000000000 +0200
+++ perlmodule.mk	2007-11-09 11:30:08.271007921 +0100
@@ -28,23 +28,58 @@
 # Make sure that CDBS_BUILD_DEPENDS is initialised
 include $(_cdbs_rules_path)/buildvars.mk$(_cdbs_makefile_suffix)
 
+DEB_PERL_BUILDSYSTEM := $(shell test -e Build.PL && echo Module::Build)
+DEB_PERL_BUILDSYSTEM ?= MakeMaker
+
 # Dependency according to Perl policy 4.3
 # (contrary to common misunderstanding a tighter dependency on perl 5.8
 # was only temporarily needed when 5.8 was introduced into Debian sid.)
 CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), perl (>= 5.6.0-16)
 
+ifneq ($(DEB_BUILDDIR),$(DEB_SRCDIR))
+$(error DEB_BUILDDIR and DEB_SRCDIR must be the same for Perl builds)
+endif
+
+ifeq ($(DEB_PERL_BUILDSYSTEM),Module::Build)
+
+include $(_cdbs_rules_path)/buildcore.mk$(_cdbs_makefile_suffix)
+
+common-configure-arch common-configure-indep:: Build
+Build:
+	(cd $(DEB_BUILDDIR) && perl Build.PL --installdirs vendor $(DEB_MODULEBUILD_USER_FLAGS) )
+
+common-build-arch common-build-indep:: debian/stamp-makefile-build
+debian/stamp-perl-build:
+	./Build build
+	touch $@
+
+common-install-arch common-install-indep:: common-install-impl
+common-install-impl::
+	./Build install destdir=$(DEB_DESTDIR)
+
+ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
+common-build-arch common-build-indep:: debian/stamp-perl-check
+debian/stamp-perl-check: debian/stamp-perl-build
+	./Build test
+	touch $@
+endif
+
+clean::
+	-./Build realclean
+	-rm -f debian/stamp-perl-*
+
+else
+
 include $(_cdbs_class_path)/perlmodule-vars.mk$(_cdbs_makefile_suffix)
 
 include $(_cdbs_class_path)/makefile.mk$(_cdbs_makefile_suffix)
 
 DEB_MAKEMAKER_PACKAGE ?= tmp
 
-ifneq ($(DEB_BUILDDIR),$(DEB_SRCDIR))
-$(error DEB_BUILDDIR and DEB_SRCDIR must be the same for Perl builds)
-endif
-
 common-configure-arch common-configure-indep:: Makefile
 Makefile:
 	(cd $(DEB_BUILDDIR) && $(DEB_MAKEMAKER_INVOKE) $(DEB_MAKEMAKER_USER_FLAGS) )
 
 endif
+
+endif


More information about the Build-common-hackers mailing list