Re: Fun with ExtUtils::MakeMaker and Windows import libraries
- From: Torsten Schoenfeld <kaffeetisch gmx de>
- To: gtk-perl-list gnome org
- Subject: Re: Fun with ExtUtils::MakeMaker and Windows import libraries
- Date: Sun, 03 Aug 2008 16:45:42 +0200
spicy jack wrote:
I've been working on getting the Gtk2-Perl stack to compile under
MSWin32 without as much pain as there is now. Windows has something
called 'import libraries' [1], which currently I have to create by
hand when I compile Cairo and Glib in order to get Gtk2 to compile. I
create these import libraries by hacking up the Makefile and adding
something similar to this:
I don't have this problem on Windows XP with gtk+ 2.12.9, Visual Studio 6.0,
perl 5.8.8 from ActiveState, and CVS checkouts of our modules. Glib, Gtk2,
and Gtk2::GladeXML compile and pass all their tests.
I'm not sure if it's still necessary, but at some point in the past,
ExtUtils::MakeMaker had to be patched to not discard important linker
arguments. See <http://rt.cpan.org/Ticket/Display.html?id=21430>.
If you're using perl 5.10, you'll need to patch ExtUtils::Depends as in the
attached patch. I'll commit it shortly.
Also, Storable still seems to be broken on win32, so you might have to set the
environment variable FORCE_DATA_DUMPER. muppet, maybe we should default to
using Data::Dumper on win32?
1) I created a dynamic_lib method in the Makefile.PL for
Cairo/Glib/Gtk2, and added Makefile code similar to the above. It
didn't work, as MakeHelper overrides my dynamic_lib method later on in
order to quiet things somewhere. I disabled dynamic_lib in MakeHelper
and my overridden dynamic_lib method gets fired. Is there a better
place for my extra code than the dynamic_lib method? Oh, I just
found the extra copy of MakeHelper.pm in the Glib source, I'm now
doing my sad panda face :(
MakeHelper.pm is the place for this kind of fiddling, I think. Cairo and Glib
have separate MakeHelper.pm's because Cairo can't depend on Glib. And both
aren't that similar anyway.
3) I was going to add a test in Makefile.PL to decide if the above
import libraries get added to the Makefile via
ExtUtils::Depends->set_libs, it would end up looking something like
this (taken from a patch I have made to the Gtk2 Makefile.PL):
use Config;
if ( $^O =~ /Win32/ ) {
$gtk2->set_libs (q(-L) . $Config{bin} . q( ) . $pkgcfg_gtk{libs}
. q(-lGlibPerl -lCairoPerl));
} else {
$gtk2->set_libs ($pkgcfg_gtk{libs});
}
Can someone think of a better way to do this? Is this not worth
pursuing at all because? Too much hassle?
This should be done by ExtUtils::Depends. Specifically, find_extra_libs is
meant for this.
--
Bye,
-Torsten
Index: Depends.pm
===================================================================
RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/ExtUtils-Depends/lib/ExtUtils/Depends.pm,v
retrieving revision 1.18
diff -u -r1.18 Depends.pm
--- Depends.pm 30 Mar 2008 15:36:23 -0000 1.18
+++ Depends.pm 2 Aug 2008 12:45:00 -0000
@@ -302,7 +302,13 @@
my %mappers = (
MSWin32 => sub { $_[0] . '.lib' },
- cygwin => sub { 'lib' . $_[0] . '.dll.a'},
+ cygwin => sub {
+ '(?:' .
+ 'lib' . $_[0] . '.dll.a' .
+ '|' .
+ $_[0] . '.dll' .
+ ')'
+ },
);
my $mapper = $mappers{$^O};
return () unless defined $mapper;
Index: ParseXSDoc.pm
===================================================================
RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/ParseXSDoc.pm,v
retrieving revision 1.34
diff -u -r1.34 ParseXSDoc.pm
--- ParseXSDoc.pm 30 Mar 2008 17:22:08 -0000 1.34
+++ ParseXSDoc.pm 1 Aug 2008 21:02:13 -0000
@@ -87,7 +87,7 @@
# uses an obscene amount of ram on Gtk2's nearly 200 xs files. Use
# Storable unless the user really really wants to force us to fall
# back to Data::Dumper.
- if ($ENV{FORCE_DATA_DUMPER}) {
+ if ($ENV{FORCE_DATA_DUMPER} || $^O eq 'MSWin32') {
$Data::Dumper::Purity = 1;
print Data::Dumper->Dump([$parser->{xspods}, $parser->{data}],
[qw($xspods $data)]);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]