[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Fix for user-build of Digest::MD5

Hi, Debian-Perlistas,

It's my first posting to this list, so greetings. I've got a few years
experience behind me in using Perl on Cygwin and Win32, and a bit less
than that using Perl on *NIX and GNU/Linux. My basic philosophy is
TMTOWTDI, hopefully the reader's will be as well.

I've repeatedly run across a little "build bug" with CPAN module
"Digest::MD5" (at v2.24 now I think) which will prevent the user / admin
trying to install it using CPAN or manually, from getting a "clean" run.
This sort of thing bothers me. I did something about it: made a patch.
That patch is attached to this message.

I haven't looked at the source for the libdigest-md5-perl Debian package
to see how Debian's maintainer deals with this module's issues. It will
be fun to compare someday. Anyway, the version of that package for
stable/Woody is quite far behind (several releases) so I wanted to offer
those who might care a way to easily update. If you don't know why you
might care about Digest::MD5, you probably want to skip on to the next
list posting (if you haven't already).

My tips for accomplishing this little thing:

  Say you love to use CPAN, don't care to manually d/l and build mods.
  If that's the case, this set of procedures ought to work for your
  (1) enter cpan shell [$ perl -MCPAN -e 'shell']
  (2) input at cpan prompt like so:
    cpan> look Digest::MD5
      which will get the archive for you, unroll it and dump you into
      a subshell in that directory of your CPAN.pm build space;
  (3) cd ../ (I think is the best way)
  (4) do this:
   $ patch -Zp5 <{path to where you saved this patch.diff}
      if the patch applied cleanly, then
   $ exit
      otherwise troubleshoot your 'patch' technique ;-)
  (5) at cpan prompt again, do
    cpan> test Digest::MD5
    cpan> install Digest::MD5

and you are done. Assuming you've already got CPAN.pm setup and running
routinely the way you want it to, this is fast and convenient. Otherwise
manually building and installing the module from the source archive is
trivial to most experienced Perl users: the typical tripartate
incantation of "perl Makefile.PL [verbose] ; make test ; make install"
will do the trick.

I don't get my mail answered by upstream maintainer (module author) Gisle
Aas so I am publishing my patch here in hopes some of the people who
might like it will see it. Ideally this will get fixed upstream someday.

     Soren Andersen

See my OpenPGP key at https://savannah.gnu.org/people/viewgpg.php?user_id=6050
GnuPG public key fingerprint  | "Only when efforts to reform society have as
 BD26 A5D8 D781 C96B 9936     |  their point of departure the reformation of
 310F 0573 A3D9 4E24 4EA6     |  the inner life -- human revolution -- will
they lead us with certainty to a world of lasting peace and true human security."
                                -- Daisaku Ikeda
diff -Naur /home/somian/.cpan/build/Digest-MD5-2.24/Makefile.PL /home/somian/buildtmp/fix/Digest-MD5-2.24/Makefile.PL
--- /home/somian/.cpan/build/Digest-MD5-2.24/Makefile.PL	Sun Jan 19 04:38:57 2003
+++ /home/somian/buildtmp/fix/Digest-MD5-2.24/Makefile.PL	Sat May 31 05:41:31 2003
@@ -1,7 +1,13 @@
+## --- this Makefile.PL has been patched to build without error on Debian GNU/Linux --- ##
+## --- patch author: Soren Andersen <somian -AT- pobox -DOT- com> --- ##
 require 5.004;
 use strict;
 use Config qw(%Config);
 use ExtUtils::MakeMaker;
+use vars qw'$OR_libs $OR_ldflags $OR_lddlflags';
+$OR_ldflags = $Config{ldflags};
+$OR_lddlflags = $Config{lddlflags};
+$OR_libs = $Config{libs};
 my @extra;
 @extra = (DEFINE => "-DU32_ALIGNMENT_REQUIRED") unless free_u32_alignment();
@@ -96,7 +102,16 @@
+    FixConfig_4Deb()
+     or die "Attempt to rectify ".'%Config'." for Debian build failed\n";
+  print "AFTER:\n      our ld flags: $OR_ldflags\n",
+     "  and our lddl flags: $OR_lddlflags\n",
+     "  and our libs: ";
+     for (split(/\s+/,$OR_libs))  {
+	 printf "%12s", $_;
+     }
+  print "\n";
     my $cc_cmd = "$Config{cc} $Config{ccflags} -I$Config{archlibexp}/CORE";
     my $exe = "u32align$Config{_exe}";
     if ($^O eq 'MSWin32') {
@@ -105,7 +120,7 @@
 	$cc_cmd .= " -o $exe";
     my $rc;
-    $rc = system("$cc_cmd $Config{ldflags} u32align.c $Config{libs}");
+    $rc = system("$cc_cmd $OR_ldflags u32align.c $OR_libs");
     if ($rc) {
 	print "Can't compile test program\n";
 	unlink("u32align.c", $exe, "u32align$Config{_o}");
@@ -129,4 +144,23 @@
 	print "signal $rc\n";
+sub FixConfig_4Deb  {
+  print "\nBEFORE: Our platform: $Config{osname}\n",
+     "  and our ld flags: $OR_ldflags\n",
+     "  and our lddl flags: $OR_lddlflags\n",
+     "  and our libs: ";
+     for (split(/\s+/,$OR_libs))  {
+	 printf "%12s", $_;
+     }
+  print "\n";
+  if($Config{osname} =~/linux/i)  {
+      $OR_ldflags   =~s!\-L/usr/local/lib!!g;
+      $OR_lddlflags =~s!\-L/usr/local/lib!!g;
+      $OR_libs      =~s!\s?\-lg?dbm?!!g;
+      $OR_libs = '-Wl,-dy '. $OR_libs;
+      return 'true';
+  }
+  return 0x0;

Reply to: