Package: dh-make-perl
Version: 0.21
Severity: important
Tags: patch

Some modules, such as wxPerl (Wx-0.26), have their Makefile.PL files use the 
FindBin module. (Whether this is appropriate behavior or not is best left
for another discussion.)  Appropriate or not, dh-make-perl breaks FindBin
because FindBin finds the dh-make-perl script instead of the Makefile.PL.

I have attached a crude patch that makes things work.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-486
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages dh-make-perl depends on:
ii  debhelper                     5.0.37.2   helper programs for debian/rules
ii  dpkg-dev                      1.13.22    package building tools for Debian
ii  fakeroot                      1.5.8      Gives a fake root environment
ii  libmodule-depends-perl        0.10-1     identify the dependencies of a dis
ii  libyaml-perl                  0.57-2     YAML Ain't Markup Language (tm)
ii  make                          3.81-2     The GNU version of the "make" util
ii  perl                          5.8.8-6    Larry Wall's Practical Extraction 
ii  perl-modules [libpod-parser-p 5.8.8-6    Core Perl modules

Versions of packages dh-make-perl recommends:
ii  apt-file                      2.0.8      APT package searching utility -- c
ii  libmodule-build-perl          0.26-1     Subclassable and make-independant 

-- no debconf information
--- dh-make-perl.orig   2006-06-23 14:09:21.000000000 -0400
+++ /usr/bin/dh-make-perl       2006-06-23 14:16:06.000000000 -0400
@@ -195,6 +195,7 @@
 load_overrides();
 my $tarball = setup_dir();
 $meta = process_meta("$maindir/META.yml") if (-f "$maindir/META.yml");
+findbin_fix();
 ($pkgname, $version) = extract_basic();
 move ($tarball, dirname($tarball) . "/${pkgname}_${version}.orig.tar.gz") if 
($tarball && $tarball =~ /(?:\.tar\.gz|\.tgz)$/);
 my $module_build = (-f "$maindir/Build.PL") ? "Module-Build" : "MakeMaker";
@@ -379,8 +380,21 @@
     return ($pkgname, $version);
 }
 
+sub makefile_pl {
+       return "$maindir/Makefile.PL";
+}
+
+sub findbin_fix {
+       $0 = makefile_pl;
+       # If FindBin's already been loaded, fix it
+       if (exists $FindBin::{Bin}) {
+               FindBin::again();
+                       
+       }
+}
+
 sub extract_name_ver {
-       my $makefile = "$maindir/Makefile.PL";
+       my $makefile = makefile_pl;
        my ($name, $ver);
 
        if (defined $meta->{name} and defined $meta->{version}) {

Reply via email to