From: Orton, Yves Date: Wed, 17 Sep 2003 15:47:35 +0000 (+0100) Subject: RE: MM in maint@21251 breaks mp2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a6ab0b5c7971198624b2f1ac7ae236adc2773b84;p=p5sagit%2Fp5-mst-13.2.git RE: MM in maint@21251 breaks mp2 From: "Orton, Yves" Message-ID: <71B318898201D311845C0008C75DAD1C089611FE@defra1ex2> Date: Wed, 17 Sep 2003 15:47:35 +0100 p4raw-id: //depot/perl@21263 --- diff --git a/lib/ExtUtils/MM_Unix.pm b/lib/ExtUtils/MM_Unix.pm index 3821a35..12ee1d6 100644 --- a/lib/ExtUtils/MM_Unix.pm +++ b/lib/ExtUtils/MM_Unix.pm @@ -1886,17 +1886,19 @@ usually solves this kind of problem. =item init_others -Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH, LD, +Initializes EXTRALIBS, BSLOADLIBS, LDLOADLIBS, LIBS, LD_RUN_PATH, OBJECT, BOOTDEP, PERLMAINCC, LDFROM, LINKTYPE, SHELL, NOOP, FIRST_MAKEFILE, MAKEFILE_OLD, NOECHO, RM_F, RM_RF, TEST_F, TOUCH, CP, MV, CHMOD, UMASK_NULL, ECHO, ECHO_N +LD is initialized in init_linker() + =cut sub init_others { # --- Initialize Other Attributes my($self) = shift; - $self->{LD} ||= 'ld'; + # Compute EXTRALIBS, BSLOADLIBS and LDLOADLIBS from $self->{LIBS} # Lets look at $self->{LIBS} carefully: It may be an anon array, a string or @@ -2237,10 +2239,14 @@ sub init_INSTALL { Unix has no need of special linker flags. +However this does initialize the default linker if it has not already been set. It uses +the value from Config and then falls back to 'ld' + =cut sub init_linker { my($self) = shift; + $self->{LD} ||= $Config{ld} || 'ld'; $self->{PERL_ARCHIVE} ||= ''; $self->{PERL_ARCHIVE_AFTER} ||= ''; $self->{EXPORT_LIST} ||= ''; diff --git a/lib/ExtUtils/MM_Win32.pm b/lib/ExtUtils/MM_Win32.pm index 8fe0b96..be9538e 100644 --- a/lib/ExtUtils/MM_Win32.pm +++ b/lib/ExtUtils/MM_Win32.pm @@ -155,8 +155,8 @@ sub init_DIRFILESEP { Override some of the Unix specific commands with portable ExtUtils::Command ones. -Also provide defaults for LD and AR in case the %Config values aren't -set. +Also provide a default for AR in case the %Config values aren't +set. LD is now set in init_linker(). LDLOADLIBS's default is changed to $Config{libs}. @@ -181,7 +181,7 @@ sub init_others { $self->{TEST_F} ||= '$(PERLRUN) -MExtUtils::Command -e test_f'; $self->{DEV_NULL} ||= '> NUL'; - $self->{LD} ||= $Config{ld} || 'link'; + $self->{AR} ||= $Config{ar} || 'lib'; $self->SUPER::init_others; @@ -382,11 +382,15 @@ END =item init_linker +Unless previosuly set initializes LD to be the linker specified in Config and falls back +to the standard Win32 linker 'link'. + =cut sub init_linker { my $self = shift; + $self->{LD} ||= $Config{ld} || 'link'; $self->{PERL_ARCHIVE} = "\$(PERL_INC)\\$Config{libperl}"; $self->{PERL_ARCHIVE_AFTER} = ''; $self->{EXPORT_LIST} = '$(BASEEXT).def'; diff --git a/lib/ExtUtils/t/MM_Unix.t b/lib/ExtUtils/t/MM_Unix.t index 6683761..7de8065 100644 --- a/lib/ExtUtils/t/MM_Unix.t +++ b/lib/ExtUtils/t/MM_Unix.t @@ -18,7 +18,7 @@ BEGIN { plan skip_all => 'Non-Unix platform'; } else { - plan tests => 115; + plan tests => 116; } } @@ -235,7 +235,7 @@ is ($t->replace_manpage_separator('Foo/Bar'),'Foo::Bar','manpage_separator'); ############################################################################### $t->init_linker; -foreach (qw/ EXPORT_LIST PERL_ARCHIVE PERL_ARCHIVE_AFTER /) +foreach (qw/ EXPORT_LIST PERL_ARCHIVE PERL_ARCHIVE_AFTER LD /) { ok( exists $t->{$_}, "$_ was defined" ); is( $t->{$_}, '', "$_ is empty on Unix"); diff --git a/lib/ExtUtils/t/MM_Win32.t b/lib/ExtUtils/t/MM_Win32.t index 1431aba..6e39f7a 100644 --- a/lib/ExtUtils/t/MM_Win32.t +++ b/lib/ExtUtils/t/MM_Win32.t @@ -110,12 +110,12 @@ delete $ENV{PATHEXT} unless $had_pathext; } # init_others(): check if all keys are created and set? -# qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP TEST_F LD AR LDLOADLIBS DEV_NUL ) +# qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP TEST_F AR LDLOADLIBS DEV_NUL ) { my $mm_w32 = bless( { BASEEXT => 'Foo' }, 'MM' ); $mm_w32->init_others(); my @keys = qw( TOUCH CHMOD CP RM_F RM_RF MV NOOP - TEST_F LD AR LDLOADLIBS DEV_NULL ); + TEST_F AR LDLOADLIBS DEV_NULL ); for my $key ( @keys ) { ok( $mm_w32->{ $key }, "init_others: $key" ); } @@ -192,6 +192,7 @@ delete $ENV{PATH} unless $had_path; my $after = ''; $MM->init_linker; + ok( $MM->{ LD }, "init_linker sets LD" ); is( $MM->{PERL_ARCHIVE}, $libperl, 'PERL_ARCHIVE' ); is( $MM->{PERL_ARCHIVE_AFTER}, $after, 'PERL_ARCHIVE_AFTER' ); is( $MM->{EXPORT_LIST}, $export, 'EXPORT_LIST' );