Subject: | Does not build on Win32 |
Currently XML::LibXSLT doesn't build on MSWin32 due to differences in
the library names between Linux and Windows. After modifing the
Makefile.pl to use the correct lib names for the platform, there is a
issue with a filename conflict between the xs dll and the lib dll.
Here is a patch that tries to address it this issue in 1.66 on Perl
5.8.8. It was originally written (not by me) for v1.62 but does work
for it (may have to patch by hand). It currently doesn't work on Perl
5.10 due to a bug in the DynaLoader (rumor has it he fix will be in
5.10.1), however. May want to test it some more though.
Subject: | XML-LibXSLT-1.66-win32build.diff |
diff -uNr XML-LibXSLT-1.66.orig/LibXSLT.pm XML-LibXSLT-1.66/LibXSLT.pm
--- XML-LibXSLT-1.66.orig/LibXSLT.pm 2008-01-29 16:03:05.000000000 -0500
+++ XML-LibXSLT-1.66/LibXSLT.pm 2008-11-05 16:28:14.326138600 -0500
@@ -21,6 +21,11 @@
@ISA = qw(DynaLoader);
+# For Windows, change the file extension of the dll we are looking
+# for to avoid picking up the real lib LibXSLT.
+our $is_Win32 = ($^O =~ /Win32/);
+local $DynaLoader::dl_dlext = 'xs.dll' if $is_Win32;
+
bootstrap XML::LibXSLT $VERSION;
# the following magic lets XML::LibXSLT internals know
diff -uNr XML-LibXSLT-1.66.orig/Makefile.PL XML-LibXSLT-1.66/Makefile.PL
--- XML-LibXSLT-1.66.orig/Makefile.PL 2008-01-29 16:03:05.000000000 -0500
+++ XML-LibXSLT-1.66/Makefile.PL 2008-11-05 16:32:03.547822600 -0500
@@ -62,11 +62,17 @@
}
}
-if ($config{LIBS} !~ /\-lxslt/) {
- $config{LIBS} .= ' -lxslt -lxml2 -lz -lm';
+# If building for Windows, adjust the lib names
+my $libxslt_name = $is_Win32 ? 'libxslt' : 'xslt';
+
+if ($config{LIBS} !~ /\-l$libxslt_name/) {
+ my $libxml2_name = $is_Win32 ? 'libxml2' : 'xml2';
+ my $libzlib_name = $is_Win32 ? 'zlib' : 'z';
+ my $libmath_option = $is_Win32 ? '' : '-lm';
+ $config{LIBS} .= " -l$libxslt_name -l$libxml2_name -l$libzlib_name $libmath_option";
}
-if (!have_library("xslt")) {
+if (!have_library("$libxslt_name")) {
print STDERR <<DEATH;
libxslt not found
Try setting LIBS and INC values on the command line
@@ -110,6 +116,12 @@
print "INC: $config{INC}\n";
}
+if ( $^O =~ m/Win32/ ) {
+ # avoid possible shared library name conflict
+ # maybe the same is reasonable for other platforms?
+ $config{DLEXT} = 'xs.dll';
+}
+
WriteMakefile(
'NAME' => 'XML::LibXSLT',
'VERSION_FROM' => 'LibXSLT.pm', # finds $VERSION
@@ -284,9 +296,9 @@
use Conftest; \$loaded++;
EOT
close($cfile);
- xsystem("$^X Makefile.PL " . join(' ', map { "'$_=$config{$_}'" } keys %config));
+ xsystem("$^X Makefile.PL INC=\"$config{INC}\" LIBS=\"$config{LIBS}\"");
my $file = $config{MAKEAPERL} ? "-f Makefile.aperl FIRST_MAKEFILE=Makefile.aperl" : "";
- xsystem("$Config{make} $file test 'OTHERLDFLAGS=$opt'");
+ xsystem("$Config{make} $file");
}
sub try_link {