Source: libxml-bare-perl
Version: 0.53-3
Tags: patch upstream
User: debian-cr...@lists.debian.org
Usertags: ftcbfs

libxml-bare-perl fails to cross build from source, because it uses the
build architecture compiler. The compiler detection in Makefile.PL
actually is not very smart and just uses "gcc". I am attaching a patch
that makes the CC configurable via environment and falls back to the
detection mechanism of perl itself. While this improves cross building,
I fear the patch will regress msvc builds as is, because earlier getcc
used to return 0 for msvc and now it'll really return a compiler there.
So the patch will work on Debian, but upstream may want to refine it.

Helmut
--- libxml-bare-perl-0.53.orig/Makefile.PL
+++ libxml-bare-perl-0.53/Makefile.PL
@@ -1,4 +1,5 @@
 #!/usr/bin/perl
+use Config;
 use ExtUtils::MakeMaker;
 require 5.006;
 my @basics = ( 
@@ -90,13 +91,8 @@
   );
 }
 sub getcc {
-  my $div = (substr($ENV{'PATH'},0,1) eq '/') ? ':' : ';';
-  my @path = split($div,$ENV{'PATH'});
-  foreach my $dir ( @path ) {
-    return 'gcc' if( -e "$dir/gcc" || -e "$dir/gcc.exe" ); # prefer gcc
-    return 'cc'  if( -e "$dir/cc"  || -e "$dir/cc.exe"  );
-  }               
-  return 0;
+  return $ENV{'CC'} if defined $ENV{'CC'};
+  return $Config::Config{cc};
 }
 
 # The following are hacks to force static linking and so remove need for msvcr## dll

Reply via email to