Package: dh-make-perl
Version: 0.12
Severity: normal
Tags: patch

rules.xs and rules.noxs assume that all modules being installed will be
built by ExtUtils::MakeMaker, which is becoming true less and less
often.  Attached is a patch for both rules files, which causes the
makefile to use Module::Build to build modules that include a Build.PL
file, and to use ExtUtils::MakeMaker if there is a Makefile.PL instead
(if both exist, Build.PL is preferred).

For the benefit of people trying to build packages who may find this
report, you can fix the problem by copying this patch into a file on
your system and using these commands:

% mkdir ~/.dh-make-perl
% cd ~/.dh-make-perl
% cp /usr/share/dh-make-perl/rules.{xs,noxs} .
% patch -p1 < /path/to/downloaded/patch/file

Be careful about cutting and pasting the patch file, make is picky about
which lines must start with spaces (the ifeq and endif lines) and which
must start with tabs (basically everything else).

-- System Information:
Debian Release: 3.1
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.4.18-bf2.4
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages dh-make-perl depends on:
ii  debhelper                     4.2.31     helper programs for debian/rules
ii  dpkg-dev                      1.10.27    Package building tools for Debian
ii  fakeroot                      1.2.2      Gives a fake root environment
ii  libyaml-perl                  0.35-1     YAML Ain't Markup Language (tm)
ii  make                          3.80-9     The GNU version of the "make" util
ii  perl                          5.8.4-6    Larry Wall's Practical Extraction 
ii  perl-modules [libpod-parser-p 5.8.4-6    Core Perl modules

-- no debconf information
diff -Naur original/rules.noxs with-module-build/rules.noxs
--- original/rules.noxs 2005-03-17 14:17:05.000000000 -0500
+++ with-module-build/rules.noxs        2005-03-17 14:20:42.000000000 -0500
@@ -3,6 +3,9 @@
 # packages. It was created by Marc Brockschmidt <[EMAIL PROTECTED]> for
 # the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
 # be used freely wherever it is useful.
+#
+# It was later modified by Jason Kohles <[EMAIL PROTECTED]>
+# http://www.jasonkohles.com/ to support Module::Build installed modules
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
@@ -12,6 +15,10 @@
 export PERL_MM_USE_DEFAULT=1
 
 PACKAGE=$(shell dh_listpackages)
+BUILDER := $(firstword $(sort $(wildcard Build.PL Makefile.PL)))
+ifeq ($(BUILDER),)
+       $(error Could not determine build type (need Build.PL or Makefile.PL))
+endif
 
 ifndef PERL
 PERL = /usr/bin/perl
@@ -32,19 +39,27 @@
 build-stamp:
        dh_testdir
 
-       # Add commands to compile the package here
-       $(PERL) Makefile.PL INSTALLDIRS=vendor
-       $(MAKE) OPTIMIZE="$(CFLAGS)"
-       
-       touch build-stamp
+    ifeq ($(BUILDER), Build.PL)
+               $(PERL) Build.PL installdirs=vendor
+               OPTIMIZE="$(OPTIMIZE)" ./Build
+               touch build-stamp
+    endif
+    ifeq ($(BUILDER), Makefile.PL)
+               $(PERL) Makefile.PL INSTALLDIRS=vendor
+               $(MAKE) OPTIMIZE="$(CFLAGS)"
+               touch build-stamp
+    endif
 
 clean:
        dh_testdir
        dh_testroot
 
-       # Add commands to clean up after the build process here
-       -$(MAKE) distclean
-       
+    ifeq ($(BUILDER), Build.PL)
+               -./Build distclean
+    endif
+    ifeq ($(BUILDER), Makefile.PL)
+               -$(MAKE) distclean
+    endif
        dh_clean build-stamp install-stamp
 
 install: install-stamp
@@ -53,14 +68,20 @@
        dh_testroot
        dh_clean -k
 
-       #$(MAKE) test
-       $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
-       
-       # As this is a architecture independent package, we are not supposed to 
install
-       # stuff to /usr/lib. MakeMaker creates the dirs, we delete them from 
the deb:
-       rmdir --ignore-fail-on-non-empty --parents $(TMP)/usr/lib/perl5
-
-       touch install-stamp
+    ifeq ($(BUILDER), Build.PL)
+               #./Build test
+               ./Build install destdir=$(TMP)
+               touch install-stamp
+    endif
+    ifeq ($(BUILDER), Makefile.PL)
+               #$(MAKE) test
+               $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
+               # As this is a architecture independent package, we are not
+               # supposed to install stuff to /usr/lib. MakeMaker creates
+               # the dirs, we delete them from the deb:
+               rmdir --ignore-fail-on-non-empty --parents $(TMP)/usr/lib/perl5
+               touch install-stamp
+    endif
 
 binary-arch:
 # We have nothing to do by default.
diff -Naur original/rules.xs with-module-build/rules.xs
--- original/rules.xs   2005-03-17 14:17:05.000000000 -0500
+++ with-module-build/rules.xs  2005-03-17 14:17:21.000000000 -0500
@@ -12,6 +12,10 @@
 export PERL_MM_USE_DEFAULT=1
 
 PACKAGE=$(shell dh_listpackages)
+BUILDER := $(firstword $(sort $(wildcard Build.PL Makefile.PL)))
+ifeq ($(BUILDER),)
+       $(error Could not determine build type (need Build.PL or Makefile.PL))
+endif
 
 ifndef PERL
 PERL = /usr/bin/perl
@@ -32,19 +36,27 @@
 build-stamp:
        dh_testdir
 
-       # Add commands to compile the package here
-       $(PERL) Makefile.PL INSTALLDIRS=vendor
-       $(MAKE) OPTIMIZE="$(CFLAGS)" LD_RUN_PATH=""
-
-       touch build-stamp
+    ifeq ($(BUILDER), Build.PL)
+               $(PERL) Build.PL installdirs=vendor
+               OPTIMIZE="$(OPTIMIZE)" ./Build
+               touch build-stamp
+    endif
+    ifeq ($(BUILDER), Makefile.PL)
+               $(PERL) Makefile.PL INSTALLDIRS=vendor
+               $(MAKE) OPTIMIZE="$(CFLAGS)"
+               touch build-stamp
+    endif
 
 clean:
        dh_testdir
        dh_testroot
 
-       # Add commands to clean up after the build process here
-       -$(MAKE) realclean
-
+    ifeq ($(BUILDER), Build.PL)
+               -./Build distclean
+    endif
+    ifeq ($(BUILDER), Makefile.PL)
+               -$(MAKE) distclean
+    endif
        dh_clean build-stamp install-stamp
 
 install: install-stamp
@@ -53,16 +65,20 @@
        dh_testroot
        dh_clean -k
 
-       # Add here commands to install the package into debian/tmp.
-       #$(MAKE) test
-       $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
-       
-       # As this is a architecture dependent package, we are not supposed to 
install
-       # stuff to /usr/share/perl5. MakeMaker creates the dirs, we delete them 
from 
-       # the deb:
-       rmdir --ignore-fail-on-non-empty --parents $(TMP)/usr/share/perl5
-       
-       touch install-stamp
+    ifeq ($(BUILDER), Build.PL)
+               #./Build test
+               ./Build install destdir=$(TMP)
+               touch install-stamp
+    endif
+    ifeq ($(BUILDER), Makefile.PL)
+               #$(MAKE) test
+               $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
+               # As this is a architecture independent package, we are not
+               # supposed to install stuff to /usr/lib. MakeMaker creates
+               # the dirs, we delete them from the deb:
+               rmdir --ignore-fail-on-non-empty --parents $(TMP)/usr/lib/perl5
+               touch install-stamp
+    endif
 
 # Build architecture-independent files here.
 binary-indep: build install

Reply via email to