[Reproducible-commits] [libextutils-depends-perl] 66/187: Create import libraries on MSWin32 if necessary

Maria Valentina Marin Rodrigues akira-guest at moszumanska.debian.org
Wed Jan 21 21:16:49 UTC 2015


This is an automated email from the git hooks/post-receive script.

akira-guest pushed a commit to branch pu/reproducible_builds
in repository libextutils-depends-perl.

commit 6c4341d19f27950941575922049f4f79fab3b7ac
Author: Torsten Schönfeld <kaffeetisch at gmx.de>
Date:   Sat Jul 4 15:23:25 2009 +0200

    Create import libraries on MSWin32 if necessary
    
    When using gcc on MSWin32 (with Strawberry Perl, for example), hook into
    ExtUtils::MakeMaker to create an import library for extensions so that
    linking against them works properly.
    
    Original patch by Ash Berlin.  Fixes RT #45224.
---
 Makefile.PL             |  3 +++
 lib/ExtUtils/Depends.pm | 32 ++++++++++++++++++++++++++++++--
 2 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index 35a5db2..c6b3634 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -29,6 +29,9 @@ WriteMakefile(
 			repository => 'http://git.gnome.org/cgit/perl-ExtUtils-Depends',
 		},
 		keywords => ['XS', 'XS extensions', 'dependency'],
+		no_index => {
+			package => 'ExtUtils::MM',
+		},
 	},
 	LICENSE => 'perl',
 );
diff --git a/lib/ExtUtils/Depends.pm b/lib/ExtUtils/Depends.pm
index adc9d79..b41fcd7 100644
--- a/lib/ExtUtils/Depends.pm
+++ b/lib/ExtUtils/Depends.pm
@@ -282,6 +282,8 @@ sub get_makefile_vars {
 		TYPEMAPS => [@typemaps],
 	);
 
+	$self->build_dll_lib(\%vars) if $^O =~ /MSWin32/;
+
 	# we don't want to provide these if there is no data in them;
 	# that way, the caller can still get default behavior out of
 	# MakeMaker when INC, LIBS and TYPEMAPS are all that are required.
@@ -297,12 +299,19 @@ sub get_makefile_vars {
 	%vars;
 }
 
+sub build_dll_lib {
+	my ($self, $vars) = @_;
+	$vars->{macro} ||= {};
+	$vars->{macro}{'INST_DYNAMIC_LIB'} =
+		'$(INST_ARCHAUTODIR)/$(BASEEXT)$(LIB_EXT)';
+}
+
 sub find_extra_libs {
 	my $self = shift;
 
 	my %mappers = (
-		MSWin32 => sub { $_[0] . '.lib' },
-		cygwin  => sub { $_[0] . '.dll'},
+		MSWin32 => sub { $_[0] . '\.(?:lib|a)' },
+		cygwin	=> sub { $_[0] . '\.dll'},
 	);
 	my $mapper = $mappers{$^O};
 	return () unless defined $mapper;
@@ -331,6 +340,25 @@ sub find_extra_libs {
 	return @found_libs;
 }
 
+# Hook into ExtUtils::MakeMaker to create an import library on MSWin32 when gcc
+# is used.  FIXME: Ideally, this should be done in EU::MM itself.
+package # wrap to fool the CPAN indexer
+	ExtUtils::MM;
+use Config;
+sub static_lib {
+	my $base = shift->SUPER::static_lib(@_);
+
+	return $base unless $^O =~ /MSWin32/ && $Config{cc} =~ /^gcc/i;
+
+	return <<'__EOM__';
+# This isn't actually a static lib, it just has the same name on Win32.
+$(INST_DYNAMIC_LIB): $(INST_DYNAMIC)
+	dlltool --def $(EXPORT_LIST) --output-lib $@ --dllname $(BASEEXT).$(SO) $(INST_DYNAMIC)
+
+dynamic:: $(INST_DYNAMIC_LIB)
+__EOM__
+}
+
 1;
 
 __END__

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/libextutils-depends-perl.git



More information about the Reproducible-commits mailing list